ingenias.editor.ObjectManager Maven / Gradle / Ivy
/**
* Copyright (C) 2010 Jorge J. Gomez-Sanz
*
*
* This file is part of the INGENME tool. INGENME is an open source meta-editor
* which produces customized editors for user-defined modeling languages
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 3 of the License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
**/
package ingenias.editor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import org.jgraph.JGraph;
import org.jgraph.graph.*;
import javax.swing.tree.*;
import javax.swing.JTree;
import ingenias.editor.entities.*;
import ingenias.editor.widget.DnDJTreeObject;
public class ObjectManager extends javax.swing.tree.DefaultMutableTreeNode implements java.io.Serializable {
public DnDJTreeObject arbolObjetos=null;
javax.swing.tree.DefaultMutableTreeNode root=new javax.swing.tree.DefaultMutableTreeNode("SystemObjects");
public javax.swing.tree.DefaultMutableTreeNode NRNodeNode=null;
public static ObjectManager initialise(javax.swing.tree.DefaultMutableTreeNode root,DnDJTreeObject arbolObjetos){
ObjectManager om=new ObjectManager(root,arbolObjetos);
return om;
}
private ObjectManager(javax.swing.tree.DefaultMutableTreeNode root,DnDJTreeObject arbolObjetos) {
super("System Objects");
this.root=root;
this.arbolObjetos=arbolObjetos;
NRNodeNode=new javax.swing.tree.DefaultMutableTreeNode("NRNode");
/*
// 1st level nodes
addNodeInSortedOrder( root,NRNodeNode);
*/
// 2nd and lower nodes
}
// Function is a contribution from Ike http://www.groupsrv.com/computers/about116987.html
private void addNodeInSortedOrder(DefaultMutableTreeNode parent,
DefaultMutableTreeNode child){
int n = parent.getChildCount();
if(n==0){
parent.add(child);
return;
}
DefaultMutableTreeNode node=null;
for(int i=0;i0){
parent.insert(child, i);
return;
}
}
parent.add(child);
return;
}
public NRNode createNRNode(String id){
NRNode object=new NRNode(id);
DefaultMutableTreeNode nn=new DefaultMutableTreeNode(object);
NRNodeNode.insert(nn, NRNodeNode.getChildCount());
nn.setParent(NRNodeNode);
fixAscendants(NRNodeNode);
for (int k=0;k entities = getAllObjects();
for (Entity ent:entities){
renameModelID(ent,oldModelId,newModelId);
}
}
public void setRoot(javax.swing.tree.DefaultMutableTreeNode root) {
this.root = root;
}
public javax.swing.tree.DefaultMutableTreeNode getRoot() {
return root;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy