svn commit: r17306 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateAssociation.java
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2009-09-02 13:40:09-0700
New Revision: 17306
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateAssociation.java
Log:
Make sure point[0] is at source end of drawing and point[n] is at destination end.
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateAssociation.java?view=diff&pathrev=17306&r1=17305&r2=17306
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateAssociation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ModeCreateAssociation.java 2009-09-02 13:40:09-0700
@@ -25,8 +25,13 @@
package org.argouml.uml.diagram.ui;
import java.awt.Color;
+import java.awt.Point;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import org.argouml.model.IllegalModelElementConnectionException;
import org.argouml.model.Model;
@@ -85,37 +90,20 @@
Layer lay = editor.getLayerManager().getActiveLayer();
FigAssociation fe = (FigAssociation) lay.presentationFor(getNewEdge());
_newItem.setLineColor(Color.black);
- fe.setFig(_newItem);
-// boolean flip = false;
-//
-// final Iterator iter =
-// Model.getFacade().getConnections(association).iterator();
-//
-// Object sourceAssociationEnd = iter.next();
-// Object destAssociationEnd = iter.next();
-//
-// if (getArg("unidirectional").equals(Boolean.TRUE)) {
-// if (!Model.getFacade().isNavigable(destAssociationEnd)) {
-// flip = true;
-// }
-// } else if (!getArg("aggregation").equals(Model.getAggregationKind().getNone())) {
-// if (Model.getFacade().getAggregation(destAssociationEnd).equals(
-// getArg("aggregation"))) {
-// flip = true;
-// }
-// }
-// if (flip) {
-// fe.setDestPortFig(getStartPortFig());
-// fe.setDestFigNode(getSourceFigNode());
-// fe.setSourcePortFig(destFigNode);
-// fe.setSourceFigNode((FigNode) destFigNode);
-// } else {
-// fe.setSourcePortFig(getStartPortFig());
-// fe.setSourceFigNode(getSourceFigNode());
-// fe.setDestPortFig(destFigNode);
-// fe.setDestFigNode((FigNode) destFigNode);
-// }
+ // With MDR (UML1.4) we know that when creating an association the
+ // first association end returned by that association is the source
+ // from which we are drawing. In eUML (UML2.x) the opposite seems to
+ // be true so we need to reverse the way the edge has been drawn.
+ if (Model.getFacade().getUmlVersion().startsWith("2")) {
+ List<Point> pointList = Arrays.asList(_newItem.getPoints());
+ Collections.reverse(pointList);
+ Point[] points = new Point[pointList.size()];
+ pointList.toArray(points);
+ _newItem.setPoints(points);
+ }
+
+ fe.setFig(_newItem);
return fe;
} else {
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2390425
To unsubscribe from this discussion, e-mail: [[email protected]].