svn commit: r17373 - trunk/src/argouml-app/src/org/argouml/uml/diagram: ui use_case/ui
Michiel van der Wulp <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mvw
Date: 2009-10-06 11:00:49-0700
New Revision: 17373
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEditableCompartment.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java
Log:
Restore the use case extension point separator line length to the full length, so that it touches the ellipse.
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java?view=diff&pathrev=17373&r1=17372&r2=17373
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java 2009-10-06 11:00:49-0700
@@ -327,11 +327,13 @@
compartmentHeight += (requestedHeight - neededHeight)
/ getVisibleCompartmentCount();
}
- c.setBounds(
- box.x,
- box.y + currentHeight,
- box.width,
- compartmentHeight);
+ setCompartmentBounds(c,
+ new Rectangle(
+ box.x,
+ box.y + currentHeight,
+ box.width,
+ compartmentHeight),
+ new Rectangle(x, y, newW, newH));
currentHeight += compartmentHeight;
}
}
@@ -359,6 +361,18 @@
firePropChange("bounds", oldBounds, getBounds());
}
+ /**
+ * Set the bounds of the compartment.
+ *
+ * @param c the compartment
+ * @param cb the new compartment bounds
+ * @param ob the new outside fig bounds
+ */
+ protected void setCompartmentBounds(FigCompartment c,
+ Rectangle cb, Rectangle ob) {
+ c.setBounds(cb.x, cb.y, cb.width, cb.height);
+ }
+
/*
* @see org.tigris.gef.presentation.Fig#translate(int, int)
*/
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEditableCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEditableCompartment.java?view=diff&pathrev=17373&r1=17372&r2=17373
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEditableCompartment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEditableCompartment.java 2009-10-06 11:00:49-0700
@@ -61,9 +61,17 @@
private static final int MIN_HEIGHT = FigNodeModelElement.NAME_FIG_HEIGHT;
+ /**
+ * A separator line that has the same width as the compartment.
+ */
private FigSeparator compartmentSeparator;
/**
+ * A separator line that may be wider than the compartment.
+ */
+ private Fig externalSeparatorFig = null;
+
+ /**
* The constructor. <p>
*
* Two figs are added to this FigGroup:
@@ -132,6 +140,9 @@
return;
}
super.setVisible(visible);
+ if (externalSeparatorFig != null) {
+ externalSeparatorFig.setVisible(visible);
+ }
if (visible) {
populate();
} else {
@@ -375,8 +386,15 @@
public void setLineColor(Color col) {
super.setLineColor(col);
if (col != null) {
- compartmentSeparator.setFillColor(col);
+
compartmentSeparator.setFilled(true);
+ if (externalSeparatorFig != null) {
+ externalSeparatorFig.setFillColor(col);
+ externalSeparatorFig.setFilled(true);
+ compartmentSeparator.setFillColor(null);
+ } else {
+ compartmentSeparator.setFillColor(col);
+ }
}
}
@@ -384,22 +402,57 @@
public void setLineWidth(int w) {
super.setLineWidth(0);
compartmentSeparator.setHeight(w);
+ if (externalSeparatorFig != null) {
+ externalSeparatorFig.setHeight(w);
+ }
}
@Override
public void setFillColor(Color col) {
super.setFillColor(col);
- compartmentSeparator.setFillColor(getLineColor());
+
compartmentSeparator.setFilled(true);
+ if (externalSeparatorFig != null) {
+ externalSeparatorFig.setFillColor(getLineColor());
+ externalSeparatorFig.setFilled(true);
+ compartmentSeparator.setFillColor(null);
+ } else {
+ compartmentSeparator.setFillColor(getLineColor());
+ }
}
@Override
public void setFilled(boolean f) {
super.setFilled(f);
compartmentSeparator.setFilled(true);
+ if (externalSeparatorFig != null) {
+ externalSeparatorFig.setFilled(true);
+ }
}
/**
+ * Set new bounds for the external separator line (if it exists).
+ *
+ * @param r the new bounds
+ */
+ public void setExternalSeparatorFigBounds(Rectangle r) {
+ if (externalSeparatorFig != null) {
+ externalSeparatorFig.setBounds(r);
+ }
+ }
+
+ /**
+ * Create an external Fig as separator line.
+ *
+ * @return the separator Fig
+ */
+ public Fig makeExternalSeparatorFig() {
+ assert externalSeparatorFig == null;
+ externalSeparatorFig = new FigSeparator(X0, Y0, 11, LINE_WIDTH);
+ return externalSeparatorFig;
+ }
+
+ /**
* Fig representing a horizontal line separator for compartment. <p>
*
* This is a horizontal line, but implemented as a rectangle
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java?view=diff&pathrev=17373&r1=17372&r2=17373
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java 2009-10-06 11:00:49-0700
@@ -45,7 +45,9 @@
import org.argouml.uml.diagram.ui.ActionAddExtensionPoint;
import org.argouml.uml.diagram.ui.ActionAddNote;
import org.argouml.uml.diagram.ui.ActionCompartmentDisplay;
+import org.argouml.uml.diagram.ui.FigCompartment;
import org.argouml.uml.diagram.ui.FigCompartmentBox;
+import org.argouml.uml.diagram.ui.FigEditableCompartment;
import org.argouml.uml.diagram.ui.FigExtensionPointsCompartment;
import org.tigris.gef.base.Selection;
import org.tigris.gef.presentation.Fig;
@@ -116,7 +118,7 @@
* The Fig for the extensionPoints compartment (if any).
*/
private FigExtensionPointsCompartment extensionPointsFigCompartment;
-
+
/**
* Initialization which is common to multiple constructors.<p>
*
@@ -126,15 +128,18 @@
private void initialize(Rectangle bounds) {
enableSizeChecking(false);
setSuppressCalcBounds(true);
- // Create all the things we need
-
- // First the main port ellipse and the cover of identical size that
- // will realize it.
-// setBigPort(new FigMyCircle(0, 0, 100, 60));
- // repeat this from the parent, since we now have a different bigPort:
-// getBigPort().setLineWidth(0);
- /* The bigPort draws the background color: */
-// getBigPort().setFillColor(FILL_COLOR);
+
+ FigExtensionPointsCompartment epc =
+ /* Side effect: This creates the fig: */
+ getExtensionPointsCompartment();
+
+ /*
+ * A use case has an external separator.
+ * External means external to the compartment box.
+ * This horizontal line sticks out of the box,
+ * and touches the ellipse edge.
+ */
+ Fig separatorFig = epc.makeExternalSeparatorFig();
/* TODO: This next line prevent loading a UseCase
* with a stereotype to grow. Why? */
@@ -145,8 +150,8 @@
addFig(getNameFig());
// stereotype fig covers the name fig:
addFig(getStereotypeFig());
- // Side effect: This creates the fig:
- addFig(getExtensionPointsCompartment());
+ addFig(epc);
+ addFig(separatorFig);
addFig(getBorderFig());
// Make all the parts match the main fig
@@ -365,6 +370,24 @@
containerBox.height);
}
+ @Override
+ protected void setCompartmentBounds(FigCompartment c,
+ Rectangle cb, Rectangle ob) {
+ Rectangle r = new Rectangle();
+ r.y = cb.y;
+ r.height = getLineWidth();
+ r.width = (int) (2.0 * (calcX(
+ ob.width / 2.0,
+ ob.height / 2.0,
+ ob.height / 2.0 - (cb.y - ob.y))));
+ r.x = cb.x + cb.width / 2 - r.width / 2;
+
+ if (c instanceof FigEditableCompartment) {
+ ((FigEditableCompartment) c).setExternalSeparatorFigBounds(r);
+ }
+ c.setBounds(cb.x, cb.y, cb.width, cb.height);
+ }
+
/**
* Private utility routine to work out the (positive) x coordinate of a
* point on an oval, given the radii and y coordinate.<p>
@@ -385,9 +408,9 @@
/**
* Set the line colour for the use case oval.<p>
*
- * This involves setting the <code>cover</code> oval, not the bigPort.
- * Calling the super method would cause all FigGroup elements
- * to follow suit - which is not wanted.
+ * This involves setting the line color of all the figs, but not the bigPort.
+ * Calling the super method causes all FigGroup elements
+ * to follow suit - which is not wanted for the bigPort and the separator.
*
* @param col The colour desired.
*/
@@ -396,13 +419,18 @@
super.setLineColor(col);
getBigPort().setLineColor(null);
}
+
+ @Override
+ public void setLineWidth(int w) {
+ super.setLineWidth(w);
+ }
/**
* Set the fill colour for the use case oval.<p>
*
- * This involves setting the <code>cover</code> oval, not the bigPort.
+ * This involves setting the fill color of all figs, but not the bigPort.
* Calling the super method would cause all FigGroup elements
- * to follow suit - which is not wanted.
+ * to follow suit - which is not wanted for the bigPort nor the separator.
*
* @param col The colour desired.
*/
@@ -415,7 +443,7 @@
/**
* Set whether the use case oval is to be filled.<p>
*
- * This involves setting the <code>cover</code> oval, not the bigPort.<p>
+ * This involves making all figs filled, but not the bigPort.<p>
* Calling the super method would cause all FigGroup elements
* to be filled, too - which is not wanted for e.g. the stereotype figs.
* See issue 5581.
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2404238
To unsubscribe from this discussion, e-mail: [[email protected]].