svn commit: r16395 - trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
Michiel van der Wulp <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mvw
Date: 2008-12-20 23:27:50-0800
New Revision: 16395
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
Log:
Fix the current loss of a border around the top of the fig of a package showing stereotypes.
Did an old to do.
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java?view=diff&pathrev=16395&r1=16394&r2=16395
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java 2008-12-20 23:27:50-0800
@@ -71,9 +71,15 @@
* consisting of a "tab" and a "body". <p>
*
* The tab of the Package Fig is build of 2 pieces:
- * the stereotypes at the top, and the name below it.
- * Both are not transparent, and have a line border.
- * And there is a blinder for the line in the middle. <p>
+ * the stereotypes at the top, and the name below it. <p>
+ *
+ * The name box covers the whole tab, i.e. its size
+ * is always equal to the total size of the tab.
+ * It is not transparent, and has a line border.
+ * Its text sits at the bottom of the fig, to leave room for stereotypes. <p>
+ *
+ * The stereotype fig is transparent, and sits at the top
+ * inside the name fig. It is drawn on top of the name fig box. <p>
*
* The tab of the Package Fig can only be resized by the user horizontally.
* The body can be resized horizontally and vertically by the user. <p>
@@ -131,12 +137,6 @@
private boolean visibilityVisible;
/**
- * A rectangle to blank out the line that would otherwise appear at the
- * bottom of the stereotype text box.
- */
- private FigRect stereoLineBlinder;
-
- /**
* The main constructor.
*
* @param node the UML package
@@ -171,32 +171,16 @@
getBigPort().setFilled(false);
getBigPort().setLineWidth(0);
- // Set properties of the stereotype box. Make it 1 pixel higher than
- // before, so it overlaps the name box, and the blanking takes out both
- // lines. Initially not set to be displayed, but this will be changed
+ // Set properties of the stereotype box.
+ // Initially not set to be displayed, but this will be changed
// when we try to render it, if we find we have a stereotype.
- getStereotypeFig().setFilled(true);
- getStereotypeFig().setLineWidth(1);
- getStereotypeFig().setHeight(STEREOHEIGHT + 1);
getStereotypeFig().setVisible(false);
- // A thin rectangle to overlap the boundary line between stereotype
- // and name. This is just 2 pixels high, and we rely on the line
- // thickness, so the rectangle does not need to be filled. Whether to
- // display is linked to whether to display the stereotype.
-
- // TODO: Do we really still need this? - Bob
- stereoLineBlinder = new FigRect(X0 + 1, Y0 + STEREOHEIGHT, WIDTH - 2,
- 2, Color.white, Color.white);
- stereoLineBlinder.setLineWidth(1);
- stereoLineBlinder.setVisible(false);
-
// add Figs to the FigNode in back-to-front order
addFig(getBigPort());
- addFig(getStereotypeFig());
addFig(getNameFig());
- addFig(stereoLineBlinder);
+ addFig(getStereotypeFig());
addFig(body);
setBlinkPorts(false); //make port invisible unless mouse enters
@@ -206,9 +190,7 @@
setFillColor(Color.white);
setLineColor(Color.black);
setLineWidth(1);
-
-// setLocation(x, y);
-
+
// TODO: Why do we need to do this? - Bob
setBounds(getBounds());
@@ -275,9 +257,6 @@
Iterator thisIter = this.getFigs().iterator();
while (thisIter.hasNext()) {
Fig thisFig = (Fig) thisIter.next();
- if (thisFig == stereoLineBlinder) {
- figClone.stereoLineBlinder = (FigRect) thisFig;
- }
if (thisFig == body) {
figClone.body = (FigText) thisFig;
}
@@ -292,10 +271,9 @@
@Override
public void setLineColor(Color col) {
super.setLineColor(col);
- getStereotypeFig().setLineColor(col);
+ getStereotypeFig().setLineColor(null);
getNameFig().setLineColor(col);
body.setLineColor(col);
- stereoLineBlinder.setLineColor(stereoLineBlinder.getFillColor());
}
/*
@@ -312,10 +290,9 @@
@Override
public void setFillColor(Color col) {
super.setFillColor(col);
- getStereotypeFig().setFillColor(col);
+ getStereotypeFig().setFillColor(null);
getNameFig().setFillColor(col);
body.setFillColor(col);
- stereoLineBlinder.setLineColor(col);
}
/*
@@ -331,7 +308,7 @@
*/
@Override
public void setFilled(boolean f) {
- getStereotypeFig().setFilled(f);
+ getStereotypeFig().setFilled(false);
getNameFig().setFilled(f);
body.setFilled(f);
}
@@ -347,6 +324,7 @@
*/
@Override
public void setLineWidth(int w) {
+ // There are 2 boxes showing lines: the tab and the body.
getNameFig().setLineWidth(w);
body.setLineWidth(w);
}
@@ -375,7 +353,7 @@
/* check if any stereotype is defined */
if (Model.getFacade().getStereotypes(modelElement).isEmpty()) {
if (getStereotypeFig().isVisible()) {
- stereoLineBlinder.setVisible(false);
+ getNameFig().setTopMargin(0);
getStereotypeFig().setVisible(false);
}
} else {
@@ -383,11 +361,11 @@
/* This populates the stereotypes area: */
getStereotypeFig().setOwner(getOwner());
if (!stereotypeVisible) {
- stereoLineBlinder.setVisible(false);
+ getNameFig().setTopMargin(0);
getStereotypeFig().setVisible(false);
} else if (!getStereotypeFig().isVisible()) {
if (stereotypeVisible) {
- stereoLineBlinder.setVisible(true);
+ getNameFig().setTopMargin(50); //TODO: Calc the right nr
getStereotypeFig().setVisible(true);
}
}
@@ -431,12 +409,11 @@
aSize.width = Math.max(aSize.width, MIN_WIDTH);
// If we have any number of stereotypes displayed, then allow
- // some space for that (width and height):
+ // some space for that (only width, height is included in nameFig):
if (stereotypeVisible) {
Dimension st = getStereotypeFig().getMinimumSize();
aSize.width =
Math.max(aSize.width, st.width);
- aSize.height += STEREOHEIGHT + st.height;
}
// take into account the tab is not as wide as the body:
@@ -503,24 +480,22 @@
if (stereotypeVisible) {
Dimension stereoMin = getStereotypeFig().getMinimumSize();
- currentY += stereoMin.height;
+ getNameFig().setTopMargin(stereoMin.height);
+ getNameFig().setBounds(xa, currentY, tabWidth + 1, minNameHeight);
+
getStereotypeFig().setBounds(xa, ya,
tabWidth, stereoMin.height + 1);
if (tabWidth < stereoMin.width + 1) {
tabWidth = stereoMin.width + 2;
}
- stereoLineBlinder.setBounds(
- xa + 1,
- ya + stereoMin.height,
- tabWidth - 2,
- 2);
+ } else {
+ getNameFig().setBounds(xa, currentY, tabWidth + 1, minNameHeight);
}
- getNameFig().setBounds(xa, currentY, tabWidth + 1, minNameHeight);
-
+
// Advance currentY to where the start of the body box is,
// remembering that it overlaps the next box by 1 pixel. Calculate the
- // size of the attribute box, and update the Y pointer past it if it is
+ // size of the body box, and update the Y pointer past it if it is
// displayed.
currentY += minNameHeight - 1; // -1 for 1 pixel overlap
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=988730
To unsubscribe from this discussion, e-mail: [[email protected]].