[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/treeview GenericTreeView.java, 1.138, 1.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2008-01-10 09:54:04
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19635/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Fixed bug in pencil analysis Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** GenericTreeView.java 19 Dec 2007 11:40:48 -0000 1.138 --- GenericTreeView.java 10 Jan 2008 09:54:00 -0000 1.139 *************** *** 443,449 **** /** ! * ContainerNode */ ! public class ContainerNode extends GenericNode { protected Collection< ? extends Entity> content; private boolean sort; --- 443,449 ---- /** ! * */ ! public class CompositeNode extends GenericNode { protected Collection< ? extends Entity> content; private boolean sort; *************** *** 453,467 **** * @param label Object */ ! public ContainerNode(Object label) { super(label); } /** ! * Constructor for ContainerNode * @param content User collection to put in ! * @param label The label for the container node * @param sort Sort the children? */ ! public ContainerNode(Object label, Collection< ? extends Entity> content, boolean sort) { super(label); this.content = content; --- 453,467 ---- * @param label Object */ ! public CompositeNode(Object label) { super(label); } /** ! * Constructor for CompositeNode * @param content User collection to put in ! * @param label The label for the composite node * @param sort Sort the children? */ ! public CompositeNode(Object label, Collection< ? extends Entity> content, boolean sort) { super(label); this.content = content; *************** *** 496,500 **** /** ! * Remove the children from container node * @param children the children to remove */ --- 496,500 ---- /** ! * Remove the children from composite node * @param children the children to remove */ *************** *** 623,627 **** * SpaceNode */ ! public class SpaceNode extends EntityNode { /** * Constructor for SpaceNode --- 623,627 ---- * SpaceNode */ ! public abstract class SpaceNode extends EntityNode { /** * Constructor for SpaceNode *************** *** 630,669 **** public SpaceNode(Space space) { super(space); - if (space.isInstance()) { - makeInstanceContent((Instance) space); - } else if (space.isContainer()) { - makeContainerContent((Container) space); - } else { - Set surfaces = space.getEnvelope(); - add(new SurfaceContainer("Envelope", surfaces, false)); - } } /** ! * Make the tree content for the space that is a container ! * @param space the space */ ! private void makeContainerContent(Container space) { ! add(new EnvelopeContainer("Envelope", space)); ! String lvlstr = Container.levelToString(space.getLevel() + 1); ! add(new ElementContainer(lvlstr + "s", space.getElements())); ! if (Project.doDisplayGeometry()) { ! add(new GeometryNode("Geometry", space)); ! } ! ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); ! add(cn); ! if (space.getModellor() != null) { ! add(new ModellorNode(space.getModellor())); } } ! /** * Generate the tree content for a space that is a instance * @param space The space */ ! private void makeInstanceContent(Instance space) { Set surfaces = space.getEnvelope(); add(new SurfaceContainer("Envelope", surfaces, false)); ! SpaceNode proto = new SpaceNode(space.getProto()); add(proto); CoordinateSystem cs = space.getInstanceAnchor(); --- 630,677 ---- public SpaceNode(Space space) { super(space); } /** ! * Return the displaystring for this EntityNode ! * @return Display string */ ! public String toString() { ! String nid = ((Space)userObject).getDisplayName(); ! return nid; ! } ! ! /** ! * Return icon ! * @return icon ! */ ! public ImageIcon icon() { ! if (((Space)userObject).isConstructionSpace()) { ! return constructionspaceicon; ! } else { ! return functionalspaceicon; } } ! } ! ! /** ! * ! */ ! public class InstanceNode extends SpaceNode { ! /** ! * @param instance Instance ! */ ! public InstanceNode(Instance instance) { ! super(instance); ! makeInstanceContent(instance); ! } ! /** * Generate the tree content for a space that is a instance * @param space The space */ ! protected void makeInstanceContent(Instance space) { Set surfaces = space.getEnvelope(); add(new SurfaceContainer("Envelope", surfaces, false)); ! SpaceNode proto = new ContainerNode(space.getProto()); add(proto); CoordinateSystem cs = space.getInstanceAnchor(); *************** *** 672,676 **** } } ! /** * Update the node with the given object --- 680,738 ---- } } ! ! /** ! * Update the node with the given object ! * @param o The object ! */ ! public void update(Object o) { ! if (o instanceof Instance) { ! Instance instance = (Instance) o; ! if (this.getChildCount() == 3) { ! ((GenericNode)getChildAt(0)).update(instance.getEnvelope()); ! ((GenericNode)getChildAt(1)).update(instance.getProto()); ! ((GenericNode)getChildAt(2)).update(instance.getInstanceAnchor()); ! } else { ! removeAllChildren(); ! makeInstanceContent(instance); ! model.nodeStructureChanged(this); ! } ! userObject = instance; ! model.nodeChanged(this); ! } ! } ! ! ! } ! ! /** ! * ! */ ! public class ContainerNode extends SpaceNode { ! /** ! * @param container Container ! */ ! public ContainerNode(Container container) { ! super(container); ! makeContainerContent(container); ! } ! ! /** ! * Make the tree content for the space that is a container ! * @param space the space ! */ ! protected void makeContainerContent(Container space) { ! add(new EnvelopeContainer("Envelope", space)); ! String lvlstr = Container.levelToString(space.getLevel() + 1); ! add(new ElementContainer(lvlstr + "s", space.getElements())); ! CompositeNode cn = new ConstructorContainer("Constructors", space.getConstructors()); ! add(cn); ! if (Project.doDisplayGeometry()) { ! add(new GeometryNode("Geometry", space)); ! } ! if (space.getModellor() != null) { ! add(new ModellorNode(space.getModellor())); ! } ! } ! /** * Update the node with the given object *************** *** 679,756 **** public void update(Object o) { if (o instanceof Container) { ! Space s = (Container)o; ! if (s.isInstance()) { ! Instance instance = (Instance) s; ! if (this.getChildCount() == 3) { ! ((GenericNode)getChildAt(0)).update(instance.getEnvelope()); ! ((GenericNode)getChildAt(1)).update(instance.getProto()); ! ((GenericNode)getChildAt(2)).update(instance.getInstanceAnchor()); ! } else { ! removeAllChildren(); ! makeInstanceContent(instance); ! model.nodeStructureChanged(this); ! } ! } else if (s.isContainer()) { ! Container space = (Container)userObject; ! if (space.isContainer()) { ! int inx = 0; ! ((GenericNode)getChildAt(inx++)).update(space.getEnvelope()); ! ((GenericNode)getChildAt(inx++)).update(space.getElements()); ! if (Project.doDisplayGeometry()) { ! ((GenericNode)getChildAt(inx++)).update(space); ! } ! ((GenericNode)getChildAt(inx++)).update(space.getConstructors()); ! int placement = inx; ! if (s.getModellor() != null) { ! if (getChildCount() >= placement + 1) { ! ((GenericNode)getChildAt(placement)).update(space.getModellor()); ! } else { ! add(new ModellorNode(s.getModellor())); ! model.nodesWereInserted(this, new int[]{placement}); ! } ! } else { ! if (getChildCount() == placement + 1) { ! TreeNode node = getChildAt(placement); ! remove(placement); ! model.nodesWereRemoved(this, new int[]{placement}, new Object[]{node}); ! } ! } } else { ! removeAllChildren(); ! makeContainerContent((Container) s); ! model.nodeStructureChanged(this); } } else { ! if (this.getChildCount() == 1) { ! ((GenericNode)getChildAt(0)).update(s.getEnvelope()); ! } else { ! removeAllChildren(); ! add(new SurfaceContainer("Envelope", s.getEnvelope(), false)); ! model.nodeStructureChanged(this); } } ! userObject = s; model.nodeChanged(this); } } ! /** ! * Return the displaystring for this EntityNode ! * @return Display string */ ! public String toString() { ! String nid = ((Space)userObject).getDisplayName(); ! return nid; } /** ! * Return icon ! * @return icon */ ! public ImageIcon icon() { ! if (((Space)userObject).isConstructionSpace()) { ! return constructionspaceicon; ! } else { ! return functionalspaceicon; } } --- 741,802 ---- public void update(Object o) { if (o instanceof Container) { ! Container space = (Container)o; ! int inx = 0; ! ((GenericNode)getChildAt(inx++)).update(space.getEnvelope()); ! ((GenericNode)getChildAt(inx++)).update(space.getElements()); ! ((GenericNode)getChildAt(inx++)).update(space.getConstructors()); ! if (Project.doDisplayGeometry()) { ! ((GenericNode)getChildAt(inx++)).update(space); ! } ! ! int placement = inx; ! if (space.getModellor() != null) { ! if (getChildCount() >= placement + 1) { ! ((GenericNode)getChildAt(placement)).update(space.getModellor()); } else { ! add(new ModellorNode(space.getModellor())); ! model.nodesWereInserted(this, new int[]{placement}); } } else { ! if (getChildCount() == placement + 1) { ! TreeNode node = getChildAt(placement); ! remove(placement); ! model.nodesWereRemoved(this, new int[]{placement}, new Object[]{node}); } } ! userObject = space; model.nodeChanged(this); } } ! } ! ! /** ! * ! */ ! public class VoidNode extends SpaceNode { /** ! * @param space Space */ ! public VoidNode(Space space) { ! super(space); ! add(new SurfaceContainer("Envelope", space.getEnvelope(), false)); } /** ! * Update the node with the given object ! * @param o The object */ ! public void update(Object o) { ! if (o instanceof Space) { ! Space s = (Space)o; ! if (this.getChildCount() == 1) { ! ((GenericNode)getChildAt(0)).update(s.getEnvelope()); ! } else { ! removeAllChildren(); ! add(new SurfaceContainer("Envelope", s.getEnvelope(), false)); ! model.nodeStructureChanged(this); ! } ! userObject = s; ! model.nodeChanged(this); } } *************** *** 839,843 **** if (constructor instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) constructor; ! add(new ContainerNode("Relations", system.relations(), true)); update(system); } --- 885,889 ---- if (constructor instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) constructor; ! add(new CompositeNode("Relations", system.relations(), true)); update(system); } *************** *** 936,940 **** * SurfaceContainer */ ! public class SurfaceContainer extends ContainerNode { /** * Constructor for SurfaceContainer --- 982,986 ---- * SurfaceContainer */ ! public class SurfaceContainer extends CompositeNode { /** * Constructor for SurfaceContainer *************** *** 964,968 **** * SurfaceContainer */ ! public class EnvelopeContainer extends ContainerNode { private Container space; /** --- 1010,1014 ---- * SurfaceContainer */ ! public class EnvelopeContainer extends CompositeNode { private Container space; /** *************** *** 995,999 **** * ElementContainer */ ! public class ElementContainer extends ContainerNode { /** * Constructor --- 1041,1045 ---- * ElementContainer */ ! public class ElementContainer extends CompositeNode { /** * Constructor *************** *** 1007,1011 **** /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { ! return new SpaceNode((Space) entity); } --- 1053,1066 ---- /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { ! Space space = (Space) entity; ! if (space.isVoid()) { ! return new VoidNode(space); ! } else if (space instanceof Container) { ! return new ContainerNode((Container) space); ! } else if (space instanceof Instance) { ! return new InstanceNode((Instance) space); ! } else { ! return new EntityNode(space); ! } } *************** *** 1056,1060 **** * Menu container for materials */ ! public class MaterialContainer extends ContainerNode { /** * Create a container for materials --- 1111,1115 ---- * Menu container for materials */ ! public class MaterialContainer extends CompositeNode { /** * Create a container for materials *************** *** 1105,1109 **** * Constructor Container */ ! public class ConstructorContainer extends ContainerNode { /** * Constructor --- 1160,1164 ---- * Constructor Container */ ! public class ConstructorContainer extends CompositeNode { /** * Constructor *************** *** 1132,1136 **** * EdgeContainer */ ! public class EdgeContainer extends ContainerNode { /** * Constructor for EdgeContainer --- 1187,1191 ---- * EdgeContainer */ ! public class EdgeContainer extends CompositeNode { /** * Constructor for EdgeContainer *************** *** 1160,1164 **** * CameraNode */ ! public class ProjectNode extends ContainerNode { /** * Constructor for EdgeContainer --- 1215,1219 ---- * CameraNode */ ! public class ProjectNode extends CompositeNode { /** * Constructor for EdgeContainer *************** *** 1188,1192 **** /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { ! return new SpaceNode((Space) entity); } } --- 1243,1256 ---- /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { ! Space space = (Space) entity; ! if (space.isVoid()) { ! return new VoidNode(space); ! } else if (space instanceof Container) { ! return new ContainerNode((Container) space); ! } else if (space instanceof Instance) { ! return new InstanceNode((Instance) space); ! } else { ! return new EntityNode(space); ! } } } *************** *** 1195,1199 **** * Component Container */ ! public class ComponentContainer extends ContainerNode { /** * Constructor for Catalog objects --- 1259,1263 ---- * Component Container */ ! public class ComponentContainer extends CompositeNode { /** * Constructor for Catalog objects *************** *** 1251,1255 **** * CameraNode */ ! public class CameraNode extends ContainerNode { /** * Constructor for EdgeContainer --- 1315,1319 ---- * CameraNode */ ! public class CameraNode extends CompositeNode { /** * Constructor for EdgeContainer *************** *** 1276,1280 **** * VertexContainer */ ! public class VertexContainer extends ContainerNode { /** * Constructor for EdgeContainer --- 1340,1344 ---- * VertexContainer */ ! public class VertexContainer extends CompositeNode { /** * Constructor for EdgeContainer *************** *** 1304,1308 **** * ParameterBlockNode */ ! public class ParameterBlockNode extends ContainerNode { /** * Constructor --- 1368,1372 ---- * ParameterBlockNode */ ! public class ParameterBlockNode extends CompositeNode { /** * Constructor *************** *** 1364,1368 **** * ConstraintContainer */ ! public class ConstraintContainer extends ContainerNode { /** * Constructor for ConstraintContainer --- 1428,1432 ---- * ConstraintContainer */ ! public class ConstraintContainer extends CompositeNode { /** * Constructor for ConstraintContainer *************** *** 1378,1382 **** * RelationContainer */ ! public class RelationContainer extends ContainerNode { /** * Constructs a RelationContainer --- 1442,1446 ---- * RelationContainer */ ! public class RelationContainer extends CompositeNode { /** * Constructs a RelationContainer |