use of maspack.properties.PropTreeCell in project artisynth_core by artisynth.
the class CompositePropertyPanel method isNullAllowed.
private boolean isNullAllowed(Property prop) {
if (prop instanceof EditingProperty) {
// then null values are allowed only if they are permitted
// on all the hosts
EditingProperty eprop = (EditingProperty) prop;
HostList hostList = eprop.getHostList();
PropTreeCell cell = eprop.getCell();
PropertyInfo[] infos = hostList.getAllInfos(cell);
boolean nullAllowed = true;
for (PropertyInfo info : infos) {
if (!info.getNullValueOK()) {
nullAllowed = false;
}
}
return nullAllowed;
} else {
return prop.getInfo().getNullValueOK();
}
}
use of maspack.properties.PropTreeCell in project artisynth_core by artisynth.
the class CompositePropertyPanel method printWidgetProps.
// For debugging only ...
void printWidgetProps(LinkedList<Property> props) {
if (myCpropProperty instanceof EditingProperty) {
EditingProperty eprop = (EditingProperty) myCpropProperty;
// HostList hostList = eprop.getHostList();
PropTreeCell cell = eprop.getCell();
System.out.println("parent cell=@" + cell.hashCode());
for (Property p : props) {
EditingProperty ep = (EditingProperty) p;
ep.getCell().getIndex();
System.out.println(" " + ep.getName() + "=@" + ep.getCell().hashCode());
if (ep.getCell().getParent() != cell) {
System.out.println("BAD");
}
}
System.out.println("OK");
}
}
use of maspack.properties.PropTreeCell in project artisynth_core by artisynth.
the class SelectionPopup method createPropertyDialog.
public void createPropertyDialog(Collection<? extends ModelComponent> selectedItems) {
HostList hostList = new HostList(selectedItems);
PropTreeCell tree = hostList.commonProperties(null, /* allowReadonly= */
true);
tree.removeDescendant("renderProps");
if (tree.numChildren() == 0) {
JOptionPane.showMessageDialog(myParentGUIComponent, "No common properties for selected components", "no common properties", JOptionPane.INFORMATION_MESSAGE);
} else {
PropertyDialog propDialog = new PropertyDialog("Edit properties", tree, hostList, "OK Cancel LiveUpdate");
propDialog.setScrollable(true);
if (myLocatePropEditClose) {
GuiUtils.locateRelative(propDialog, myLastBounds, 0.5, 0.5, 0, 0.5);
} else {
propDialog.locateRight(myMain.getFrame());
}
// propDialog.setSynchronizeObject (myMain.getRootModel());
myMain.registerWindow(propDialog);
propDialog.setTitle("Properties for " + getNameForSelection(selectedItems));
propDialog.setVisible(true);
}
}
use of maspack.properties.PropTreeCell in project artisynth_core by artisynth.
the class PropertyWidgetDialog method createEditingProperty.
private EditingProperty createEditingProperty(Property prop) {
if (prop.getHost() == null) {
throw new InternalErrorException("Property " + prop.getName() + " does not have host");
}
HostList hostList = new HostList(1);
hostList.addHost(prop.getHost());
// get single property from host list
String[] restricted = new String[] { prop.getName() };
String[] excluded = null;
PropTreeCell tree = hostList.commonProperties(null, /* allowReadonly= */
false, restricted, excluded);
if (tree.numChildren() == 0) {
throw new InternalErrorException("Property " + prop.getName() + " not found in host");
}
// expand save data in hostList down one level ...
hostList.saveBackupValues(tree);
return new EditingProperty(tree.getFirstChild(), hostList, /* live= */
true);
}
Aggregations