|
From: Hirzel P. <ph...@us...> - 2005-09-16 14:54:45
|
Update of /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32258 Modified Files: DependencyLineConnection.java DependencyView.java DrawingFrame.java EdgeFigure.java Layout.java NodeFigure.java PackageFigure.java SeparatorFigure.java ServiceFigure.java Log Message: Refactoring: persistent Dependency-Diagram Layout Index: NodeFigure.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/NodeFigure.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NodeFigure.java 29 Aug 2005 09:41:16 -0000 1.1.1.1 --- NodeFigure.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 1,4 **** package org.tcotool.standard.drawing; - /* * This library is free software; you can redistribute it and/or --- 1,3 ---- *************** *** 18,21 **** --- 17,22 ---- import java.awt.*; import java.awt.event.*; + import java.util.Iterator; + import javax.swing.*; *************** *** 23,26 **** --- 24,29 ---- import org.tcotool.application.ServiceDetailView; import org.tcotool.model.TcoObject; + import org.tcotool.presentation.PresentationElement; + import org.tcotool.presentation.PresentationNode; import org.jhotdraw.standard.*; *************** *** 34,60 **** import ch.softenvironment.view.*; /** ! * Fiure Specification for all Elements treated as Nodes * (analog a Class Symbol in an UML-Class-Diagram). * @see EdgeFigure * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ ! abstract class NodeFigure extends GraphicalCompositeFigure implements PresentationNode { ! private DependencyView diagram = null; ! protected Object modelElement = null; ! private String totalCost = null; ! // Composites protected TextFigure nameFigure; protected TextFigure costFigure; /** ! * UmlFigure constructor comment. * @param newPresentationFigure ch.ifa.draw.framework.Figure */ ! public NodeFigure(DependencyView diagram, Figure newPresentationFigure, Object element) { super(newPresentationFigure); ! this.diagram = diagram; ! modelElement = element; } /** --- 37,78 ---- import ch.softenvironment.view.*; /** ! * Figure Specification for all Elements treated as Nodes * (analog a Class Symbol in an UML-Class-Diagram). * @see EdgeFigure * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ ! abstract class NodeFigure extends GraphicalCompositeFigure { ! private DependencyView view = null; ! private PresentationNode node = null; // persistent ! private String totalCost = null; ! ! // Composites protected TextFigure nameFigure; protected TextFigure costFigure; /** ! * NodeFigure constructor. * @param newPresentationFigure ch.ifa.draw.framework.Figure */ ! public NodeFigure(DependencyView view, Figure newPresentationFigure, Object element) throws Throwable { super(newPresentationFigure); ! this.view = view; ! ! // modelElement = element; ! Iterator iterator = view.getDiagram().getPresentationElement().iterator(); ! while (iterator.hasNext()) { ! PresentationElement tmp = (PresentationElement)iterator.next(); ! if (tmp.getSubject().equals(element)) { ! node = (PresentationNode)tmp; ! break; ! } ! } ! if (node == null) { ! // not yet displayed ! node = (PresentationNode)((TcoObject)element).getObjectServer().createInstance(PresentationNode.class); ! node.setSubject(element); ! } } /** *************** *** 163,170 **** protected abstract Color getDefaultFillColor(); /** ! * Return the classDiagram where this Figure is shown. */ protected DependencyView getDiagram() { ! return diagram; } public final int getEast() { --- 181,188 ---- protected abstract Color getDefaultFillColor(); /** ! * Return the DependencyDiagram where this Figure is shown. */ protected DependencyView getDiagram() { ! return view; } public final int getEast() { *************** *** 211,216 **** * @return ModelElement */ ! public Object getModelElement() { ! return modelElement; } public final int getSouth() { --- 229,237 ---- * @return ModelElement */ ! public final Object getModelElement() { ! return node.getSubject(); ! } ! protected PresentationNode getNode() { ! return node; } public final int getSouth() { *************** *** 337,348 **** */ } ! public final void setSouth(int value) { ! if (value != getSouth()) { ! //Tracer.getInstance().debug(((TcoObject)getModelElement()).getName() + "->move south=" + value); ! Rectangle rectangle = getPresentationFigure().displayBox(); ! getPresentationFigure().displayBox(new Rectangle((int)rectangle.getX(), value, (int)rectangle.getWidth(), (int)rectangle.getHeight())); ! updateView(); } - } /** * Update Attribute name of ModelElement. --- 358,369 ---- */ } ! public final void setSouth(int value) { ! if (value != getSouth()) { ! //Tracer.getInstance().debug(((TcoObject)getModelElement()).getName() + "->move south=" + value); ! Rectangle rectangle = getPresentationFigure().displayBox(); ! getPresentationFigure().displayBox(new Rectangle((int)rectangle.getX(), value, (int)rectangle.getWidth(), (int)rectangle.getHeight())); ! updateView(); ! } } /** * Update Attribute name of ModelElement. *************** *** 358,366 **** } /** ! * ModelElement changed from outside. Therefore a refresh of the View is needed. */ public void updateView() { // TUNE!!! // show the saved colors -> should precede setNode(node) ! // if (getNode().getBackground() != null) { --- 379,396 ---- } /** ! * Refresh the view respectively this Figure within the view. */ public void updateView() { // TUNE!!! + // update coordinates + Rectangle rectangle = getPresentationFigure().displayBox(); + if ((getNode().getEast() == null) || (getNode().getEast().longValue() != (long)rectangle.getX())) { + getNode().setEast(new Long((long)rectangle.getX())); + } + if ((getNode().getSouth() == null) || (getNode().getSouth().longValue() != (long)rectangle.getY())) { + getNode().setSouth(new Long((long)rectangle.getY())); + } + // show the saved colors -> should precede setNode(node) ! // if (getNode().getBackground() != null) { *************** *** 376,380 **** nameFigure.setText(((TcoObject)getModelElement()).getName()); if (totalCost == null) { ! totalCost = ch.softenvironment.client.ResourceManager.getResource(ServiceDetailView.class, "PnlCost_text") + " = " + AmountFormat.toString(diagram.getCalculator().calcTcoOverall((TcoObject)getModelElement())); } costFigure.setText(totalCost); --- 406,410 ---- nameFigure.setText(((TcoObject)getModelElement()).getName()); if (totalCost == null) { ! totalCost = ch.softenvironment.client.ResourceManager.getResource(ServiceDetailView.class, "PnlCost_text") + " = " + AmountFormat.toString(view.getCalculator().calcTcoOverall((TcoObject)getModelElement())); } costFigure.setText(totalCost); Index: DrawingFrame.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/DrawingFrame.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DrawingFrame.java 29 Aug 2005 09:41:14 -0000 1.1.1.1 --- DrawingFrame.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 20,24 **** * This class represents a JInternalFrame with a JHotDraw drawing area. * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ --- 20,24 ---- * This class represents a JInternalFrame with a JHotDraw drawing area. * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ Index: PackageFigure.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/PackageFigure.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PackageFigure.java 29 Aug 2005 09:41:15 -0000 1.1.1.1 --- PackageFigure.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 24,28 **** * in Dependency-Diagram. * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ --- 24,28 ---- * in Dependency-Diagram. * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ *************** *** 31,35 **** * Create a new instance of PackageFigure with a RectangleFigure as presentation figure. */ ! public PackageFigure(DependencyView diagram, Object element) { // this(new RectangleFigure(new Point(0,0), new Point(200, 150))); super(diagram, new RectangleFigure(), element); --- 31,35 ---- * Create a new instance of PackageFigure with a RectangleFigure as presentation figure. */ ! public PackageFigure(DependencyView diagram, Object element) throws Throwable { // this(new RectangleFigure(new Point(0,0), new Point(200, 150))); super(diagram, new RectangleFigure(), element); Index: DependencyLineConnection.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/DependencyLineConnection.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DependencyLineConnection.java 29 Aug 2005 09:41:14 -0000 1.1.1.1 --- DependencyLineConnection.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 32,36 **** * A DependencyLineConnection has an arrow at the end point and is dotted (analog UML). * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ --- 32,36 ---- * A DependencyLineConnection has an arrow at the end point and is dotted (analog UML). * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ Index: Layout.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/Layout.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Layout.java 29 Aug 2005 09:41:15 -0000 1.1.1.1 --- Layout.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 14,23 **** public class Layout { ! public static double delta1 = 1.0;// node_distribution ! public static double delta2 = 0.01;// borderline ! public static double delta3 = 0.0001;// edgelength ! public static double delta4 = 100.0;// edgecrossing ! public static double delta10 = 0.75;// cooling 0.6..0.95 ! public static double delta11 = 0.75;// cooling 0.6..0.95 private double min_x; private double max_x; --- 14,23 ---- public class Layout { ! private static double delta1 = 1.0;// node_distribution ! private static double delta2 = 0.01;// borderline ! private static double delta3 = 0.0001;// edgelength ! private static double delta4 = 100.0;// edgecrossing ! private static double delta10 = 0.75;// cooling 0.6..0.95 ! private static double delta11 = 0.75;// cooling 0.6..0.95 private double min_x; private double max_x; *************** *** 143,153 **** //ch.softenvironment.util.Tracer.getInstance().debug("current ClassDiagramView found"); ! /* ch.ehi.umleditor.umlpresentation.Diagram diag=diagView.getDiagram(); ! java.util.Iterator elei=diag.iteratorPresentationElement(); while(elei.hasNext()){ Object obj=elei.next(); ! if(obj instanceof ch.ehi.umleditor.umlpresentation.PresentationEdge){ edgev.add(obj); ! }else if(obj instanceof ch.ehi.umleditor.umlpresentation.PresentationNode){ nodev.add(obj); } --- 143,153 ---- //ch.softenvironment.util.Tracer.getInstance().debug("current ClassDiagramView found"); ! /* org.tcotool.presentation.Diagram diag=diagView.getDiagram(); ! java.util.Iterator elei=diag.getPresentationElement().iterator(); while(elei.hasNext()){ Object obj=elei.next(); ! if(obj instanceof org.tcotool.presentation.PresentationEdge){ edgev.add(obj); ! }else if(obj instanceof org.tcotool.presentation.PresentationNode){ nodev.add(obj); } *************** *** 157,163 **** while (enum.hasNextFigure()) { Figure figure = enum.nextFigure(); ! if (figure instanceof PresentationEdge) { edgev.add(figure); ! } else if(figure instanceof PresentationNode){ nodev.add(figure); } --- 157,163 ---- while (enum.hasNextFigure()) { Figure figure = enum.nextFigure(); ! if (figure instanceof EdgeFigure) { edgev.add(figure); ! } else if (figure instanceof NodeFigure){ nodev.add(figure); } *************** *** 165,169 **** //dumpNodes(nodev.iterator()); // before Layout model=new Layout(); ! // ch.ehi.umleditor.application.LauncherView.getInstance().log("layout diagram","H "+diagView.getMaximumSize().getHeight()+", W"+diagView.getMaximumSize().getWidth()); model.layout(nodev, edgev, 0, 0, --- 165,169 ---- //dumpNodes(nodev.iterator()); // before Layout model=new Layout(); ! // Tracer.getInstance().debug("layout diagram","H "+diagView.getMaximumSize().getHeight()+", W"+diagView.getMaximumSize().getWidth()); model.layout(nodev, edgev, 0, 0, *************** *** 174,178 **** diagView.refresh(); }else{ ! Tracer.getInstance().runtimeWarning(Layout.class, "Layout", "Failed"); } return; --- 174,178 ---- diagView.refresh(); }else{ ! Tracer.getInstance().developerWarning(Layout.class, "Layout", "Failed"); } return; *************** *** 271,275 **** return sum; } ! private PresentationNode getBeginNode(int edgeIdx) { /* PresentationEdge edge=getEdge(edgeIdx); --- 271,275 ---- return sum; } ! private NodeFigure getBeginNode(int edgeIdx) { /* PresentationEdge edge=getEdge(edgeIdx); *************** *** 278,282 **** */ EdgeFigure edge = (EdgeFigure)getEdge(edgeIdx); ! return (PresentationNode)edge.startFigure(); } private double getdist(double x1, double y1, double x2, double y2) --- 278,282 ---- */ EdgeFigure edge = (EdgeFigure)getEdge(edgeIdx); ! return (NodeFigure)edge.startFigure(); } private double getdist(double x1, double y1, double x2, double y2) *************** *** 286,294 **** return Math.sqrt(d1 * d1 + d2 * d2); } ! private PresentationEdge getEdge(int i) { ! return (PresentationEdge)edgev.get(i); } ! private PresentationNode getEndNode(int edgeIdx) { /* PresentationEdge edge=getEdge(edgeIdx); --- 286,294 ---- return Math.sqrt(d1 * d1 + d2 * d2); } ! private EdgeFigure getEdge(int i) { ! return (EdgeFigure)edgev.get(i); } ! private NodeFigure getEndNode(int edgeIdx) { /* PresentationEdge edge=getEdge(edgeIdx); *************** *** 298,306 **** */ EdgeFigure edge = (EdgeFigure)getEdge(edgeIdx); ! return (PresentationNode)edge.endFigure(); } ! private PresentationNode getNode(int i) { ! return (PresentationNode)nodev.get(i); } private void layout(java.util.List nodev,java.util.List edgev, double min_x1, double min_y1, double max_x1, double max_y1) --- 298,306 ---- */ EdgeFigure edge = (EdgeFigure)getEdge(edgeIdx); ! return (NodeFigure)edge.endFigure(); } ! private NodeFigure getNode(int i) { ! return (NodeFigure)nodev.get(i); } private void layout(java.util.List nodev,java.util.List edgev, double min_x1, double min_y1, double max_x1, double max_y1) *************** *** 333,337 **** int new_x; int new_y; ! PresentationNode node; do{ int i; --- 333,337 ---- int new_x; int new_y; ! NodeFigure node = null; do{ int i; *************** *** 381,389 **** double sum = 0; for(int j = 0;j<nodev.size();j++){ ! PresentationNode node=getNode(j); for(int i = 0;i<edgev.size();i++){ ! PresentationNode begNode=getBeginNode(i); if(begNode==node)continue; ! PresentationNode endNode=getEndNode(i); if(endNode==node)continue; double dist=pt2line(node.getEast(),node.getSouth() --- 381,389 ---- double sum = 0; for(int j = 0;j<nodev.size();j++){ ! NodeFigure node=getNode(j); for(int i = 0;i<edgev.size();i++){ ! NodeFigure begNode=getBeginNode(i); if(begNode==node)continue; ! NodeFigure endNode=getEndNode(i); if(endNode==node)continue; double dist=pt2line(node.getEast(),node.getSouth() Index: SeparatorFigure.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/SeparatorFigure.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SeparatorFigure.java 29 Aug 2005 09:41:14 -0000 1.1.1.1 --- SeparatorFigure.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 23,27 **** * from other figures beneath in addition. * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ --- 23,27 ---- * from other figures beneath in addition. * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ Index: EdgeFigure.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/EdgeFigure.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** EdgeFigure.java 29 Aug 2005 09:41:16 -0000 1.1.1.1 --- EdgeFigure.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 1,4 **** package org.tcotool.standard.drawing; - /* * This library is free software; you can redistribute it and/or --- 1,3 ---- *************** *** 24,31 **** --- 23,33 ---- import org.tcotool.model.Dependency; import org.tcotool.model.TcoObject; + import org.tcotool.presentation.WayPoint; import org.jhotdraw.framework.*; import org.jhotdraw.figures.*; import ch.softenvironment.view.*; + import ch.softenvironment.jomm.DbObjectServer; + import ch.softenvironment.jomm.mvc.model.DbObject; import ch.softenvironment.util.*; /** *************** *** 33,49 **** * @see NodeFigure * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ ! abstract class EdgeFigure extends LineConnection implements PresentationEdge{ // keep reference to real model's presentation ! private DependencyView diagram = null; ! // protected PresentationEdge edge = null; ! protected Object modelElement = null; // mouse-Event suppression - // private EdgeFigure lastInvalidEdge = null; protected NodeFigure startFigure = null; protected NodeFigure endFigure = null; ! private Vector wayPoints = new Vector(); /** * EdgeFigure constructor comment. --- 35,52 ---- * @see NodeFigure * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ ! abstract class EdgeFigure extends LineConnection { // keep reference to real model's presentation ! private DependencyView view = null; ! private Object modelElement = null; ! //TODO protected PresentationEdge edge = null; // persistent ! private Vector wayPoints = new Vector(); //TODO wayPoints => edge#wayPoint-List ! // mouse-Event suppression protected NodeFigure startFigure = null; protected NodeFigure endFigure = null; ! /** * EdgeFigure constructor comment. *************** *** 58,64 **** * EdgeFigure constructor comment. */ ! public EdgeFigure(DependencyView diagram, NodeFigure start, NodeFigure end, Dependency dependency) { this(); ! this.diagram = diagram; this.startFigure = start; this.endFigure = end; --- 61,67 ---- * EdgeFigure constructor comment. */ ! public EdgeFigure(DependencyView view, NodeFigure start, NodeFigure end, Dependency dependency) { this(); ! this.view = view; this.startFigure = start; this.endFigure = end; *************** *** 120,124 **** // removeVisually(); } else { ! wayPoints.add(createWayPoint(startPoint())); Connector end = getDiagram().findNodeConnector(getEndElement(), x, y); if (end == null) { --- 123,127 ---- // removeVisually(); } else { ! wayPoints.add(createWayPoint(((DbObject)getStartElement()).getObjectServer(), startPoint())); Connector end = getDiagram().findNodeConnector(getEndElement(), x, y); if (end == null) { *************** *** 127,131 **** // removeVisually(); } else { ! wayPoints.add(createWayPoint(endPoint())); connectStart(start); setEndConnector(end); --- 130,134 ---- // removeVisually(); } else { ! wayPoints.add(createWayPoint(((DbObject)getEndElement()).getObjectServer(), endPoint())); connectStart(start); setEndConnector(end); *************** *** 134,138 **** for (int i=0; i<wayPoints.size()-1; i++) { WayPoint currentPoint = (WayPoint)wayPoints.get(i); ! insertPointAt(new Point(currentPoint.getEast(), currentPoint.getSouth()), i + 1); } --- 137,141 ---- for (int i=0; i<wayPoints.size()-1; i++) { WayPoint currentPoint = (WayPoint)wayPoints.get(i); ! insertPointAt(new Point(currentPoint.getEast().intValue(), currentPoint.getSouth().intValue()), i + 1); } *************** *** 150,157 **** * @param p Coordinates of WayPoint */ ! protected final static WayPoint createWayPoint(Point p) { ! WayPoint wayPoint = new WayPoint(); ! wayPoint.setEast(p.x); ! wayPoint.setSouth(p.y); return wayPoint; --- 153,160 ---- * @param p Coordinates of WayPoint */ ! protected final static WayPoint createWayPoint(DbObjectServer server, Point p) throws Throwable { ! WayPoint wayPoint = (WayPoint)server.createInstance(WayPoint.class); ! wayPoint.setEast(new Long(p.x)); ! wayPoint.setSouth(new Long(p.y)); return wayPoint; *************** *** 176,180 **** */ protected DependencyView getDiagram() { ! return diagram; } /** --- 179,183 ---- */ protected DependencyView getDiagram() { ! return view; } /** Index: DependencyView.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/DependencyView.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DependencyView.java 29 Aug 2005 09:41:15 -0000 1.1.1.1 --- DependencyView.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- import org.tcotool.model.TcoObject; import org.tcotool.model.TcoPackage; + import org.tcotool.presentation.Diagram; import org.tcotool.tools.Calculator; *************** *** 37,41 **** * (related to UML-Classdiagram's with Package-Dependencies). * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ * @see CustomSelectionTool#handleMousePopupMenu(..) --- 38,42 ---- * (related to UML-Classdiagram's with Package-Dependencies). * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ * @see CustomSelectionTool#handleMousePopupMenu(..) *************** *** 44,51 **** // private ToolButton defaultToolButton = null; // private ToolButton selectedToolButton = null; ! Tool tool = null; ! UndoManager undoManager = new UndoManager(); private Calculator calculator = new Calculator(LauncherView.getInstance().getUtility()); ! // private Diagram diagram = null; // private Element parentElement = null; // Menu Checkboxes --- 45,52 ---- // private ToolButton defaultToolButton = null; // private ToolButton selectedToolButton = null; ! private Tool tool = null; ! private UndoManager undoManager = new UndoManager(); private Calculator calculator = new Calculator(LauncherView.getInstance().getUtility()); ! private Diagram diagram = null; // private Element parentElement = null; // Menu Checkboxes *************** *** 58,65 **** * @param height int */ ! public DependencyView(Set dependencies, int width, int height) { // @see LauncherView.addInternalFrame(..) for setting the Editor super(null, width, height); setDrawing(new StandardDrawing()); // setBackground(ch.ehi.umleditor.application.LauncherView.getSettings().getBackgroundColor()); --- 59,67 ---- * @param height int */ ! public DependencyView(Diagram diagram, Set dependencies, int width, int height) throws Throwable { // @see LauncherView.addInternalFrame(..) for setting the Editor super(null, width, height); setDrawing(new StandardDrawing()); + this.diagram = diagram; // setBackground(ch.ehi.umleditor.application.LauncherView.getSettings().getBackgroundColor()); *************** *** 73,82 **** * Called by UML-Toolbox. * @return the added figure. ! * @see EdgeFigure.handleConnection(Figure, Figure) */ public Figure add(Figure figure) { try { super.add(figure); ! ((NodeFigure)figure).updateView(); } catch(Throwable e) { BaseDialog.showError(LauncherView.getInstance(), "error", "CEFigureNotCreated", e); //$NON-NLS-1$ --- 75,91 ---- * Called by UML-Toolbox. * @return the added figure. ! * @see EdgeFigure#handleConnection(Figure, Figure) */ public Figure add(Figure figure) { try { super.add(figure); ! if (figure instanceof NodeFigure) { ! if (!diagram.getPresentationElement().contains(((NodeFigure)figure).getNode())) { ! List elements = new ArrayList(diagram.getPresentationElement()); ! elements.add(((NodeFigure)figure).getNode()); ! diagram.setPresentationElement(elements); ! } ! ((NodeFigure)figure).updateView(); ! } } catch(Throwable e) { BaseDialog.showError(LauncherView.getInstance(), "error", "CEFigureNotCreated", e); //$NON-NLS-1$ *************** *** 90,94 **** * @see NavigationView#mniAddToDiagram() */ ! private Figure add(TcoObject element) { Figure figure = findFigure(element); if (figure != null) { --- 99,103 ---- * @see NavigationView#mniAddToDiagram() */ ! private Figure add(TcoObject element) throws Throwable { Figure figure = findFigure(element); if (figure != null) { *************** *** 108,112 **** } } ! private void addDependency(Dependency dependency) { Figure client = add(LauncherView.getInstance().getUtility().findClient(dependency)); Figure supplier = add(LauncherView.getInstance().getUtility().findSupplier(dependency)); --- 117,121 ---- } } ! private void addDependency(Dependency dependency) throws Throwable { Figure client = add(LauncherView.getInstance().getUtility().findClient(dependency)); Figure supplier = add(LauncherView.getInstance().getUtility().findSupplier(dependency)); *************** *** 413,415 **** --- 422,427 ---- return null; } + protected Diagram getDiagram() { + return diagram; + } } Index: ServiceFigure.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/drawing/ServiceFigure.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ServiceFigure.java 29 Aug 2005 09:41:14 -0000 1.1.1.1 --- ServiceFigure.java 16 Sep 2005 14:54:37 -0000 1.2 *************** *** 26,30 **** * Graphical representation for a TCO-Service in a Dependency Diagram. * ! * @author: Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ --- 26,30 ---- * Graphical representation for a TCO-Service in a Dependency Diagram. * ! * @author Peter Hirzel <i>soft</i>Environment * @version $Revision$ $Date$ */ *************** *** 40,44 **** * Create a new instance of ClassFigure with a RectangleFigure as presentation figure */ ! public ServiceFigure(DependencyView diagram, Object element) { super(diagram, new RectangleFigure(), element); defineComposite(0); --- 40,44 ---- * Create a new instance of ClassFigure with a RectangleFigure as presentation figure */ ! public ServiceFigure(DependencyView diagram, Object element) throws Throwable { super(diagram, new RectangleFigure(), element); defineComposite(0); *************** *** 66,70 **** /** * Add individual PopupMenu items for this class. ! * @see createPopupMenu() */ protected void addSpecialMenu(javax.swing.JPopupMenu popupMenu) { --- 66,70 ---- /** * Add individual PopupMenu items for this class. ! * @see #createPopupMenu() */ protected void addSpecialMenu(javax.swing.JPopupMenu popupMenu) { |