Search in sources :

Example 6 with PropertyPanel

use of maspack.widgets.PropertyPanel in project artisynth_core by artisynth.

the class MenuBarHandler method showPullControllerPropertyDialog.

private void showPullControllerPropertyDialog() {
    if (myPullControllerPropertyDialog == null) {
        PullController pc = myMain.getPullController();
        PropertyPanel panel = new PropertyPanel();
        PropertyDialog dialog = new PropertyDialog("PullController properties", panel, "OK");
        dialog.addWidget(pc, "stiffness");
        dialog.locateRight(myMain.getFrame());
        // dialog.setSynchronizeObject(myMain.getRootModel());
        dialog.addWindowListener(new WindowAdapter() {

            public void windowClosed(WindowEvent e) {
                myPullControllerPropertyDialog = null;
            }
        });
        myMain.registerWindow(dialog);
        myPullControllerPropertyDialog = dialog;
        dialog.pack();
        dialog.setVisible(true);
    }
}
Also used : PropertyDialog(maspack.widgets.PropertyDialog) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) PullController(artisynth.core.workspace.PullController) PropertyPanel(maspack.widgets.PropertyPanel)

Example 7 with PropertyPanel

use of maspack.widgets.PropertyPanel in project artisynth_core by artisynth.

the class MuscleFibreAgent method createBundleWidgets.

private void createBundleWidgets() {
    myBundlePanel = new PropertyPanel();
    LabeledWidget widget;
    widget = (LabeledWidget) myBundlePanel.addWidget(myBundle.getProperty("name"));
    widget.setLabelText("bundle name");
    widget = (LabeledWidget) myBundlePanel.addWidget(myBundle.getProperty("renderProps"));
    widget.setLabelText("bundle renderProps");
    myBundlePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    myContentPane.addWidget(myBundlePanel);
}
Also used : LabeledWidget(maspack.widgets.LabeledWidget) PropertyPanel(maspack.widgets.PropertyPanel)

Example 8 with PropertyPanel

use of maspack.widgets.PropertyPanel in project artisynth_core by artisynth.

the class AddComponentAgent method setComponentType.

/**
 * Called whenever the specific class type of the components being added by
 * this agent is changed.
 */
public void setComponentType(Class type) {
    if (type == myComponentType) {
        return;
    }
    myComponentType = type;
    if (myPrototype != null) {
        setProperties(myPrototype, myPrototype);
    }
    myPrototype = getPrototypeComponent(type);
    if (myPrototype != null) {
        myHostList = new HostList(new HasProperties[] { myPrototype });
        myPropTree = myHostList.commonProperties(null, false);
        // remove properties which are to be excluded
        String[] excludedPropNames = getExcludedPropNames(type);
        for (int i = 0; i < excludedPropNames.length; i++) {
            myPropTree.removeDescendant(excludedPropNames[i]);
        }
        myHostList.saveBackupValues(myPropTree);
        myHostList.getCommonValues(myPropTree, /* live= */
        true);
        if (myPropertyPanelIdx != -1) {
            myDefaultProps = EditingProperty.createProperties(myPropTree, myHostList, /* isLive= */
            true);
            LinkedList<Property> basicProps = getBasicProps(type, myDefaultProps);
            if (basicProps.size() > 0) {
                LinkedList<Property> extraProps = new LinkedList<Property>();
                extraProps.addAll(myDefaultProps);
                extraProps.removeAll(basicProps);
                myPropertyPanel = new ExpandablePropertyPanel(basicProps, extraProps);
            } else {
                myPropertyPanel = new PropertyPanel(myDefaultProps);
            }
            if (myPropertyPanelBorderTitle != null) {
                String title = myPropertyPanelBorderTitle;
                if (title.indexOf("TYPE") != -1) {
                    title = title.replaceAll("TYPE", (String) myTypeSelector.getValue());
                }
                myPropertyPanel.setBorder(GuiUtils.createTitledPanelBorder(title));
            }
            resetDefaultProperties();
            myPropertyPanel.updateWidgetValues(/* updateFromSource= */
            false);
            myPropertyPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
            myContentPane.removeWidget(myPropertyPanelIdx);
            myContentPane.addWidget(myPropertyPanel, myPropertyPanelIdx);
            myContentPane.validate();
            // myContentPane.resetLabelAlignment();
            if (myDisplay.isVisible()) {
                myDisplay.pack();
            }
        }
    }
}
Also used : HasProperties(maspack.properties.HasProperties) ExpandablePropertyPanel(maspack.widgets.ExpandablePropertyPanel) HostList(maspack.properties.HostList) EditingProperty(maspack.properties.EditingProperty) Property(maspack.properties.Property) LinkedList(java.util.LinkedList) ExpandablePropertyPanel(maspack.widgets.ExpandablePropertyPanel) PropertyPanel(maspack.widgets.PropertyPanel)

Aggregations

PropertyPanel (maspack.widgets.PropertyPanel)8 HostList (maspack.properties.HostList)3 PropertyDialog (maspack.widgets.PropertyDialog)2 WayPoint (artisynth.core.probes.WayPoint)1 PullController (artisynth.core.workspace.PullController)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 LinkedList (java.util.LinkedList)1 EditingProperty (maspack.properties.EditingProperty)1 HasProperties (maspack.properties.HasProperties)1 Property (maspack.properties.Property)1 StringHolder (maspack.util.StringHolder)1 AutoCompleteStringField (maspack.widgets.AutoCompleteStringField)1 BooleanSelector (maspack.widgets.BooleanSelector)1 DoubleField (maspack.widgets.DoubleField)1 ExpandablePropertyPanel (maspack.widgets.ExpandablePropertyPanel)1 IntegerField (maspack.widgets.IntegerField)1 LabeledWidget (maspack.widgets.LabeledWidget)1 StringField (maspack.widgets.StringField)1 ValueChangeEvent (maspack.widgets.ValueChangeEvent)1