use of maspack.properties.InheritableProperty in project artisynth_core by artisynth.
the class PropertyPanel method doAddWidgetsFlat.
private void doAddWidgetsFlat(Iterable<?> items) {
for (Object item : items) {
// ignore inactive properties
if (item instanceof Property) {
Property prop = (Property) item;
if (isInheritableProperty(prop) && ((InheritableProperty) prop).getMode() == PropertyMode.Inactive) {
continue;
}
addWidget(prop);
} else if (item instanceof Component) {
addWidget((Component) item);
}
}
}
use of maspack.properties.InheritableProperty in project artisynth_core by artisynth.
the class ExpandablePropertyPanel method addExtraWidgets.
public void addExtraWidgets(Iterable<?> items) {
for (Object item : items) {
// ignore inactive properties
if (item instanceof Property) {
Property prop = (Property) item;
if (isInheritableProperty(prop) && ((InheritableProperty) prop).getMode() == PropertyMode.Inactive) {
continue;
}
addExtraWidget(prop);
} else if (item instanceof Component) {
addExtraWidget((Component) item);
}
}
}
use of maspack.properties.InheritableProperty in project artisynth_core by artisynth.
the class CompositePropertyPanel method attachPropsToWidgets.
/**
* Attaches a newly created set of properties to their associated
* widgets.
*
* @param widgets list of widgets
* @param props newly created properties
* @param setValuesFromWidgets if <code>true</code>, then the properties
* should be set to assume the values currently stored in the widgets.
*/
private void attachPropsToWidgets(LabeledComponentBase[] widgets, LinkedList<Property> props, boolean setValuesFromWidgets) {
if (widgets.length != props.size()) {
throw new InternalErrorException("Number of widgets (" + widgets.length + ") != number of properties (" + props.size() + ")");
}
int i = 0;
for (Property prop : props) {
LabeledComponentBase widget = widgets[i++];
if (!setValuesFromWidgets || !(widget instanceof CompositePropertyPanel)) {
PropertyWidget.initializeWidget(widget, prop);
}
if (setValuesFromWidgets) {
if (widget instanceof CompositePropertyPanel) {
CompositePropertyPanel cpanel = (CompositePropertyPanel) widget;
if (cpanel.myCpropType != Property.VoidValue) {
setCpropValueFromWidget(prop, (CompositePropertyPanel) widget);
} else {
cpanel.myCpropProperty = prop;
cpanel.updateWidgetValues(/*updateFromSource=*/
true);
}
} else if (widget instanceof LabeledControl) {
LabeledControl ctrl = (LabeledControl) widget;
if (ctrl.getValue() != Property.VoidValue) {
setValueFromWidget(prop, ctrl);
} else {
if (prop instanceof EditingProperty) {
EditingProperty eprop = (EditingProperty) prop;
eprop.updateValue();
}
PropertyWidget.updateValue(ctrl, prop);
}
}
}
// will set value
PropertyWidget.finishWidget(widget, prop);
if (prop instanceof InheritableProperty) {
PropertyModeButton button = PropertyWidget.getModeButton((LabeledComponentBase) widget);
if (button != null) {
button.setProperty((InheritableProperty) prop);
}
}
}
}
Aggregations