예제 #1
0
 public void saveChanges() {
   TreeModel model = tree.getModel();
   Object root = model.getRoot();
   ClassPropertiesInfo classInfo;
   int classCount = model.getChildCount(root);
   for (int c = 0; c < classCount; c++) {
     classInfo =
         (ClassPropertiesInfo) ((DefaultMutableTreeNode) model.getChild(root, c)).getUserObject();
     PropertySheetPanel propertiesPanel = classInfo.getPropertiesPanel();
     if (propertiesPanel != null) {
       // to exit edit mode and retrieve the value
       propertiesPanel.getTable().commitEditing();
       setProperties(classInfo);
     }
   }
   GeneralPreferences.saveProperties();
 }
예제 #2
0
 private HashMap<String, Property[]> extractProperties(TreeModel model) {
   HashMap<String, Property[]> props = new HashMap<>();
   DefaultMutableTreeNode classNode;
   Object root = model.getRoot();
   ClassPropertiesInfo classInfo;
   int classCount = model.getChildCount(root);
   Property[] classProperties;
   for (int c = 0; c < classCount; c++) {
     classNode = (DefaultMutableTreeNode) model.getChild(root, c);
     classInfo = (ClassPropertiesInfo) classNode.getUserObject();
     PropertySheetPanel propertiesPanel = classInfo.getPropertiesPanel();
     if (propertiesPanel != null) {
       // force out of edit mode
       propertiesPanel.getTable().commitEditing();
       classProperties = propertiesPanel.getProperties();
       props.put(classInfo.getName(), classProperties.clone());
     }
   }
   return props;
 }