svn commit: r17293 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2009-08-24 16:13:43-0700
New Revision: 17293
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java
Log:
Begin to separate the build of association end Figs out of the constructor
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=17293&r1=17292&r2=17293
==============================================================================
--- 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 2009-08-24 16:13:43-0700
@@ -64,12 +64,16 @@
/**
* Group for the FigTexts concerning the source association end.
*/
+ // TODO: Create a seperate innerclass containing these two Figs
private FigAssociationEndAnnotation srcGroup;
+ private FigMultiplicity srcMult;
/**
* Group for the FigTexts concerning the dest association end.
*/
+ // TODO: Create a seperate innerclass containing these two Figs
private FigAssociationEndAnnotation destGroup;
+ private FigMultiplicity destMult;
/**
* Group for the FigTexts concerning the name and stereotype of the
@@ -77,8 +81,6 @@
*/
private FigTextGroup middleGroup;
- private FigMultiplicity srcMult;
- private FigMultiplicity destMult;
/**
* Constructor used by PGML parser.
@@ -91,34 +93,85 @@
createNameLabel(owner, settings);
- Object[] ends = // UML objects of AssociationEnd type
+ createEndFigs(owner, settings);
+
+ setBetweenNearestPoints(true);
+
+ initializeNotationProvidersInternal(owner);
+ }
+
+
+ private void createEndFigs(
+ final Object owner,
+ final DiagramSettings settings) {
+ final Object[] ends = // UML objects of AssociationEnd type
Model.getFacade().getConnections(owner).toArray();
- srcMult = new FigMultiplicity(ends[0], settings);
+ createSourceEnd(ends[0], settings, 0, 5, 135, 5);
+ createDestEnd(ends[1], settings, 100, -5, 45, 5);
+ }
+
+
+ // TODO createSourceEnd and createDestEnd are almost identical.
+ // They could be replaced with a single method that returns some
+ // composite object made up of the group and multiplicty Figs
+ private void createSourceEnd(
+ final Object endOwner,
+ final DiagramSettings settings,
+ final int percentPostionOnLine,
+ final int pathDelta,
+ final int displacementAngle,
+ final int displacementDistance) {
+ srcMult = new FigMultiplicity(endOwner, settings);
addPathItem(srcMult,
- new PathItemPlacement(this, srcMult, 0, 5, 135, 5));
- ArgoFigUtil.markPosition(this, 0, 5, 135, 5, Color.green);
+ new PathItemPlacement(this, srcMult,
+ percentPostionOnLine, pathDelta,
+ displacementAngle, displacementDistance));
+ ArgoFigUtil.markPosition(
+ this, percentPostionOnLine, pathDelta,
+ displacementAngle, displacementDistance, Color.green);
- srcGroup = new FigAssociationEndAnnotation(this, ends[0], settings);
+ srcGroup = new FigAssociationEndAnnotation(this, endOwner, settings);
addPathItem(srcGroup,
- new PathItemPlacement(this, srcGroup, 0, 5, -135, 5));
- ArgoFigUtil.markPosition(this, 0, 5, -135, 5, Color.blue);
-
- destMult = new FigMultiplicity(ends[1], settings);
+ new PathItemPlacement(this, srcGroup,
+ percentPostionOnLine, pathDelta,
+ -displacementAngle, displacementDistance));
+ ArgoFigUtil.markPosition(
+ this, percentPostionOnLine, pathDelta,
+ -displacementAngle, displacementDistance, Color.blue);
+ }
+
+ // TODO createSourceEnd and createDestEnd are almost identical.
+ // They could be replaced with a single method that returns some
+ // composite object made up of the group and multiplicty Figs
+ private void createDestEnd(
+ final Object endOwner,
+ final DiagramSettings settings,
+ final int percentPostionOnLine,
+ final int pathDelta,
+ final int displacementAngle,
+ final int displacementDistance) {
+ destMult = new FigMultiplicity(endOwner, settings);
addPathItem(destMult,
- new PathItemPlacement(this, destMult, 100, -5, 45, 5));
- ArgoFigUtil.markPosition(this, 100, -5, 45, 5, Color.red);
+ new PathItemPlacement(
+ this, destMult,
+ percentPostionOnLine, pathDelta,
+ displacementAngle, displacementDistance));
+ ArgoFigUtil.markPosition(
+ this, percentPostionOnLine, pathDelta,
+ displacementAngle, displacementDistance, Color.red);
- destGroup = new FigAssociationEndAnnotation(this, ends[1], settings);
+ destGroup = new FigAssociationEndAnnotation(this, endOwner, settings);
addPathItem(destGroup,
- new PathItemPlacement(this, destGroup, 100, -5, -45, 5));
- ArgoFigUtil.markPosition(this, 100, -5, -45, 5, Color.orange);
-
- setBetweenNearestPoints(true);
-
- initializeNotationProvidersInternal(owner);
+ new PathItemPlacement(
+ this, destGroup, percentPostionOnLine, pathDelta,
+ -displacementAngle, displacementDistance));
+ ArgoFigUtil.markPosition(
+ this, percentPostionOnLine, pathDelta,
+ -displacementAngle, displacementDistance, Color.orange);
}
+
/**
* Create the main draggable label for the association.
* This can be overridden in subclasses to change behaviour.
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2386864
To unsubscribe from this discussion, e-mail: [[email protected]].