[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/treeview LibraryTreeView.java, 1.1, 1.2
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-11-12 14:15:31
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16958/src/net/sourceforge/bprocessor/gui/treeview Modified Files: LibraryTreeView.java GenericTreeView.java SpaceTreeView.java Log Message: Removed lock from space, and created a LibraryObj to encapsulate the union spaces for the library. Made changes acording to that in the treeview. Index: LibraryTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/LibraryTreeView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LibraryTreeView.java 6 Nov 2007 18:27:53 -0000 1.1 --- LibraryTreeView.java 12 Nov 2007 14:15:28 -0000 1.2 *************** *** 20,24 **** super(); root.removeAllChildren(); ! root.add(new CatalogContainer(Project.getInstance())); model.nodeStructureChanged(root); } --- 20,24 ---- super(); root.removeAllChildren(); ! root.add(new CatalogContainer("Unions", Project.getInstance().getCatalogObjects())); model.nodeStructureChanged(root); } *************** *** 27,31 **** @Override public void update() { ! ((GenericNode)root.getChildAt(0)).update(Project.getInstance()); } } --- 27,31 ---- @Override public void update() { ! ((GenericNode)root.getChildAt(0)).update(Project.getInstance().getCatalogObjects()); } } Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** GenericTreeView.java 6 Nov 2007 18:27:53 -0000 1.119 --- GenericTreeView.java 12 Nov 2007 14:15:28 -0000 1.120 *************** *** 44,48 **** import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; - import net.sourceforge.bprocessor.model.Command; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.CoordinateSystem; --- 44,47 ---- *************** *** 50,53 **** --- 49,53 ---- import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.LibraryObj; import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Observer; *************** *** 1161,1172 **** * CameraNode */ ! public class CatalogContainer extends ContainerNode { /** ! * Constructor for EdgeContainer ! * @param p The project */ ! public CatalogContainer(Project p) { ! super("Catalog", p.getCatalogObjects(), true); ! insertChildren(p.getCatalogObjects()); } --- 1161,1175 ---- * CameraNode */ ! public class CatalogContainer extends GenericNode { /** ! * Constructor for Catalog objects ! * @param name the name for the tree node ! * @param content the children for the node */ ! public CatalogContainer(String name, List<LibraryObj> content) { ! super(name); ! for (LibraryObj l : content) { ! this.add(new CatalogNode(l)); ! } } *************** *** 1176,1195 **** */ public void update(Object o) { ! if (o instanceof Project) { ! Project proj = (Project)o; ! if (proj == updated) { ! model.nodeChanged(this); } ! super.update(proj.getCatalogObjects()); ! } else { ! log.warn("Were a " + o + " not a Project"); } } - - /** {@inheritDoc} */ - public EntityNode nodeFor(Object entity) { - Space s = (Space) entity; - return new CatalogNode(s); - } } --- 1179,1190 ---- */ public void update(Object o) { ! if (o instanceof Collection) { ! this.removeAllChildren(); ! for (LibraryObj l : (Collection<LibraryObj>)o) { ! this.add(new CatalogNode(l)); } ! model.nodeStructureChanged(this); } } } *************** *** 1198,1211 **** * @author rimestad */ ! public class CatalogNode extends EntityNode { /** * Constructor ! * @param s The space that represent the catalog object */ ! public CatalogNode(Space s) { ! super(s); ! this.add(new SurfaceContainer("Surfaces", s.getSurfaces())); ! this.add(new EdgeContainer("Edges", s.getEdges(), true)); ! this.add(new VertexContainer("Vertices", s.getVertices(), true)); } --- 1193,1204 ---- * @author rimestad */ ! public class CatalogNode extends GenericNode { /** * Constructor ! * @param l The lib obj */ ! public CatalogNode(LibraryObj l) { ! super(l); ! Space s = l.getSpace(); } *************** *** 1213,1217 **** @Override public String toString() { ! return ((Space)getUserObject()).getName(); } --- 1206,1210 ---- @Override public String toString() { ! return ((LibraryObj)getUserObject()).getName(); } *************** *** 1219,1227 **** @Override public void update(Object o) { ! if (o instanceof Space) { ! Space s = (Space)o; ! ((GenericNode)this.getChildAt(0)).update(s.getSurfaces()); ! ((GenericNode)this.getChildAt(1)).update(s.getEdges()); ! ((GenericNode)this.getChildAt(2)).update(s.getVertices()); } } --- 1212,1221 ---- @Override public void update(Object o) { ! if (o instanceof LibraryObj) { ! LibraryObj lo = (LibraryObj)o; ! if (lo != userObject) { ! userObject = lo; ! model.nodeChanged(this); ! } } } *************** *** 1232,1246 **** JPopupMenu menu = new JPopupMenu(); Collection<Space> spaces = new LinkedList<Space>(); ! spaces.add((Space)getUserObject()); ! menu.add(new GeometricMenuAction(spaces, "Duplicate") { ! public void actionPerformed(ActionEvent e) { ! Command command = new Command.Duplicate((Space) entities.iterator().next()); ! AttributeView.instance().display(command); ! }; ! }); menu.add(new GeometricMenuAction(spaces, "Instanciate") { public void actionPerformed(ActionEvent e) { ! Command command = new Command.Instance((Space) entities.iterator().next()); ! AttributeView.instance().display(command); }; }); --- 1226,1243 ---- JPopupMenu menu = new JPopupMenu(); Collection<Space> spaces = new LinkedList<Space>(); ! spaces.add(((LibraryObj)getUserObject()).getSpace()); menu.add(new GeometricMenuAction(spaces, "Instanciate") { public void actionPerformed(ActionEvent e) { ! Project proj = Project.getInstance(); ! Space world = proj.getActiveSpace(); ! for (Geometric g : entities) { ! Space space = (Space)g; ! Space instance = new Space(space.getName() + " instance ", space.getType(), false); ! instance.setProto(space); ! space.setOwner(instance); ! world.add(instance); ! } ! proj.changed(world); ! proj.checkpoint(); }; }); Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** SpaceTreeView.java 6 Nov 2007 08:06:12 -0000 1.26 --- SpaceTreeView.java 12 Nov 2007 14:15:28 -0000 1.27 *************** *** 38,42 **** root.add(new ParameterBlockNode("Globals", p.getGlobals())); root.add(new ConstructorContainer("Constructors", p.getConstructors())); ! root.add(new CatalogContainer(p)); model.nodeStructureChanged(root); --- 38,42 ---- root.add(new ParameterBlockNode("Globals", p.getGlobals())); root.add(new ConstructorContainer("Constructors", p.getConstructors())); ! root.add(new CatalogContainer("Catalog", p.getCatalogObjects())); model.nodeStructureChanged(root); *************** *** 56,60 **** ((GenericNode)root.getChildAt(4)).update(p.getGlobals()); ((GenericNode)root.getChildAt(5)).update(p.getConstructors()); ! ((GenericNode)root.getChildAt(6)).update(p); } catch (ArrayIndexOutOfBoundsException e) { log.error("There were a inconsistent number of nodes attached to " + --- 56,60 ---- ((GenericNode)root.getChildAt(4)).update(p.getGlobals()); ((GenericNode)root.getChildAt(5)).update(p.getConstructors()); ! ((GenericNode)root.getChildAt(6)).update(p.getCatalogObjects()); } catch (ArrayIndexOutOfBoundsException e) { log.error("There were a inconsistent number of nodes attached to " + |