Author: bobtarling Date: 2011-03-24 03:59:11-0700 New Revision: 19123 Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java
Log: Get the aggregation kind from the opposite end in UML2 Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java?view=diff&pathrev=19123&r1=19122&r2=19123 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java 2011-03-24 03:59:11-0700 @@ -930,7 +930,7 @@ void determineArrowHead() { assert getOwner() != null; - Object ak = Model.getFacade().getAggregation(getOwner()); + final Object ak = getAggregateKind(); boolean nav = Model.getFacade().isNavigable(getOwner()); if (nav) { @@ -959,6 +959,28 @@ } /** + * Get the aggregation kind to display at this end + * @return the aggregation kind or null if this is not a binary association + */ + private Object getAggregateKind() { + if (Model.getFacade().getUmlVersion().charAt(0) == '1') { + return Model.getFacade().getAggregation(getOwner()); + } + Object ass = Model.getFacade().getAssociation(getOwner()); + Collection ends = Model.getFacade().getConnections(ass); + if (ends.size() != 2) { + return null; + } + Iterator it = ends.iterator(); + Object aggEnd = it.next(); + if (aggEnd != getOwner()) { + return Model.getFacade().getAggregation(aggEnd); + } else { + return Model.getFacade().getAggregation(it.next()); + } + } + + /** * @return the current arrow type of this end of the association */ public int getArrowType() { ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2713778 To unsubscribe from this discussion, e-mail: [[email protected]].
