bprocessor-commit Mailing List for B-processor (Page 29)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: rimestad <rim...@us...> - 2007-12-20 09:37:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12790/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: changeTool on Editor now return the resulting tool from the change... FinalMovetool start a move of a instance by grabbing the handle by which it is moved and make Instance popup choice start moving the created instance. Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** FinalMoveTool.java 18 Dec 2007 23:41:36 -0000 1.47 --- FinalMoveTool.java 20 Dec 2007 09:37:44 -0000 1.48 *************** *** 14,17 **** --- 14,18 ---- import java.util.HashSet; import java.util.LinkedList; + import java.util.List; import java.util.Map; import java.util.Set; *************** *** 209,221 **** this.initialCoordinate = instance.getInstanceAnchor().copy(); this.handle = handle.copy(); - Transformation transformation = editor.getView().transformation(); - double x = pressPos[0]; - double y = View.getHeight() - pressPos[1]; - Vertex near = new Vertex(x, y, 0.0); - Vertex far = new Vertex(x, y, 1.0); - Edge ray = new Edge(near, far); - ray = transformation.unProject(ray); CoordinateSystem tmp = this.initialCoordinate.unTranslate(this.handle); ! Vertex center = tmp.plane().intersection(ray); start = new Intersection(center, start.type(), start.object()); --- 210,215 ---- this.initialCoordinate = instance.getInstanceAnchor().copy(); this.handle = handle.copy(); CoordinateSystem tmp = this.initialCoordinate.unTranslate(this.handle); ! Vertex center = tmp.center(); start = new Intersection(center, start.type(), start.object()); *************** *** 495,559 **** @Override protected void pressed(MouseEvent e) { - if (geometrics == null) { ! geometrics = new LinkedList(); if (Selection.primary().isEmpty()) { if (target != null) { ! geometrics.add((Geometric) target); ! } ! } else { ! geometrics.addAll(Selection.primary()); ! } ! ! owner = Project.getInstance().getActiveSpace(); ! for (Geometric current : geometrics) { ! if (current.getOwner() != owner) { ! GUI.getInstance().alert("All objects must belong to active space"); ! cleanUp(); ! return; ! } ! } ! ! if (!geometrics.isEmpty()) { ! copy = e.isAltDown(); ! if (copy) { ! mesh = new Mesh(geometrics); ! mesh = mesh.copyAndAssign(new HashMap()); ! geometrics = mesh.geometrics(); ! Project.getInstance().getActiveSpace().addProtected(geometrics); ! } else { ! mesh = null; ! } ! ! ! vertices = Geometry.collect(geometrics); ! mover = new VectorMove(vertices); ! ! affected = getAffected(geometrics); ! current = findIntersection(e); ! start = current.copy(); ! ! if (geometrics.size() == 1) { ! Geometric work = geometrics.iterator().next(); ! if (work instanceof Instance) { ! Instance space = (Instance)work; ! if (space.isInstance()) { ! CoordinateSystem anchor = null; ! for (CoordinateSystem currentSystem : space.getProto().getCoordinateSystems()) { ! anchor = currentSystem; ! break; ! } ! if (anchor == null) { ! anchor = Project.getInstance().getActiveCoordinateSystem().copy(); ! } ! mover = new InstanceMove(space, anchor); ! } ! } } - updateFeedback(); - setTip(secondClickTip()); } else { ! geometrics = null; } } else { finish(); --- 489,505 ---- @Override protected void pressed(MouseEvent e) { if (geometrics == null) { ! copy = e.isAltDown(); ! Intersection intersection = findIntersection(e); ! ! List<Geometric> actual = new LinkedList(); if (Selection.primary().isEmpty()) { if (target != null) { ! actual.add((Geometric) target); } } else { ! actual.addAll(Selection.primary()); } + activate(actual, intersection); } else { finish(); *************** *** 655,657 **** --- 601,661 ---- " Escape cancels."; } + + /*** + * Activate the tool on this collection of geometric + * @param geoms the list of geometric + * @param intersection The intersection at start + */ + public void activate(Collection<? extends Geometric> geoms, Intersection intersection) { + current = intersection; + start = current; + geometrics = (Collection<Geometric>)geoms; + owner = Project.getInstance().getActiveSpace(); + for (Geometric current : geometrics) { + if (current.getOwner() != owner) { + GUI.getInstance().alert("All objects must belong to active space"); + cleanUp(); + return; + } + } + + if (!geometrics.isEmpty()) { + if (copy) { + mesh = new Mesh(geometrics); + mesh = mesh.copyAndAssign(new HashMap()); + geometrics = mesh.geometrics(); + Project.getInstance().getActiveSpace().addProtected(geometrics); + } else { + mesh = null; + } + + + vertices = Geometry.collect(geometrics); + mover = new VectorMove(vertices); + + affected = getAffected(geometrics); + + if (geometrics.size() == 1) { + Geometric work = geometrics.iterator().next(); + if (work instanceof Instance) { + Instance space = (Instance)work; + if (space.isInstance()) { + CoordinateSystem anchor = null; + for (CoordinateSystem currentSystem : space.getProto().getCoordinateSystems()) { + anchor = currentSystem; + break; + } + if (anchor == null) { + anchor = Project.getInstance().getActiveCoordinateSystem().copy(); + } + mover = new InstanceMove(space, anchor); + } + } + } + updateFeedback(); + setTip(secondClickTip()); + } else { + geometrics = null; + } + } } |
From: rimestad <rim...@us...> - 2007-12-20 09:37:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12790/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: changeTool on Editor now return the resulting tool from the change... FinalMovetool start a move of a instance by grabbing the handle by which it is moved and make Instance popup choice start moving the created instance. Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PopupMenu.java 19 Dec 2007 11:40:54 -0000 1.2 --- PopupMenu.java 20 Dec 2007 09:37:43 -0000 1.3 *************** *** 21,24 **** --- 21,26 ---- import net.sourceforge.bprocessor.gl.Editor; + import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.gl.tool.FinalMoveTool; import net.sourceforge.bprocessor.gl.tool.Tool; import net.sourceforge.bprocessor.gui.GUI; *************** *** 784,788 **** instance.setProto(space); world.add(instance); ! editor.changeTool(Tool.FINAL_MOVE_TOOL); } proj.changed(world); --- 786,803 ---- instance.setProto(space); world.add(instance); ! Selection.primary().set(instance); ! FinalMoveTool tool = (FinalMoveTool)editor.changeTool(Tool.FINAL_MOVE_TOOL); ! CoordinateSystem cs = null; ! if (!instance.getProto().getCoordinateSystems().isEmpty()) { ! cs = instance.getProto().getCoordinateSystems().iterator().next(); ! } ! if (cs == null) { ! cs = instance.getInstanceAnchor(); ! } ! Vertex center = instance.getInstanceAnchor().unTranslate(cs.center()); ! Intersection i = new Intersection(center, Intersection.VERTEX, instance); ! Collection<Instance> insts = new LinkedList<Instance>(); ! insts.add(instance); ! tool.activate(insts, i); } proj.changed(world); |
From: rimestad <rim...@us...> - 2007-12-20 09:37:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12790/src/net/sourceforge/bprocessor/gl Modified Files: Editor.java Log Message: changeTool on Editor now return the resulting tool from the change... FinalMovetool start a move of a instance by grabbing the handle by which it is moved and make Instance popup choice start moving the created instance. Index: Editor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/Editor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Editor.java 19 Dec 2007 11:40:54 -0000 1.11 --- Editor.java 20 Dec 2007 09:37:44 -0000 1.12 *************** *** 370,377 **** /** ! * Change the tool * @param mode The new tool */ ! public void changeTool(int mode) { tool.cleanUp(); this.repaint(true); --- 370,378 ---- /** ! * Change the tool used by gl * @param mode The new tool + * @return The chosen tool */ ! public Tool changeTool(int mode) { tool.cleanUp(); this.repaint(true); *************** *** 398,401 **** --- 399,403 ---- } getView().reset(); + return tool; } |
From: rimestad <rim...@us...> - 2007-12-19 11:40:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4373/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: changed menuFactory interface to entity instead of geometric... and made popupMenu reflect that Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PopupMenu.java 18 Dec 2007 23:15:01 -0000 1.1 --- PopupMenu.java 19 Dec 2007 11:40:54 -0000 1.2 *************** *** 20,23 **** --- 20,25 ---- import javax.swing.JPopupMenu; + import net.sourceforge.bprocessor.gl.Editor; + import net.sourceforge.bprocessor.gl.tool.Tool; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.gui.MenuFactory; *************** *** 40,43 **** --- 42,46 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Instance; import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Project; *************** *** 58,67 **** private static final boolean CHECKS = false; /** ! * ! * */ ! public PopupMenu() { } --- 61,73 ---- private static final boolean CHECKS = false; + + private Editor editor; /** ! * The popupMenu constructor ! * @param editor the editor constructing the menu creator */ ! public PopupMenu(Editor editor) { ! this.editor = editor; } *************** *** 71,75 **** * @return the popupmenu */ ! private static JPopupMenu getSurfaceMenu(Collection surfaces) { JPopupMenu menu = getGeometricMenu(surfaces); if (surfaces.size() == 1) { --- 77,81 ---- * @return the popupmenu */ ! private JPopupMenu getSurfaceMenu(Collection surfaces) { JPopupMenu menu = getGeometricMenu(surfaces); if (surfaces.size() == 1) { *************** *** 155,159 **** * @return Menu for edges */ ! private static JPopupMenu getEdgeMenu(Collection edges) { JPopupMenu menu = getGeometricMenu(edges); { --- 161,165 ---- * @return Menu for edges */ ! private JPopupMenu getEdgeMenu(Collection edges) { JPopupMenu menu = getGeometricMenu(edges); { *************** *** 193,202 **** * @return Menu for coordinate systems */ ! private static JPopupMenu getCoordinateSystemMenu(Collection systems) { JPopupMenu menu = getGeometricMenu(systems); return menu; } ! private abstract static class ModellorAction extends AbstractAction { protected Modellor modellor; protected Container space; --- 199,208 ---- * @return Menu for coordinate systems */ ! private JPopupMenu getCoordinateSystemMenu(Collection systems) { JPopupMenu menu = getGeometricMenu(systems); return menu; } ! private abstract class ModellorAction extends AbstractAction { protected Modellor modellor; protected Container space; *************** *** 214,219 **** * @return the popup menu */ ! private static JPopupMenu getSpaceMenu(Collection s) { ! JPopupMenu menu = PopupMenu.getGeometricMenu(s); menu.addSeparator(); --- 220,225 ---- * @return the popup menu */ ! private JPopupMenu getSpaceMenu(Collection s) { ! JPopupMenu menu = getGeometricMenu(s); menu.addSeparator(); *************** *** 376,390 **** return menu; } - - /** - * a popup generator for a single entity - * @param e The entity - * @return the popup menu - */ - private static JPopupMenu getEntityMenu(Entity e) { - Collection c = new LinkedList(); - c.add(e); - return getGeometricMenu(c); - } /** --- 382,385 ---- *************** *** 393,397 **** * @return The popupmenu */ ! private static JPopupMenu getAttributeMenu(Attribute attribute) { JPopupMenu pm = new JPopupMenu(); AbstractAction delete = new AttributeMenuAction(attribute, "Delete") { --- 388,392 ---- * @return The popupmenu */ ! private JPopupMenu getAttributeMenu(Attribute attribute) { JPopupMenu pm = new JPopupMenu(); AbstractAction delete = new AttributeMenuAction(attribute, "Delete") { *************** *** 407,411 **** } ! private static CoordinateSystem systemFor(Geometric geometric) { if (geometric instanceof Vertex) { return systemFor((Vertex) geometric); --- 402,406 ---- } ! private CoordinateSystem systemFor(Geometric geometric) { if (geometric instanceof Vertex) { return systemFor((Vertex) geometric); *************** *** 420,424 **** } ! private static CoordinateSystem systemFor(Vertex vertex) { Collection<Edge> edges = vertex.getEdges(); if (edges.size() == 0) { --- 415,419 ---- } ! private CoordinateSystem systemFor(Vertex vertex) { Collection<Edge> edges = vertex.getEdges(); if (edges.size() == 0) { *************** *** 451,455 **** } ! private static CoordinateSystem systemFor(Surface surface) { Vertex normal = surface.normal(); Vertex origin = surface.center(); --- 446,450 ---- } ! private CoordinateSystem systemFor(Surface surface) { Vertex normal = surface.normal(); Vertex origin = surface.center(); *************** *** 462,466 **** * @return the popupmenu */ ! private static JPopupMenu getGeometricMenu(Collection<Geometric> arguments) { JPopupMenu menu = new JPopupMenu(); AbstractAction delete = new GeometricMenuAction(arguments, "Delete") { --- 457,461 ---- * @return the popupmenu */ ! private JPopupMenu getGeometricMenu(Collection<Geometric> arguments) { JPopupMenu menu = new JPopupMenu(); AbstractAction delete = new GeometricMenuAction(arguments, "Delete") { *************** *** 668,672 **** * @return Background menu */ ! private static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); { --- 663,667 ---- * @return Background menu */ ! private JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); { *************** *** 715,750 **** return menu; } - - /** - * Create a popupMenu for the selection - * @return The popupmenu or null if the selection is empty - */ - private static JPopupMenu makeSelectionMenu() { - if (Selection.primary().isEmpty()) { - return null; - } else { - Iterator sel = Selection.primary().iterator(); - Object type = null; - while (sel.hasNext()) { - Object next = sel.next(); - if (type == null) { - type = next; - } else if (!next.getClass().isInstance(type)) { - return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); - } - } - if (type instanceof Container) { - return PopupMenu.getSpaceMenu(new LinkedList<Geometric>(Selection.primary())); - } else if (type instanceof Surface) { - return PopupMenu.getSurfaceMenu(new LinkedList<Geometric>(Selection.primary())); - } else if (type instanceof Edge) { - return getEdgeMenu(new LinkedList<Geometric>(Selection.primary())); - } else if (type instanceof CoordinateSystem) { - return getCoordinateSystemMenu(new LinkedList<Geometric>(Selection.primary())); - } else { - return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); - } - } - } /** --- 710,713 ---- *************** *** 803,819 **** } ! /** {@inheritDoc} */ ! public JPopupMenu menuFor(Geometric geometric) { ! return null; } ! /** {@inheritDoc} */ ! public JPopupMenu menuFor(Collection<Geometric> geometrics) { ! if (geometrics == Selection.primary()) { ! return makeSelectionMenu(); ! } else if (geometrics.isEmpty()) { ! return PopupMenu.getBackgroundMenu(); } else { ! return PopupMenu.getGeometricMenu(geometrics); } } --- 766,825 ---- } ! /** ! * Generate menu for components ! * @param components The components ! * @return The menu ! */ ! private JPopupMenu getComponentMenu(Collection<Component> components) { ! JPopupMenu menu = new JPopupMenu(); ! menu.add(new CollectionMenuAction(components, "Make Instance") { ! public void actionPerformed(ActionEvent e) { ! Project proj = Project.getInstance(); ! Container world = proj.getActiveSpace(); ! for (Object o : col) { ! Component lo = (Component)o; ! Container space = lo.getSpace(); ! Instance instance = new Instance(space.getName() + " instance "); ! proj.addCalalogObject(lo); ! instance.setProto(space); ! world.add(instance); ! editor.changeTool(Tool.FINAL_MOVE_TOOL); ! } ! proj.changed(world); ! proj.checkpoint(); ! }; ! }); ! return menu; } ! /** {@inheritDoc} */ ! public JPopupMenu menuFor(Collection<? extends Entity> geometrics) { ! if (geometrics.isEmpty()) { ! return getBackgroundMenu(); } else { ! Object type = null; ! for (Entity current : geometrics) { ! if (type == null) { ! type = current; ! } else if (!current.getClass().isInstance(type)) { ! return getGeometricMenu(new LinkedList<Geometric>((Collection<Geometric>)geometrics)); ! } ! } ! if (type instanceof Container) { ! return getSpaceMenu(new LinkedList<Container>((Collection<Container>)geometrics)); ! } else if (type instanceof Surface) { ! return getSurfaceMenu(new LinkedList<Surface>((Collection<Surface>)geometrics)); ! } else if (type instanceof Edge) { ! return getEdgeMenu(new LinkedList<Edge>((Collection<Edge>)geometrics)); ! } else if (type instanceof CoordinateSystem) { ! return getCoordinateSystemMenu( ! new LinkedList<CoordinateSystem>((Collection<CoordinateSystem>)geometrics)); ! } else if (type instanceof Attribute) { ! return getAttributeMenu((Attribute)type); ! } else if (type instanceof Component) { ! return getComponentMenu(new LinkedList<Component>((Collection<Component>)geometrics)); ! } else { ! return getGeometricMenu(new LinkedList<Geometric>((Collection<Geometric>)geometrics)); ! } } } *************** *** 821,827 **** /** {@inheritDoc} */ public JPopupMenu menuFor(Entity entity) { ! return getEntityMenu(entity); } /** {@inheritDoc} */ public JPopupMenu menuFor(Attribute attribute) { --- 827,837 ---- /** {@inheritDoc} */ public JPopupMenu menuFor(Entity entity) { ! Collection<Entity> c = new LinkedList<Entity>(); ! c.add(entity); ! return menuFor(c); } + + /** {@inheritDoc} */ public JPopupMenu menuFor(Attribute attribute) { |
From: rimestad <rim...@us...> - 2007-12-19 11:40:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4373/src/net/sourceforge/bprocessor/gl Modified Files: Editor.java Log Message: changed menuFactory interface to entity instead of geometric... and made popupMenu reflect that Index: Editor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/Editor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Editor.java 18 Dec 2007 23:15:01 -0000 1.10 --- Editor.java 19 Dec 2007 11:40:54 -0000 1.11 *************** *** 211,215 **** Project.getInstance().addStaticObserver(this); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); ! GUI.getInstance().register(new PopupMenu()); { --- 211,215 ---- Project.getInstance().addStaticObserver(this); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); ! GUI.getInstance().register(new PopupMenu(this)); { |
From: rimestad <rim...@us...> - 2007-12-19 11:40:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4357/src/net/sourceforge/bprocessor/gui Modified Files: MenuFactory.java Log Message: changed menuFactory interface to entity instead of geometric... and made popupMenu reflect that Index: MenuFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/MenuFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MenuFactory.java 18 Dec 2007 23:15:10 -0000 1.2 --- MenuFactory.java 19 Dec 2007 11:40:48 -0000 1.3 *************** *** 12,18 **** import javax.swing.JPopupMenu; - import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Entity; - import net.sourceforge.bprocessor.model.Geometric; /** --- 12,16 ---- *************** *** 21,35 **** public interface MenuFactory { /** - * @param geometric Geometric - * @return menu - */ - JPopupMenu menuFor(Geometric geometric); - - /** * ! * @param geometrics Geometrics * @return menu */ ! JPopupMenu menuFor(Collection<Geometric> geometrics); /** --- 19,27 ---- public interface MenuFactory { /** * ! * @param entities Entities * @return menu */ ! JPopupMenu menuFor(Collection<? extends Entity> entities); /** *************** *** 39,48 **** */ JPopupMenu menuFor(Entity entity); - - /** - * - * @param attribute attribute - * @return menu - */ - JPopupMenu menuFor(Attribute attribute); } --- 31,33 ---- |
From: rimestad <rim...@us...> - 2007-12-19 11:40:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4357/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: changed menuFactory interface to entity instead of geometric... and made popupMenu reflect that Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** GenericTreeView.java 18 Dec 2007 23:15:10 -0000 1.137 --- GenericTreeView.java 19 Dec 2007 11:40:48 -0000 1.138 *************** *** 60,64 **** import net.sourceforge.bprocessor.model.modellor.Modellor; import net.sourceforge.bprocessor.gui.GUI; - import net.sourceforge.bprocessor.gui.actions.CollectionMenuAction; import net.sourceforge.bprocessor.gui.attrview.AttributeView; --- 60,63 ---- *************** *** 1233,1256 **** @Override public JPopupMenu menu() { ! JPopupMenu menu = new JPopupMenu(); ! Collection<Component> spaces = new LinkedList<Component>(); ! spaces.add((Component)getUserObject()); ! menu.add(new CollectionMenuAction(spaces, "Make Instance") { ! public void actionPerformed(ActionEvent e) { ! Project proj = Project.getInstance(); ! Container world = proj.getActiveSpace(); ! for (Object o : col) { ! Component lo = (Component)o; ! Container space = lo.getSpace(); ! Instance instance = new Instance(space.getName() + " instance "); ! proj.addCalalogObject(lo); ! instance.setProto(space); ! world.add(instance); ! } ! proj.changed(world); ! proj.checkpoint(); ! }; ! }); ! return menu; } --- 1232,1236 ---- @Override public JPopupMenu menu() { ! return GUI.getInstance().menuFactory().menuFor((Component)getUserObject()); } |
From: rimestad <rim...@us...> - 2007-12-19 11:39:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3937/src/net/sourceforge/bprocessor/model Modified Files: Instance.java Container.java Log Message: cahnged remove on container to be able to remove non containers from elements as well. Implemented delete on instance Index: Instance.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Instance.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Instance.java 17 Dec 2007 11:21:09 -0000 1.6 --- Instance.java 19 Dec 2007 11:39:04 -0000 1.7 *************** *** 104,109 **** @Override public void delete() { ! // TODO Auto-generated method stub ! } --- 104,110 ---- @Override public void delete() { ! if (this.getOwner() != null) { ! this.getOwner().remove(this); ! } } Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Container.java 17 Dec 2007 11:21:10 -0000 1.7 --- Container.java 19 Dec 2007 11:39:04 -0000 1.8 *************** *** 124,128 **** * @param element The space to remove as element */ ! public void remove(Container element) { if (container) { Set surfs = element.getEnvelope(); --- 124,128 ---- * @param element The space to remove as element */ ! public void remove(Space element) { if (container) { Set surfs = element.getEnvelope(); *************** *** 143,149 **** } if (element != null) { ! Container superSpace = findElement(element); ! if (superSpace != null) { ! superSpace.elements.remove(element.getId()); element.setId(null); } --- 143,149 ---- } if (element != null) { ! Space superSpace = findElement(element); ! if (superSpace != null && superSpace instanceof Container) { ! ((Container)superSpace).elements.remove(element.getId()); element.setId(null); } *************** *** 162,174 **** * is returned. */ ! protected Container findElement(Container element) { if (elements != null) { if (elements.get(element.getId()) == element) { ! return (Container) this; } else { Iterator it = elements.values().iterator(); while (it.hasNext()) { Container space = (Container)it.next(); ! Container result = space.findElement(element); if (result != null) { return result; --- 162,174 ---- * is returned. */ ! protected Space findElement(Space element) { if (elements != null) { if (elements.get(element.getId()) == element) { ! return this; } else { Iterator it = elements.values().iterator(); while (it.hasNext()) { Container space = (Container)it.next(); ! Space result = space.findElement(element); if (result != null) { return result; |
From: Michael L. <he...@us...> - 2007-12-19 10:56:12
|
Update of /cvsroot/bprocessor/gui/src/gfx In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21616/src/gfx Modified Files: Biconassigntool2.gif Log Message: updated icon Index: Biconassigntool2.gif =================================================================== RCS file: /cvsroot/bprocessor/gui/src/gfx/Biconassigntool2.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs3mk9pN and /tmp/cvsFuyPxc differ |
From: Michael L. <he...@us...> - 2007-12-19 09:03:42
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10098/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Log Message: Refactored the material attribute in attribute view Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** ToolFactory.java 10 Dec 2007 11:55:54 -0000 1.97 --- ToolFactory.java 19 Dec 2007 09:03:45 -0000 1.98 *************** *** 209,213 **** this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); ! registerTool(Tool.ASSIGN_TOOL, assign, "Biconassigntool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); --- 209,213 ---- this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); ! registerTool(Tool.ASSIGN_TOOL, assign, "Biconassigntool2.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); |
From: Michael L. <he...@us...> - 2007-12-19 09:03:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10085/src/net/sourceforge/bprocessor/model Modified Files: Material.java Surface.java Log Message: Refactored the material attribute in attribute view Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** Surface.java 18 Dec 2007 15:06:49 -0000 1.213 --- Surface.java 19 Dec 2007 09:03:41 -0000 1.214 *************** *** 1849,1868 **** } } else if (a.getName().equals("Front Material")) { ! if (a.getValue() instanceof String) { ! String s = (String)a.getValue(); ! for (Material m : Project.getInstance().getMaterials()) { ! if (s.equalsIgnoreCase(m.getName())) { ! setFrontMaterial(m); ! } ! } } } else if (a.getName().equals("Back Material")) { ! if (a.getValue() instanceof String) { ! String s = (String)a.getValue(); ! for (Material m : Project.getInstance().getMaterials()) { ! if (s.equalsIgnoreCase(m.getName())) { ! setBackMaterial(m); ! } ! } } } else if (a.getName().equals("Holes")) { --- 1849,1860 ---- } } else if (a.getName().equals("Front Material")) { ! Material material = (Material) ((Reference) a.getValue()).getObject(); ! if (material != frontMaterial()) { ! setFrontMaterial(material); } } else if (a.getName().equals("Back Material")) { ! Material material = (Material) ((Reference) a.getValue()).getObject(); ! if (material != backMaterial()) { ! setBackMaterial(material); } } else if (a.getName().equals("Holes")) { Index: Material.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Material.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Material.java 17 Dec 2007 14:20:37 -0000 1.14 --- Material.java 19 Dec 2007 09:03:41 -0000 1.15 *************** *** 276,278 **** --- 276,285 ---- } } + + /** + * {@inheritDoc} + */ + public String toString() { + return "[Material " + name + "]"; + } } |
From: Michael L. <he...@us...> - 2007-12-19 09:03:33
|
Update of /cvsroot/bprocessor/gui/src/gfx In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10069/src/gfx Added Files: Biconarrowraised.gif Biconassigntool2.gif Log Message: Refactored the material attribute in attribute view --- NEW FILE: Biconassigntool2.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconarrowraised.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2007-12-19 09:03:33
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10069/src/net/sourceforge/bprocessor/gui/attrview Modified Files: ReferenceAttribute.java LinkAttribute.java Log Message: Refactored the material attribute in attribute view Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** LinkAttribute.java 18 Dec 2007 15:06:45 -0000 1.19 --- LinkAttribute.java 19 Dec 2007 09:03:31 -0000 1.20 *************** *** 91,95 **** component.add(createValueLabel(attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ! URL url = classloader.getResource("Biconarrow.gif"); icon = new JLabel(new ImageIcon(url)); this.add(component); --- 91,95 ---- component.add(createValueLabel(attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ! URL url = classloader.getResource("Biconarrowraised.gif"); icon = new JLabel(new ImageIcon(url)); this.add(component); Index: ReferenceAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/ReferenceAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReferenceAttribute.java 18 Dec 2007 15:06:45 -0000 1.1 --- ReferenceAttribute.java 19 Dec 2007 09:03:31 -0000 1.2 *************** *** 10,15 **** --- 10,17 ---- import java.awt.Dimension; + import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; + import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; *************** *** 21,24 **** --- 23,28 ---- import java.util.List; + import javax.swing.AbstractAction; + import javax.swing.Action; import javax.swing.Box; import javax.swing.BoxLayout; *************** *** 26,29 **** --- 30,34 ---- import javax.swing.JComponent; import javax.swing.JLabel; + import javax.swing.JPopupMenu; import javax.swing.JTextField; import javax.swing.text.AttributeSet; *************** *** 59,63 **** /** The link icon */ ! private JLabel icon; /** The editor, when this EditableAttribute is being edited */ --- 64,71 ---- /** The link icon */ ! private JLabel link; ! ! private JLabel arrow; ! private MouseListener popup; /** The editor, when this EditableAttribute is being edited */ *************** *** 77,80 **** --- 85,90 ---- this.listeners = new LinkedList(); + popup = new HandlePopup(); + label = createLabel(attribute.getName()); *************** *** 92,100 **** component.add(createValueLabel((Reference) attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ! URL url = classloader.getResource("Biconarrow.gif"); ! icon = new JLabel(new ImageIcon(url)); this.add(component); ! this.add(icon); this.add(Box.createHorizontalGlue()); } --- 102,117 ---- component.add(createValueLabel((Reference) attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ! { ! URL url = classloader.getResource("Biconarrowraised.gif"); ! link = new JLabel(new ImageIcon(url)); ! } this.add(component); ! this.add(link); this.add(Box.createHorizontalGlue()); + { + URL url = classloader.getResource("Biconlink.gif"); + arrow = new JLabel(new ImageIcon(url)); + } + this.add(arrow); } *************** *** 106,110 **** protected double round(double value) { int i = (int) (value * 100000); ! return ((double) i) / 100000.0; } --- 123,127 ---- protected double round(double value) { int i = (int) (value * 100000); ! return i / 100000.0; } *************** *** 127,131 **** label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); ! icon.addMouseListener(this); } --- 144,149 ---- label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); ! link.addMouseListener(this); ! arrow.addMouseListener(popup); } *************** *** 137,140 **** --- 155,160 ---- label.removeMouseListener(mouseListener); component.removeMouseListener(mouseListener); + link.removeMouseListener(this); + arrow.removeMouseListener(popup); } *************** *** 291,294 **** --- 311,353 ---- } + private class ItemAction extends AbstractAction { + private Object object; + + /** + * Constructs an ItemAction + * @param object Object + */ + public ItemAction(Object object) { + super(object.toString()); + this.object = object; + } + + /** {@inheritDoc} */ + public void actionPerformed(ActionEvent event) { + Reference reference = (Reference) attribute.getValue(); + reference.setObject(object); + valueChanged(); + } + } + + private class HandlePopup extends MouseAdapter { + /** + * {@inheritDoc} + */ + public void mousePressed(MouseEvent event) { + Reference reference = (Reference) attribute.getValue(); + List legals = reference.getLegals(); + JPopupMenu menu; + { + menu = new JPopupMenu(); + for (Object current : legals) { + Action action = new ItemAction(current); + menu.add(action); + } + } + menu.show(event.getComponent(), event.getX(), event.getY()); + } + } + /** * Not in use |
From: rimestad <rim...@us...> - 2007-12-18 23:41:32
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17298/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java AbstractPencil.java Log Message: improved on instance move, to be able to place instances in a abitrary coordinatesystem and better insert plane alignment Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** FinalMoveTool.java 17 Dec 2007 19:59:43 -0000 1.46 --- FinalMoveTool.java 18 Dec 2007 23:41:36 -0000 1.47 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.gl.Editor; import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gui.GUI; *************** *** 207,215 **** this.instance = instance; this.initialCoordinate = instance.getInstanceAnchor().copy(); ! this.handle = handle; ! Vertex center = this.initialCoordinate.translate(this.handle.center()); start = new Intersection(center, start.type(), start.object()); this.prevCs = Project.getInstance().getActiveCoordinateSystem().copy(); this.prevCs.setOrigin(center); } --- 208,228 ---- this.instance = instance; this.initialCoordinate = instance.getInstanceAnchor().copy(); ! this.handle = handle.copy(); ! Transformation transformation = editor.getView().transformation(); ! double x = pressPos[0]; ! double y = View.getHeight() - pressPos[1]; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = transformation.unProject(ray); ! CoordinateSystem tmp = this.initialCoordinate.unTranslate(this.handle); ! Vertex center = tmp.plane().intersection(ray); start = new Intersection(center, start.type(), start.object()); + + center = this.initialCoordinate.translate(center); + this.handle.setOrigin(center); this.prevCs = Project.getInstance().getActiveCoordinateSystem().copy(); this.prevCs.setOrigin(center); + } *************** *** 229,235 **** cs = CoordinateSystem.systemFor(current.vertex(), n); } else if (current.object() instanceof Plane) { Plane p = (Plane)current.object(); Vertex normal = p.normal(); ! cs = CoordinateSystem.systemFor(current.vertex(), normal); } if (cs == null) { --- 242,256 ---- cs = CoordinateSystem.systemFor(current.vertex(), n); } else if (current.object() instanceof Plane) { + Transformation transformation = editor.getView().transformation(); + double x = pressPos[0] + dx; + double y = View.getHeight() - pressPos[1] - dy; + Vertex near = new Vertex(x, y, 0.0); + Vertex far = new Vertex(x, y, 1.0); + Edge ray = new Edge(near, far); + ray = transformation.unProject(ray); + Vertex cen = Project.getInstance().getActiveCoordinateSystem().plane().intersection(ray); Plane p = (Plane)current.object(); Vertex normal = p.normal(); ! cs = CoordinateSystem.systemFor(cen, normal); } if (cs == null) { *************** *** 239,243 **** prevCs = cs; } ! CoordinateSystem tmp = handle.translate(Project.getInstance().getActiveCoordinateSystem()); tmp = cs.unTranslate(tmp); instance.getInstanceAnchor().setOrigin(tmp.center()); --- 260,266 ---- prevCs = cs; } ! CoordinateSystem zero = new CoordinateSystem(new Vertex(1, 0, 0), new Vertex(0, 1, 0), ! new Vertex(0, 0, 1), new Vertex(0, 0, 0)); ! CoordinateSystem tmp = handle.translate(zero); tmp = cs.unTranslate(tmp); instance.getInstanceAnchor().setOrigin(tmp.center()); Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** AbstractPencil.java 13 Dec 2007 12:00:49 -0000 1.102 --- AbstractPencil.java 18 Dec 2007 23:41:36 -0000 1.103 *************** *** 188,192 **** if (start != null) { Vertex normal; ! if (Math.abs(n.getZ()) > 0.47) { normal = new Vertex(0, 0, 1.0); } else { --- 188,192 ---- if (start != null) { Vertex normal; ! /*if (Math.abs(n.getZ()) > 0.47) { normal = new Vertex(0, 0, 1.0); } else { *************** *** 194,198 **** d.normalize(); normal = d; ! } normal = Project.getInstance().getActiveCoordinateSystem().getN(); --- 194,198 ---- d.normalize(); normal = d; ! }*/ normal = Project.getInstance().getActiveCoordinateSystem().getN(); |
From: rimestad <rim...@us...> - 2007-12-18 23:19:37
|
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8374/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: checkstyle fix Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** GUI.java 18 Dec 2007 23:15:11 -0000 1.91 --- GUI.java 18 Dec 2007 23:19:28 -0000 1.92 *************** *** 30,34 **** import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Line; --- 30,33 ---- |
From: rimestad <rim...@us...> - 2007-12-18 23:19:37
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8388/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java Log Message: checkstyle fix Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** SelectTool.java 18 Dec 2007 23:15:01 -0000 1.70 --- SelectTool.java 18 Dec 2007 23:19:33 -0000 1.71 *************** *** 8,12 **** import net.sourceforge.bprocessor.gl.Editor; - import net.sourceforge.bprocessor.gl.view.PopupMenu; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Geometric; --- 8,11 ---- |
From: rimestad <rim...@us...> - 2007-12-18 23:16:05
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6128/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java Log Message: more popupmenu refactoring Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** SelectTool.java 10 Dec 2007 11:55:55 -0000 1.69 --- SelectTool.java 18 Dec 2007 23:15:01 -0000 1.70 *************** *** 8,12 **** import net.sourceforge.bprocessor.gl.Editor; ! import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Selection; --- 8,13 ---- import net.sourceforge.bprocessor.gl.Editor; ! import net.sourceforge.bprocessor.gl.view.PopupMenu; ! import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Selection; *************** *** 14,17 **** --- 15,19 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.LinkedList; import javax.swing.JPopupMenu; *************** *** 87,91 **** if (target == null) { selection.clear(); ! menu = PopupMenu.getBackgroundMenu(); } else { if (target instanceof Geometric) { --- 89,93 ---- if (target == null) { selection.clear(); ! menu = GUI.getInstance().menuFactory().menuFor(new LinkedList<Geometric>()); } else { if (target instanceof Geometric) { *************** *** 93,97 **** selection.set((Geometric) target); } ! menu = PopupMenu.makeSelectionMenu(); } } --- 95,99 ---- selection.set((Geometric) target); } ! menu = GUI.getInstance().menuFactory().menuFor(selection); } } |
From: rimestad <rim...@us...> - 2007-12-18 23:16:05
|
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6389/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: more popupmenu refactoring Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** GenericTreeView.java 17 Dec 2007 11:21:24 -0000 1.136 --- GenericTreeView.java 18 Dec 2007 23:15:10 -0000 1.137 *************** *** 60,64 **** import net.sourceforge.bprocessor.model.modellor.Modellor; import net.sourceforge.bprocessor.gui.GUI; - import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.gui.actions.CollectionMenuAction; import net.sourceforge.bprocessor.gui.attrview.AttributeView; --- 60,63 ---- *************** *** 609,619 **** */ public JPopupMenu menu() { ! JPopupMenu pm = PopupMenu.makeSelectionMenu(); if (pm == null) { Object object = this.getUserObject(); ! if (object instanceof Entity) { ! pm = PopupMenu.getEntityMenu((Entity)object); ! } else if (object instanceof Attribute) { ! pm = PopupMenu.getAttributeMenu((Attribute)object); } } --- 608,618 ---- */ public JPopupMenu menu() { ! JPopupMenu pm = GUI.getInstance().menuFactory().menuFor(Selection.primary()); if (pm == null) { Object object = this.getUserObject(); ! if (object instanceof Attribute) { ! pm = GUI.getInstance().menuFactory().menuFor((Attribute)object); ! } else if (object instanceof Entity) { ! pm = GUI.getInstance().menuFactory().menuFor((Entity)object); } } |
From: rimestad <rim...@us...> - 2007-12-18 23:16:05
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6128/src/net/sourceforge/bprocessor/gl/view Added Files: PopupMenu.java Log Message: more popupmenu refactoring --- NEW FILE: PopupMenu.java --- //--------------------------------------------------------------------------------- // $Id: PopupMenu.java,v 1.1 2007/12/18 23:15:01 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.view; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Set; import javax.swing.AbstractAction; import javax.swing.JMenu; import javax.swing.JPopupMenu; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.gui.MenuFactory; import net.sourceforge.bprocessor.gui.actions.AttributeMenuAction; import net.sourceforge.bprocessor.gui.actions.CollectionMenuAction; import net.sourceforge.bprocessor.gui.actions.GeometricMenuAction; import net.sourceforge.bprocessor.gui.actions.EntityMenuAction; import net.sourceforge.bprocessor.gui.actions.ModellorMenuAction; import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; import net.sourceforge.bprocessor.gui.attrview.AttributeView; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Command; import net.sourceforge.bprocessor.model.Component; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.Container; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.SurfaceAnalysis; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.modellor.Modellor; import org.apache.log4j.Logger; /** * The static popup menu generator */ public class PopupMenu implements MenuFactory { /** The logger */ private static Logger log = Logger.getLogger(PopupMenu.class); private static final boolean CHECKS = false; /** * * */ public PopupMenu() { } /** * Make a popupmenu for a list of surfaces * @param surfaces the list of surfaces * @return the popupmenu */ private static JPopupMenu getSurfaceMenu(Collection surfaces) { JPopupMenu menu = getGeometricMenu(surfaces); if (surfaces.size() == 1) { Surface s = (Surface)surfaces.iterator().next(); AbstractAction focus = new EntityMenuAction(s, "Focus on") { public void actionPerformed(ActionEvent arg0) { Surface s = (Surface)entity; Camera.focusOn(Project.getInstance().getCurrentCamera(), s); } }; menu.add(focus); AbstractAction holeanalysis = new EntityMenuAction(s, "Hole analysis") { public void actionPerformed(ActionEvent arg0) { Surface surface = (Surface)entity; Geometry.holeAnalysis(surface); } }; menu.add(holeanalysis); AbstractAction flip = new EntityMenuAction(s, "Flip") { public void actionPerformed(ActionEvent arg0) { Surface surface = (Surface) entity; surface.flip(); } }; menu.add(flip); { AbstractAction action = new GeometricMenuAction(surfaces, "Smooth...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Smooth((Surface) entities.iterator().next()); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(surfaces, "Offset Planar...") { public void actionPerformed(ActionEvent event) { Surface surface = (Surface) entities.iterator().next(); Command command = new Command.Offset(surface.getEdges()); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(surfaces, "Offset Normal...") { public void actionPerformed(ActionEvent event) { Surface surface = (Surface) entities.iterator().next(); Command command = new Command.OffsetNormal(surface); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(surfaces, "Extrude...") { public void actionPerformed(ActionEvent event) { Surface surface = (Surface) entities.iterator().next(); Command command = new Command.Extrude(surface); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(surfaces, "Insert Net...") { public void actionPerformed(ActionEvent event) { Surface surface = (Surface) entities.iterator().next(); Command command = new Command.InsertNet(surface); AttributeView.instance().display(command); } }; menu.add(action); } } return menu; } /** * * @param edges Collection of edges * @return Menu for edges */ private static JPopupMenu getEdgeMenu(Collection edges) { JPopupMenu menu = getGeometricMenu(edges); { AbstractAction action = new GeometricMenuAction(edges, "Split...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Split((Edge) entities.iterator().next()); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(edges, "Offset...") { public void actionPerformed(ActionEvent event) { LinkedList<Edge> edges = new LinkedList(entities); if (edges.size() > 1) { List<Edge> ordered = Command.Offset.order(edges); if (ordered != null) { Command command = new Command.Offset(ordered); AttributeView.instance().display(command); } else { GUI.getInstance().alert("Select a connected set of edges"); } } else { GUI.getInstance().alert("Select more than one edge"); } } }; menu.add(action); } return menu; } /** * * @param systems Collection of coordinate systems * @return Menu for coordinate systems */ private static JPopupMenu getCoordinateSystemMenu(Collection systems) { JPopupMenu menu = getGeometricMenu(systems); return menu; } private abstract static class ModellorAction extends AbstractAction { protected Modellor modellor; protected Container space; public ModellorAction(Modellor modellor, Container space) { super(modellor.title()); this.modellor = modellor; this.space = space; } } /** * A popup generator for a collection of space * @param s the collection of spaces * @return the popup menu */ private static JPopupMenu getSpaceMenu(Collection s) { JPopupMenu menu = PopupMenu.getGeometricMenu(s); menu.addSeparator(); { AbstractAction action = new CollectionMenuAction(s, "Dissolve") { public void actionPerformed(ActionEvent event) { List<Container> spaces = new LinkedList(col); for (Container space : spaces) { Collection<Vertex> vertices = new LinkedList(space.getVertices()); Collection<Edge> edges = new LinkedList(space.getEdges()); Collection<Surface> surfaces = new LinkedList(space.getSurfaces()); for (Vertex current : vertices) { space.remove(current); } for (Vertex current : vertices) { space.getOwner().insert(current); } for (Edge current : edges) { space.remove(current); } for (Edge current : edges) { space.getOwner().insert(current); } for (Surface current : surfaces) { space.remove(current); current.setBackDomain(null); current.setFrontDomain(null); } for (Surface current : surfaces) { space.getOwner().insert(current); } } } }; menu.add(action); } if (s.size() == 1) { // Some options do only apply to one space Container sp = (Container)s.iterator().next(); AbstractAction edit = new SpaceMenuAction(sp, "Edit") { public void actionPerformed(ActionEvent arg0) { Selection.primary().clear(); Project p = Project.getInstance(); space.edit(); //FIXME: changed is also called in the edit-method on space //It is properly only needed once. p.changed(p); } }; menu.add(edit); { AbstractAction action = new SpaceMenuAction(sp, "Subdivide...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Subdivide(space); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new SpaceMenuAction(sp, "Frame..") { public void actionPerformed(ActionEvent event) { Command command = new Command.Frame(space); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new SpaceMenuAction(sp, "Offset..") { public void actionPerformed(ActionEvent event) { Command command = new Command.Layer(space); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new SpaceMenuAction(sp, "Normals") { public void actionPerformed(ActionEvent event) { Container union = new Container("Normals", Container.CONSTRUCTION, true); for (Surface surface : space.getSurfaces()) { Vertex normal = surface.normal(); Vertex origin = surface.center(); CoordinateSystem system = CoordinateSystem.systemFor(origin, normal); Container pyramid = Command.Pyramid.pyramid(0.05, 0.05, 0.2); for (Vertex current : pyramid.getVertices()) { current.set(system.unTranslate(current)); } union.add(pyramid); } Project.getInstance().world().add(union); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } }; menu.add(action); } { AbstractAction action = new SpaceMenuAction(sp, "Make Component") { public void actionPerformed(ActionEvent event) { Component component = new Component(space); space.getOwner().remove(space); Project.getInstance().addCalalogObject(component); Selection.primary().clear(); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } }; menu.add(action); } if (CHECKS) { AbstractAction check = new SpaceMenuAction(sp, "Consistency Check") { public void actionPerformed(ActionEvent arg0) { space.check(); } }; menu.add(check); AbstractAction modCheck = new SpaceMenuAction(sp, "Modellor Check") { public void actionPerformed(ActionEvent arg0) { log.info(space.getModellor()); } }; menu.add(modCheck); } for (Modellor current : Modellor.getRegisteredModellors()) { if (current.application() == Modellor.DETAIL) { AbstractAction action = new ModellorAction(current, sp) { public void actionPerformed(ActionEvent e) { System.out.println("detail " + modellor); Modellor detailer = modellor.newInstance(space); Project.getInstance().changed(Project.getInstance()); Project.getInstance().addObserver(detailer); } }; menu.add(action); } } JMenu mm = new JMenu("Modellors"); Collection c = Modellor.getRegisteredModellors(); Iterator iter = c.iterator(); while (iter.hasNext()) { Modellor m = (Modellor)iter.next(); AbstractAction modellor = new ModellorMenuAction(sp, m); mm.add(modellor); } menu.add(mm); } return menu; } /** * a popup generator for a single entity * @param e The entity * @return the popup menu */ private static JPopupMenu getEntityMenu(Entity e) { Collection c = new LinkedList(); c.add(e); return getGeometricMenu(c); } /** * A generator of the attribute popup menu * @param attribute the attribute to make popup for * @return The popupmenu */ private static JPopupMenu getAttributeMenu(Attribute attribute) { JPopupMenu pm = new JPopupMenu(); AbstractAction delete = new AttributeMenuAction(attribute, "Delete") { public void actionPerformed(ActionEvent arg0) { Project p = Project.getInstance(); p.getGlobals().remove(attribute); p.changed(p); p.checkpoint(); } }; pm.add(delete); return pm; } private static CoordinateSystem systemFor(Geometric geometric) { if (geometric instanceof Vertex) { return systemFor((Vertex) geometric); } else if (geometric instanceof Surface) { return systemFor((Surface) geometric); } else if (geometric instanceof CoordinateSystem) { return (CoordinateSystem) geometric; } else { CoordinateSystem active = Project.getInstance().getActiveCoordinateSystem(); return active.copy(geometric.center()); } } private static CoordinateSystem systemFor(Vertex vertex) { Collection<Edge> edges = vertex.getEdges(); if (edges.size() == 0) { CoordinateSystem active = Project.getInstance().getActiveCoordinateSystem(); return active.copy(vertex.copy()); } else { double x = 0; double y = 0; double z = 0; for (Edge current : edges) { Vertex other = current.otherVertex(vertex); Vertex v = other.minus(vertex); x += v.getX(); y += v.getY(); z += v.getZ(); } x /= edges.size(); y /= edges.size(); z /= edges.size(); Vertex n = new Vertex(-x, -y, -z); Edge edge = edges.iterator().next(); Vertex other = edge.otherVertex(vertex); Vertex v = other.minus(vertex); Vertex i = n.cross(v); Vertex j = n.cross(i); Vertex o = vertex.copy(); return new CoordinateSystem(i, j, n, o); } } private static CoordinateSystem systemFor(Surface surface) { Vertex normal = surface.normal(); Vertex origin = surface.center(); return CoordinateSystem.systemFor(origin, normal); } /** * A popupmenu generator for entities * @param arguments the entity list to make popup for * @return the popupmenu */ private static JPopupMenu getGeometricMenu(Collection<Geometric> arguments) { JPopupMenu menu = new JPopupMenu(); AbstractAction delete = new GeometricMenuAction(arguments, "Delete") { public void actionPerformed(ActionEvent arg0) { Selection.primary().clear(); for (Geometric current : entities) { current.erase(); Project.getInstance().changed(current); } Project.getInstance().changed(Geometry.collect(entities)); Project.getInstance().checkpoint(); } }; menu.add(delete); AbstractAction allConnected = new GeometricMenuAction(arguments, "All Connected") { public void actionPerformed(ActionEvent arg0) { Collection<Geometric> geometrics = Geometric.connected(new LinkedList(entities)); Selection.primary().set(geometrics); } }; menu.add(allConnected); AbstractAction simplify = new GeometricMenuAction(arguments, "Simplify Geometry") { public void actionPerformed(ActionEvent arg0) { Geometry.simplifyGeometry(entities); } }; menu.add(simplify); { AbstractAction action = new GeometricMenuAction(arguments, "Make Union") { public void actionPerformed(ActionEvent event) { Mesh mesh = new Mesh(entities); HashMap map = new HashMap(); Mesh copy = mesh.copy(map); Container union = new Container("Union", Container.CONSTRUCTION, true); union.setUnion(true); for (Vertex current : copy.vertices()) { union.add(current); } for (Edge current : copy.edges()) { union.add(current); } for (Surface current : copy.surfaces()) { union.add(current); } for (Container current : copy.elements()) { union.add(current); } for (Geometric current : entities) { current.delete(); } Selection.primary().clear(); Project.getInstance().getActiveSpace().add(union); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(arguments, "Align Axes") { public void actionPerformed(ActionEvent event) { if (entities.size() == 1) { Geometric geometric = entities.iterator().next(); CoordinateSystem system = systemFor(geometric); Vertex i = system.getI(); Vertex j = system.getJ(); Vertex n = system.getN(); Vertex o = system.getOrigin(); CoordinateSystem active = Project.getInstance().getActiveCoordinateSystem(); active.setIJN(i, j, n); active.setOrigin(o); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(arguments, "Scale...") { public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); Vertex center = null; if (entities.size() == 1) { Geometric geometric = entities.iterator().next(); if (geometric instanceof Constructor) { Constructor constructor = (Constructor) geometric; center = constructor.getOrigin(); } } if (center == null) { center = Vertex.center(vertices); } CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); system = system.copy(); system.setOrigin(center); Command command = new Command.Scale(vertices, system); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(arguments, "Translate...") { public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); Vertex center = null; if (entities.size() == 1) { Geometric geometric = entities.iterator().next(); if (geometric instanceof Constructor) { Constructor constructor = (Constructor) geometric; center = constructor.getOrigin(); } } if (center == null) { center = Vertex.center(vertices); } CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); system = system.copy(); system.setOrigin(center); Command command = new Command.Translate(vertices, system); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(arguments, "Rotate...") { public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); Vertex center = null; if (entities.size() == 1) { Geometric geometric = entities.iterator().next(); if (geometric instanceof Constructor) { Constructor constructor = (Constructor) geometric; center = constructor.getOrigin(); } } if (center == null) { center = Vertex.center(vertices); } CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); system = system.copy(); system.setOrigin(center); Command command = new Command.Rotate(vertices, system); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(arguments, "Transform In") { public void actionPerformed(ActionEvent event) { List<Vertex> vertices = new ArrayList(Geometry.collect(entities)); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); system.unTranslateIt(vertices); for (Vertex current : vertices) { current.update(); } Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } }; menu.add(action); } { AbstractAction action = new GeometricMenuAction(arguments, "Transform Out") { public void actionPerformed(ActionEvent event) { List<Vertex> vertices = new ArrayList(Geometry.collect(entities)); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); system.translateIt(vertices); for (Vertex current : vertices) { current.update(); } Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } }; menu.add(action); } return menu; } /** * Get background menu * @return Background menu */ private static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); { AbstractAction action = new AbstractAction("Reset Axes") { public void actionPerformed(ActionEvent event) { CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); Vertex i = new Vertex(1, 0, 0); Vertex j = new Vertex(0, 1, 0); Vertex n = new Vertex(0, 0, 1); Vertex o = new Vertex(0, 0, 0); system.setIJN(i, j, n); system.setOrigin(o); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } }; menu.add(action); } { AbstractAction action = new AbstractAction("Cube...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Cube(); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new AbstractAction("Cylinder...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Cylinder(); AttributeView.instance().display(command); } }; menu.add(action); } { AbstractAction action = new AbstractAction("Pyramid...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Pyramid(); AttributeView.instance().display(command); } }; menu.add(action); } return menu; } /** * Create a popupMenu for the selection * @return The popupmenu or null if the selection is empty */ private static JPopupMenu makeSelectionMenu() { if (Selection.primary().isEmpty()) { return null; } else { Iterator sel = Selection.primary().iterator(); Object type = null; while (sel.hasNext()) { Object next = sel.next(); if (type == null) { type = next; } else if (!next.getClass().isInstance(type)) { return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); } } if (type instanceof Container) { return PopupMenu.getSpaceMenu(new LinkedList<Geometric>(Selection.primary())); } else if (type instanceof Surface) { return PopupMenu.getSurfaceMenu(new LinkedList<Geometric>(Selection.primary())); } else if (type instanceof Edge) { return getEdgeMenu(new LinkedList<Geometric>(Selection.primary())); } else if (type instanceof CoordinateSystem) { return getCoordinateSystemMenu(new LinkedList<Geometric>(Selection.primary())); } else { return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); } } } /** * * @return JPopupMenu */ private JPopupMenu getAnalysisMenu() { JPopupMenu menu = new JPopupMenu(); AbstractAction planeanalysis = new AbstractAction("Plane Analysis") { public void actionPerformed(ActionEvent arg0) { Container space = Project.getInstance().getActiveSpace(); SurfaceAnalysis analysis = new SurfaceAnalysis(); analysis.clearPlanes(space); Collection planes = analysis.planeAnalysis(space); Iterator iter = planes.iterator(); while (iter.hasNext()) { CoordinateSystem current = (CoordinateSystem) iter.next(); space.insert(current); } Project.getInstance().changed(space); Project.getInstance().checkpoint(); } }; menu.add(planeanalysis); AbstractAction clearplanes = new AbstractAction("Delete Planes") { public void actionPerformed(ActionEvent arg0) { Container space = Project.getInstance().getActiveSpace(); SurfaceAnalysis analysis = new SurfaceAnalysis(); analysis.clearPlanes(space); Project.getInstance().changed(space); Project.getInstance().checkpoint(); } }; menu.add(clearplanes); AbstractAction surfaceanalysis = new AbstractAction("Surface Analysis") { public void actionPerformed(ActionEvent arg0) { Container space = Project.getInstance().getActiveSpace(); SurfaceAnalysis analysis = new SurfaceAnalysis(); analysis.surfaceAnalysis(space); Project.getInstance().changed(space); Project.getInstance().checkpoint(); } }; menu.add(surfaceanalysis); AbstractAction clearsurfaces = new AbstractAction("Delete Surfaces") { public void actionPerformed(ActionEvent arg0) { Container space = Project.getInstance().getActiveSpace(); SurfaceAnalysis analysis = new SurfaceAnalysis(); analysis.clearSurfaces(space); Project.getInstance().changed(space); Project.getInstance().checkpoint(); } }; menu.add(clearsurfaces); return menu; } /** {@inheritDoc} */ public JPopupMenu menuFor(Geometric geometric) { return null; } /** {@inheritDoc} */ public JPopupMenu menuFor(Collection<Geometric> geometrics) { if (geometrics == Selection.primary()) { return makeSelectionMenu(); } else if (geometrics.isEmpty()) { return PopupMenu.getBackgroundMenu(); } else { return PopupMenu.getGeometricMenu(geometrics); } } /** {@inheritDoc} */ public JPopupMenu menuFor(Entity entity) { return getEntityMenu(entity); } /** {@inheritDoc} */ public JPopupMenu menuFor(Attribute attribute) { return getAttributeMenu(attribute); } } |
From: rimestad <rim...@us...> - 2007-12-18 23:16:05
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6128/src/net/sourceforge/bprocessor/gl Modified Files: Editor.java Log Message: more popupmenu refactoring Index: Editor.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/Editor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Editor.java 9 Dec 2007 08:26:34 -0000 1.9 --- Editor.java 18 Dec 2007 23:15:01 -0000 1.10 *************** *** 10,13 **** --- 10,14 ---- import net.sourceforge.bprocessor.gl.tool.ToolFactory; import net.sourceforge.bprocessor.gl.view.GLPreviewPanel; + import net.sourceforge.bprocessor.gl.view.PopupMenu; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.view.ViewToolbarFactory; *************** *** 210,214 **** Project.getInstance().addStaticObserver(this); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); ! { --- 211,215 ---- Project.getInstance().addStaticObserver(this); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); ! GUI.getInstance().register(new PopupMenu()); { |
From: rimestad <rim...@us...> - 2007-12-18 23:16:04
|
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6389/src/net/sourceforge/bprocessor/gui Modified Files: MenuFactory.java GUI.java Removed Files: PopupMenu.java Log Message: more popupmenu refactoring --- PopupMenu.java DELETED --- Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** GUI.java 18 Dec 2007 13:11:24 -0000 1.90 --- GUI.java 18 Dec 2007 23:15:11 -0000 1.91 *************** *** 30,33 **** --- 30,34 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Line; *************** *** 664,682 **** /** ! * ! * @param geometric Geometric ! * @return geomeric ! */ ! public JPopupMenu menuFor(Geometric geometric) { ! return menuFactory.menuFor(geometric); ! } ! ! /** ! * ! * @param geometrics Collection ! * @return menu */ ! public JPopupMenu menuFor(Collection<Geometric> geometrics) { ! return menuFactory.menuFor(geometrics); } --- 665,673 ---- /** ! * Give menuFactory ! * @return The factory */ ! public MenuFactory menuFactory() { ! return this.menuFactory; } Index: MenuFactory.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/MenuFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MenuFactory.java 18 Dec 2007 13:11:24 -0000 1.1 --- MenuFactory.java 18 Dec 2007 23:15:10 -0000 1.2 *************** *** 12,15 **** --- 12,17 ---- import javax.swing.JPopupMenu; + import net.sourceforge.bprocessor.model.Attribute; + import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; *************** *** 30,33 **** --- 32,48 ---- */ JPopupMenu menuFor(Collection<Geometric> geometrics); + + /** + * + * @param entity Entity + * @return menu + */ + JPopupMenu menuFor(Entity entity); + /** + * + * @param attribute attribute + * @return menu + */ + JPopupMenu menuFor(Attribute attribute); } |
From: Michael L. <he...@us...> - 2007-12-18 15:07:03
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6233/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Added Files: Parameter.java Reference.java Log Message: Started refactoring of Attribute etc. Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** Surface.java 18 Dec 2007 08:02:53 -0000 1.212 --- Surface.java 18 Dec 2007 15:06:49 -0000 1.213 *************** *** 1880,1884 **** --- 1880,1888 ---- public List<Attribute> getAttributes() { ArrayList<Attribute> res = new ArrayList<Attribute>(); + List<Material> materials = new LinkedList(Project.getInstance().getMaterials()); + Entity.sort(materials); + res.add(new Attribute("Name", getName(), false)); + if (getOwner() == Project.getInstance().world()) { res.add(new Attribute("Owner", Project.getInstance(), false)); *************** *** 1886,1927 **** res.add(new Attribute("Owner", getOwner(), false)); } - if (getFrontDomain() != null) { - res.add(new Attribute("Space1", getFrontDomain(), true)); - } else { - res.add(new Attribute("Space1", "None", true)); - } - - if (getFrontMaterial() != null) { - res.add(new Attribute("Front Material", getFrontMaterial())); - } else { - if (getFrontDomain().isConstructionSpace()) { - res.add(new Attribute("Front Material", Defaults.getConstructionMaterial())); - } else if (getFrontDomain().isFunctionalSpace()) { - res.add(new Attribute("Front Material", Defaults.getFunctionalMaterial())); - } else { - res.add(new Attribute("Front Material", Defaults.getVoidMaterial())); - } - } ! if (getBackDomain() != null) { ! res.add(new Attribute("Space2", getBackDomain(), true)); ! } else { ! res.add(new Attribute("Space2", "None", true)); ! } ! if (getBackMaterial() != null) { ! res.add(new Attribute("Back Material", getBackMaterial())); ! } else { ! if (getBackDomain().isConstructionSpace()) { ! res.add(new Attribute("Back Material", Defaults.getConstructionMaterial())); ! } else if (getBackDomain().isFunctionalSpace()) { ! res.add(new Attribute("Back Material", Defaults.getFunctionalMaterial())); ! } else { ! res.add(new Attribute("Back Material", Defaults.getVoidMaterial())); ! } ! } ! if (isInner()) { res.add(new Attribute("Exterior", getExterior(), false)); } if (holes != null) { double holeArea = 0; --- 1890,1903 ---- res.add(new Attribute("Owner", getOwner(), false)); } ! res.add(new Attribute("Space1", getFrontDomain(), true)); ! res.add(new Attribute("Front Material", new Reference(frontMaterial(), materials))); ! res.add(new Attribute("Space2", getBackDomain(), true)); ! res.add(new Attribute("Back Material", new Reference(backMaterial(), materials))); ! if (exterior != null) { res.add(new Attribute("Exterior", getExterior(), false)); } + if (holes != null) { double holeArea = 0; --- NEW FILE: Reference.java --- //--------------------------------------------------------------------------------- // $Id: Reference.java,v 1.1 2007/12/18 15:06:49 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.List; import java.util.Map; /** * */ public class Reference implements Parameter { private Object object; private List legals; /** * * @param object Object * @param legals List */ public Reference(Object object, List legals) { this.object = object; this.legals = legals; } /** * * @param value Object */ public void setObject(Object value) { object = value; } /** * * @return object */ public Object getObject() { return object; } /** * * @param list List */ public void setLegals(List list) { legals = list; } /** * * @return List */ public List getLegals() { return legals; } /** {@inheritDoc} */ public Object evaluate(Map<String, Object> env) { return object; } } --- NEW FILE: Parameter.java --- //--------------------------------------------------------------------------------- // $Id: Parameter.java,v 1.1 2007/12/18 15:06:49 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.Map; /** * */ public interface Parameter { /** * Evaluates this Parameter in the given environment * @param env the environment to evaluate in * @return the result of the evaluation */ public Object evaluate(Map<String, Object> env); } |
From: Michael L. <he...@us...> - 2007-12-18 15:06:52
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6216/src/net/sourceforge/bprocessor/gui/attrview Modified Files: LinkAttribute.java GenericPanel.java Added Files: ReferenceAttribute.java Log Message: Started refactoring of Attribute etc. Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** GenericPanel.java 17 Dec 2007 13:55:09 -0000 1.50 --- GenericPanel.java 18 Dec 2007 15:06:45 -0000 1.51 *************** *** 33,36 **** --- 33,37 ---- import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Reference; import net.sourceforge.bprocessor.model.Selector; import net.sourceforge.bprocessor.model.Structure; *************** *** 192,195 **** --- 193,204 ---- } + private void handleReference(Attribute attribute, JComponent where) { + ReferenceAttribute la = new ReferenceAttribute(attribute); + la.addStringAttributeListener(new GenericListener()); + genAttributes.add(la); + where.add(new AttributeRow(la)); + } + + private void handleOperation(Attribute attribute, JComponent where) { GenericAttribute generic = new OperationAttribute(attribute); *************** *** 228,231 **** --- 237,242 ---- } else if (a.getValue() instanceof Operation) { handleOperation(a, where); + } else if (a.getValue() instanceof Reference) { + handleReference(a, where); } else { System.out.println("-- " + a.getValue() + " --"); Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** LinkAttribute.java 13 Dec 2007 12:00:55 -0000 1.18 --- LinkAttribute.java 18 Dec 2007 15:06:45 -0000 1.19 *************** *** 91,95 **** component.add(createValueLabel(attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ! URL url = classloader.getResource("Biconlink.gif"); icon = new JLabel(new ImageIcon(url)); this.add(component); --- 91,95 ---- component.add(createValueLabel(attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ! URL url = classloader.getResource("Biconarrow.gif"); icon = new JLabel(new ImageIcon(url)); this.add(component); --- NEW FILE: ReferenceAttribute.java --- //--------------------------------------------------------------------------------- // $Id: ReferenceAttribute.java,v 1.1 2007/12/18 15:06:45 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Dimension; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.net.URL; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.PlainDocument; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Reference; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Container; /** * The LinkAttributeView */ public class ReferenceAttribute extends GenericAttribute implements KeyListener, MouseListener { /** The listeners */ private List listeners; /** The attribute this gui represents */ private Attribute attribute; /** The component */ private JComponent component; /** The Label */ private JLabel label; /** The link icon */ private JLabel icon; /** The editor, when this EditableAttribute is being edited */ private AutoCompleteField editor; /** * Constructor for StringAttribute * @param attribute The attribute */ public ReferenceAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); label = createLabel(attribute.getName()); Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); header.add(Box.createHorizontalStrut(7)); header.add(label); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); component = Box.createHorizontalBox(); component.add(createValueLabel((Reference) attribute.getValue())); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); URL url = classloader.getResource("Biconarrow.gif"); icon = new JLabel(new ImageIcon(url)); this.add(component); this.add(icon); this.add(Box.createHorizontalGlue()); } /** * Round * @param value The value * @return The rounded value */ protected double round(double value) { int i = (int) (value * 100000); return ((double) i) / 100000.0; } /** * Create a label for the * @param key The key * @return A JLabel */ private JLabel createLabel(String key) { JLabel keyLabel = new JLabel(key + " :"); keyLabel.setFont(AttributeView.FONT_BOLD); return keyLabel; } /** * Add a mouselisterner to the active elements in the LinkAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); icon.addMouseListener(this); } /** * Remove a mouselisterner to the active elements in the LinkAttribute * @param mouseListener the mouselistener */ public void removeMouseListener(MouseListener mouseListener) { label.removeMouseListener(mouseListener); component.removeMouseListener(mouseListener); } /** * Add a listener that are notified when the value is changed * @param listener The listener */ public void addStringAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeStringAttributeListener(AttributeListener listener) { listeners.remove(listener); } /** * Send valueChanged to all listeners */ protected void valueChanged() { Iterator iter = listeners.iterator(); while (iter.hasNext()) { AttributeListener current = (AttributeListener) iter.next(); current.valueChanged(attribute); } } /** * Create a value label * @param value The value * @return The label */ private JComponent createValueLabel(Reference reference) { Object value = reference.getObject(); String s = ""; JLabel valueLabel; if (value instanceof Entity) { if (value instanceof Container) { s = ((Container)value).getDisplayName(); } else { s = ((Entity)value).getName(); } } else if (value instanceof Project) { s = ((Project)value).getName(); } else if (value instanceof String) { s = (String)value; } else if (value instanceof Double) { double rounded = round(((Double) value).doubleValue()); s = Double.toString(rounded); } valueLabel = new JLabel(s); if (attribute.isEditable()) { valueLabel.setFont(AttributeView.FONT_PLAIN); } else { valueLabel.setFont(AttributeView.FONT_ITALIC); } return valueLabel; } /** * Create a value editor * @param value The value * @return The editor */ private JComponent createValueEditor(Object value) { String s = ""; if (value instanceof String) { s = (String)value; } else if (value instanceof Double) { double rounded = round(((Double) value).doubleValue()); s = Double.toString(rounded); } AutoCompleteField valueEditor = new AutoCompleteField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); return valueEditor; } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * Start editing the value by replacing the label with an editor */ public void startEditing() { if (attribute.isEditable()) { if (editor == null) { component.remove(0); editor = (AutoCompleteField) createValueEditor(attribute.getValue()); editor.addKeyListener(this); component.add(editor); component.revalidate(); } editor.requestFocus(); editor.selectAll(); } } /** * Stop editing the value by replacing the editor with an label, * and sending valueChanged to all listeners. */ public void stopEditing() { if (editor != null && attribute.isEditable()) { Object val = attribute.getValue(); if (val instanceof String || val instanceof Entity) { attribute.setValue(editor.getText()); } component.remove(editor); editor.removeKeyListener(this); editor = null; component.add(createValueLabel((Reference) attribute.getValue())); component.revalidate(); valueChanged(); } } /** * Cancels editing the value by replacing the editor with an label, * without sending any events to listeners. */ public void cancelEditing() { if (editor != null) { component.remove(editor); editor.removeKeyListener(this); editor = null; component.add(createValueLabel((Reference) attribute.getValue())); component.revalidate(); } } /** * Respond to the enter key by stopping editing. * @param event The KeyEvent */ public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ENTER) { stopEditing(); } else if (event.getKeyCode() == KeyEvent.VK_ESCAPE) { cancelEditing(); } } /** * Not in use * @param event The KeyEvent */ public void keyTyped(KeyEvent event) { } /** * Not in use * @param event The KeyEvent */ public void keyReleased(KeyEvent event) { } /** * Start editing on the view * @param event The event */ public void mouseClicked(MouseEvent event) { Object object = ((Reference) attribute().getValue()).getObject(); if (object instanceof Geometric) { Selection.primary().set((Geometric)object); } else { AttributeView.instance().display(object); } } /** * Not in use * @param event The MouseEvent */ public void mousePressed(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseReleased(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseEntered(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseExited(MouseEvent event) { } /** * Autocomplete textfield */ public class AutoCompleteField extends JTextField { /** * constructor of autocomplete field * @param string is the number of colums in the field */ public AutoCompleteField(String string) { super(string); } /** * creates the document * @return a new autocompletedocument */ protected Document createDefaultModel() { return new AutoCompleteDocument(this); } } /** * The autocomplete document */ public class AutoCompleteDocument extends PlainDocument { /** The typed text */ private String typed; /** The textfield */ private JTextField field; /** * The AutoCompleteDocoment constructor * @param field the Textfield */ public AutoCompleteDocument(JTextField field) { this.field = field; typed = ""; } /** * insertString, insert a string into the document * @param offs the offset * @param str the string to be inserted * @param a the AttributeSet * @throws BadLocationException is thrown if the location is out of place */ public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (str == null) { return; } if (offs < typed.length()) { typed = typed.substring(0, offs) + str + typed.substring(offs, typed.length()); } else { typed = typed + str; } super.remove(0, super.getLength()); typed = autocomplete(typed); super.insertString(0, typed, a); field.setCaretPosition(offs + str.length()); field.setSelectionStart(offs + str.length()); field.setSelectionEnd(typed.length()); } /** * Autocomplete the given string * @param string The string to autocomplete * @return The result of the completion that is the given string if no completion */ public String autocomplete(String string) { if (!string.equalsIgnoreCase("")) { final Comparator alpha = new Comparator() { public int compare(Object s1, Object s2) { return ((Container) s1).getName().compareToIgnoreCase(((Container) s2).getName()); } }; final Comparator num = new Comparator() { public int compare(Object s1, Object s2) { return ((Container) s1).getId().compareTo(((Container) s2).getId()); } }; LinkedList sort = new LinkedList(Project.getInstance().getSpaces()); Collections.sort(sort, alpha); Collections.sort(sort, num); LinkedList matches = new LinkedList(); Iterator it = sort.iterator(); while (it.hasNext()) { Container current = (Container) it.next(); String name = current.getName() + "-" + current.getId().toString(); if (name.startsWith(string) && !name.equalsIgnoreCase(string)) { matches.add(name); return name; } } } return string; } /** * @param offs the ofset to remove from * @param amount The number of characters to remove * @throws BadLocationException if characters that do not exist is beeing removed */ public void remove(int offs, int amount) throws BadLocationException { //FIXME String typed1 = typed.substring(0, offs); String typed2 = typed.substring(offs + amount, typed.length()); typed = typed1.concat(typed2); //String test = autocomplete(typed); super.remove(offs, amount); } } } |
From: Michael L. <he...@us...> - 2007-12-18 15:06:43
|
Update of /cvsroot/bprocessor/gui/src/gfx In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6216/src/gfx Added Files: Biconarrow.gif Log Message: Started refactoring of Attribute etc. --- NEW FILE: Biconarrow.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2007-12-18 13:11:21
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25193/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java GUI.java Added Files: MenuFactory.java Log Message: popupmenu refactory Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** PopupMenu.java 17 Dec 2007 20:00:08 -0000 1.93 --- PopupMenu.java 18 Dec 2007 13:11:24 -0000 1.94 *************** *** 51,55 **** * The static popup menu generator */ ! public class PopupMenu { /** The logger */ private static Logger log = Logger.getLogger(PopupMenu.class); --- 51,55 ---- * The static popup menu generator */ ! public class PopupMenu implements MenuFactory { /** The logger */ private static Logger log = Logger.getLogger(PopupMenu.class); *************** *** 58,61 **** --- 58,68 ---- /** + * + * + */ + public PopupMenu() { + } + + /** * Make a popupmenu for a list of surfaces * @param surfaces the list of surfaces *************** *** 794,796 **** --- 801,813 ---- } + /** {@inheritDoc} */ + public JPopupMenu menuFor(Geometric geometric) { + return null; + } + + /** {@inheritDoc} */ + public JPopupMenu menuFor(Collection<Geometric> geometrics) { + return null; + } + } Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** GUI.java 17 Dec 2007 13:09:35 -0000 1.89 --- GUI.java 18 Dec 2007 13:11:24 -0000 1.90 *************** *** 130,133 **** --- 130,135 ---- private PreviewPanel previewPanel; + private MenuFactory menuFactory; + /** * Constructor for GUI *************** *** 652,655 **** --- 654,684 ---- } + + /** + * Register menu factory + * @param factory menu factory + */ + public void register(MenuFactory factory) { + this.menuFactory = factory; + } + + /** + * + * @param geometric Geometric + * @return geomeric + */ + public JPopupMenu menuFor(Geometric geometric) { + return menuFactory.menuFor(geometric); + } + + /** + * + * @param geometrics Collection + * @return menu + */ + public JPopupMenu menuFor(Collection<Geometric> geometrics) { + return menuFactory.menuFor(geometrics); + } + /** * Adds a menu to the menu bar. --- NEW FILE: MenuFactory.java --- //--------------------------------------------------------------------------------- // $Id: MenuFactory.java,v 1.1 2007/12/18 13:11:24 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui; import java.util.Collection; import javax.swing.JPopupMenu; import net.sourceforge.bprocessor.model.Geometric; /** * */ public interface MenuFactory { /** * @param geometric Geometric * @return menu */ JPopupMenu menuFor(Geometric geometric); /** * * @param geometrics Geometrics * @return menu */ JPopupMenu menuFor(Collection<Geometric> geometrics); } |