[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/treeview GenericTreeView.java, 1.87, 1.8
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nikolaj B. <nbr...@us...> - 2007-03-19 15:23:48
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12509/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java Log Message: Added DBK to the treeview Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** GenericTreeView.java 13 Mar 2007 10:02:34 -0000 1.87 --- GenericTreeView.java 19 Mar 2007 12:37:10 -0000 1.88 *************** *** 42,45 **** --- 42,46 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Classification; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.CoordinateSystem; *************** *** 486,490 **** } if (elements.size() > 0) { ! this.insertChildren(elements); } if (children.size() > 0) { --- 487,491 ---- } if (elements.size() > 0) { ! this.insertChildren(elements, true); } if (children.size() > 0) { *************** *** 499,506 **** * Insert a collection of Entity into this node * @param entities collection of Entity */ ! public void insertChildren(Collection<Entity> entities) { LinkedList sorted = new LinkedList(entities); ! Entity.sort(sorted); int[] ins = new int[sorted.size()]; int i = 0; --- 500,510 ---- * Insert a collection of Entity into this node * @param entities collection of Entity + * @param sort boolean that is true if the entities should be sorted */ ! public void insertChildren(Collection<Entity> entities, boolean sort) { LinkedList sorted = new LinkedList(entities); ! if (sort) { ! Entity.sort(sorted); ! } int[] ins = new int[sorted.size()]; int i = 0; *************** *** 862,865 **** --- 866,889 ---- /** + * ClassificationNode + */ + public class ClassificationNode extends EntityNode { + /** + * Constructor for VertexNode + * @param vertex The vertex + */ + public ClassificationNode(Classification clas) { + super(clas); + if (!clas.getChildren().isEmpty()) { + Iterator it = clas.getChildren().iterator(); + while (it.hasNext()) { + add(new ClassificationNode((Classification) it.next())); + } + } + } + + } + + /** * ModellorNode */ *************** *** 885,889 **** public SurfaceContainer(String name, Collection surfaces) { super(name, surfaces); ! insertChildren(surfaces); } --- 909,913 ---- public SurfaceContainer(String name, Collection surfaces) { super(name, surfaces); ! insertChildren(surfaces, true); } *************** *** 918,922 **** setUserObject(s.getLevelString()); } ! insertChildren(elements); } --- 942,946 ---- setUserObject(s.getLevelString()); } ! insertChildren(elements, true); } *************** *** 936,939 **** --- 960,994 ---- /** + * ClassificationContainer + */ + public class ClassificationContainer extends ContainerNode { + /** + * Constructor for ClassificationContainer + * @param name The name + * @param clas The classification + */ + public ClassificationContainer(String name, Classification clas) { + super(name, clas.getChildren()); + insertChildren(clas.getChildren(), false); + } + + /** {@inheritDoc} */ + public EntityNode nodeFor(Object entity) { + + return new ClassificationNode((Classification) entity); + + } + /** + * Return icon + * @return Icon + */ + public ImageIcon icon() { + return surfacegroupicon; + } + } + + + + /** * Geometry Container */ *************** *** 968,971 **** --- 1023,1056 ---- /** + * DBK Container + */ + public class DBKContainer extends ContainerNode { + /** + * Constructor + * @param name The name + * @param space The space + */ + public DBKContainer(String name, Project project) { + super(name, null); + add(new ClassificationContainer("Construction", project.getConstructionClas())); + add(new ClassificationContainer("Functional", project.getFunctionalClas())); + } + + /** + * Update the node with the given object + * @param o The object + */ + public void update(Object o) { + if (o instanceof Classification) { + Classification c = (Classification) o; + ((ClassificationContainer)this.getChildAt(0)).update(c.getChildren()); + ((ClassificationContainer)this.getChildAt(1)).update(c.getChildren()); + } else { + log.warn("Expected a Classification but found a " + o); + } + } + } + + /** * Constructor Container */ *************** *** 978,982 **** public ConstructorContainer(String name, Collection constructors) { super(name, constructors); ! insertChildren(constructors); } --- 1063,1067 ---- public ConstructorContainer(String name, Collection constructors) { super(name, constructors); ! insertChildren(constructors, true); } *************** *** 1006,1010 **** public EdgeContainer(String name, Collection edges) { super(name, edges); ! insertChildren(edges); } --- 1091,1095 ---- public EdgeContainer(String name, Collection edges) { super(name, edges); ! insertChildren(edges, true); } *************** *** 1033,1037 **** public ProjectNode(Project p) { super(p, p.getSpaces()); ! insertChildren(p.getSpaces()); } --- 1118,1122 ---- public ProjectNode(Project p) { super(p, p.getSpaces()); ! insertChildren(p.getSpaces(), true); } *************** *** 1100,1104 **** public VertexContainer(String name, Collection vertices) { super(name, vertices); ! insertChildren(vertices); } --- 1185,1189 ---- public VertexContainer(String name, Collection vertices) { super(name, vertices); ! insertChildren(vertices, true); } *************** *** 1128,1132 **** public ParameterBlockNode(String name, ParameterBlock object) { super(name, object.getAttributes()); ! insertChildren(object.getAttributes()); } --- 1213,1217 ---- public ParameterBlockNode(String name, ParameterBlock object) { super(name, object.getAttributes()); ! insertChildren(object.getAttributes(), true); } Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SpaceTreeView.java 16 Oct 2006 08:43:32 -0000 1.19 --- SpaceTreeView.java 19 Mar 2007 12:37:10 -0000 1.20 *************** *** 31,34 **** --- 31,35 ---- root.add(new ConstraintContainer("Constraints", Project.getInstance().getConstraints())); root.add(new ParameterBlockNode("Globals", Project.getInstance().getGlobals())); + root.add(new DBKContainer("DBK", Project.getInstance())); root.add(new ConstructorContainer("Constructors", Project.getInstance().getConstructors())); model.nodeStructureChanged(root); *************** *** 39,47 **** */ public void update() { ! if (root.getChildCount() == 5) { ((GenericNode)root.getChildAt(0)).update(Project.getInstance()); ((GenericNode)root.getChildAt(1)).update(Project.getInstance().world()); ((GenericNode)root.getChildAt(2)).update(Project.getInstance().getConstraints()); ((GenericNode)root.getChildAt(3)).update(Project.getInstance().getGlobals()); ((GenericNode)root.getChildAt(4)).update(Project.getInstance().getConstructors()); } --- 40,49 ---- */ public void update() { ! if (root.getChildCount() == 6) { ((GenericNode)root.getChildAt(0)).update(Project.getInstance()); ((GenericNode)root.getChildAt(1)).update(Project.getInstance().world()); ((GenericNode)root.getChildAt(2)).update(Project.getInstance().getConstraints()); ((GenericNode)root.getChildAt(3)).update(Project.getInstance().getGlobals()); + ((GenericNode)root.getChildAt(3)).update(Project.getInstance()); ((GenericNode)root.getChildAt(4)).update(Project.getInstance().getConstructors()); } |