Search in sources :

Example 1 with PropertySheetPanel

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);
}
Also used : PropertySheetPanel(automenta.vivisect.swing.property.propertysheet.PropertySheetPanel) PropertySheetDialog(automenta.vivisect.swing.property.propertysheet.PropertySheetDialog) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with PropertySheetPanel

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;
}
Also used : PropertySheetPanel(automenta.vivisect.swing.property.propertysheet.PropertySheetPanel)

Aggregations

PropertySheetPanel (automenta.vivisect.swing.property.propertysheet.PropertySheetPanel)2 PropertySheetDialog (automenta.vivisect.swing.property.propertysheet.PropertySheetDialog)1 LinkedHashMap (java.util.LinkedHashMap)1