use of automenta.vivisect.swing.property.propertysheet.PropertySheetPanel in project opennars by opennars.
the class PropertyUtils method editProperties.
public static void editProperties(Window parent, Object obj, boolean editable) {
final PropertySheetPanel psp = getPropsPanel(obj, editable);
final PropertySheetDialog propertySheetDialog = createWindow(parent, editable, psp, "Properties of " + obj.getClass().getSimpleName());
if (!propertySheetDialog.ask()) {
// cancelled
return;
}
LinkedHashMap<String, SerializableProperty> newProps = new LinkedHashMap<>();
for (automenta.vivisect.swing.property.propertysheet.Property p : psp.getProperties()) newProps.put(p.getName(), new SerializableProperty(p));
setProperties(obj, newProps, true);
}
use of automenta.vivisect.swing.property.propertysheet.PropertySheetPanel in project opennars by opennars.
the class PropertyUtils method getPropsPanel.
public static PropertySheetPanel getPropsPanel(Object obj, boolean editable) {
PropertySheetPanel psp = new PropertySheetPanel();
psp.setMode(PropertySheet.VIEW_AS_CATEGORIES);
psp.setToolBarVisible(false);
psp.setEnabled(true);
psp.setSortingCategories(true);
psp.setDescriptionVisible(true);
Collection<SerializableProperty> props = getProperties(obj, editable).values();
for (SerializableProperty p : props) {
p.setEditable(editable && p.isEditable());
psp.addProperty(p);
}
return psp;
}
Aggregations