Author: tfmorris
Date: 2007-05-27 22:51:23-0700
New Revision: 12699
Modified:
trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java
trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java
trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java
trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java
trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java
Log:
Minor cleanups.
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java?view=diff&rev=12699&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java&r1=12698&r2=12699
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramAssociationEdge.java 2007-05-27 22:51:23-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -28,6 +28,7 @@
import org.tigris.gef.presentation.FigEdge;
import org.tigris.gef.presentation.FigNode;
+import org.tigris.gef.presentation.FigPoly;
/**
*
@@ -44,6 +45,11 @@
super(edge);
}
+ /**
+ * Size of self association edges.
+ */
+ private final static int SELF_SIZE = 30;
+
/*
* @see org.argouml.uml.diagram.layout.LayoutedEdge#layout()
*/
@@ -56,19 +62,19 @@
if (getDestFigNode() == getSourceFigNode()) {
Point centerRight = getCenterRight((FigNode) getSourceFigNode());
int yoffset = getSourceFigNode().getHeight() / 2;
- yoffset = java.lang.Math.min(30, yoffset);
- getUnderlyingFig().addPoint(centerRight);
+ yoffset = java.lang.Math.min(SELF_SIZE, yoffset);
+ FigPoly fig = getUnderlyingFig();
+ fig.addPoint(centerRight);
// move more right
- getUnderlyingFig().addPoint(centerRight.x + 30, centerRight.y);
+ fig.addPoint(centerRight.x + SELF_SIZE, centerRight.y);
// move down
- getUnderlyingFig().addPoint(centerRight.x + 30,
- centerRight.y + yoffset);
+ fig.addPoint(centerRight.x + SELF_SIZE, centerRight.y + yoffset);
// move left
- getUnderlyingFig().addPoint(centerRight.x, centerRight.y + yoffset);
+ fig.addPoint(centerRight.x, centerRight.y + yoffset);
- getUnderlyingFig().setFilled(false);
- getUnderlyingFig().setSelfLoop(true);
- getCurrentEdge().setFig(getUnderlyingFig());
+ fig.setFilled(false);
+ fig.setSelfLoop(true);
+ getCurrentEdge().setFig(fig);
}
/* else {
// brute force rectangular layout
@@ -90,9 +96,11 @@
}
/**
- * Return a point which is just right of the center.
- *
- * @param fig The fig.
+ * Return a point which is centered vertically on the right hand edge of the
+ * figure.
+ *
+ * @param fig
+ * The fig.
* @return A Point.
*/
private Point getCenterRight(FigNode fig) {
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java?view=diff&rev=12699&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java&r1=12698&r2=12699
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramEdge.java 2007-05-27 22:51:23-0700
@@ -24,8 +24,10 @@
package org.argouml.uml.diagram.static_structure.layout;
-import org.argouml.uml.diagram.layout.*;
-import org.tigris.gef.presentation.*;
+import org.argouml.uml.diagram.layout.LayoutedEdge;
+import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.FigEdge;
+import org.tigris.gef.presentation.FigPoly;
/** This class is an abstract implementation of all edges which are
* layoutable in the classdiagram.
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java?view=diff&rev=12699&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java&r1=12698&r2=12699
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramGeneralizationEdge.java 2007-05-27 22:51:23-0700
@@ -24,7 +24,7 @@
package org.argouml.uml.diagram.static_structure.layout;
-import org.tigris.gef.presentation.*;
+import org.tigris.gef.presentation.FigEdge;
/**
*
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java?view=diff&rev=12699&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java&r1=12698&r2=12699
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramNote.java 2007-05-27 22:51:23-0700
@@ -52,6 +52,7 @@
/*
* @see org.argouml.uml.diagram.static_structure.layout.ClassdiagramNode#calculateWeight()
*/
+ @Override
public float calculateWeight() {
setWeight(getWeight());
return getWeight();
@@ -60,6 +61,7 @@
/*
* @see org.argouml.uml.diagram.static_structure.layout.ClassdiagramNode#getRank()
*/
+ @Override
public int getRank() {
return first() == null ? 0 : first().getRank();
}
@@ -67,6 +69,7 @@
/*
* @see org.argouml.uml.diagram.static_structure.layout.ClassdiagramNode#getWeight()
*/
+ @Override
public float getWeight() {
return first() == null ? 0 : first().getWeight() * 0.9999999f;
}
@@ -74,6 +77,7 @@
/*
* @see org.argouml.uml.diagram.static_structure.layout.ClassdiagramNode#isStandalone()
*/
+ @Override
public boolean isStandalone() {
return first() == null ? true : first().isStandalone();
}
@@ -84,7 +88,6 @@
* @return A ClassdiagramNode.
*/
private ClassdiagramNode first() {
- return getUplinks().isEmpty() ? null : (ClassdiagramNode) getUplinks()
- .firstElement();
+ return getUpNodes().isEmpty() ? null : getUpNodes().get(0);
}
}
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java?view=diff&rev=12699&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java&r1=12698&r2=12699
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/layout/ClassdiagramRealizationEdge.java 2007-05-27 22:51:23-0700
@@ -24,7 +24,7 @@
package org.argouml.uml.diagram.static_structure.layout;
-import org.tigris.gef.presentation.*;
+import org.tigris.gef.presentation.FigEdge;
/**
*
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.