svn commit: r15971 - trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2008-11-06 13:56:52-0800
New Revision: 15971

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java

Log:
Fixed the problem that the fig height increases when you make the stereotype name longer.

Similar to several old issues, e.g. issue 5160, 3157.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java?view=diff&rev=15971&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java&r1=15970&r2=15971
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java	2008-11-06 13:56:52-0800
@@ -82,10 +82,6 @@
      * rectangle.<p>
      */
     public FigClassifierRole() {
-	// TODO: I (Linus Tolke) don't understand why I get a warning
-	// on the 'cover' link in the javadoc (jdk1.4.2). I think everything
-	// is correct. I hope that we can eventually solve it.
-
         // The big port and cover. Color of the big port is irrelevant
 
         setBigPort(new FigRect(10, 10, 90, 50, Color.cyan, Color.cyan));
@@ -301,7 +297,7 @@
 
         Dimension newMin    = new Dimension(nameMin.width, nameMin.height);
 
-        if (getStereotypeFig().isVisible()) {
+        if (!(stereoMin.height == 0 && stereoMin.width == 0)) {
             newMin.width   = Math.max(newMin.width, stereoMin.width);
             newMin.height += stereoMin.height;
         }
@@ -356,17 +352,13 @@
         // Work out the padding each side, depending on whether the stereotype
         // is displayed and set bounds accordingly
 
-        if (getStereotypeFig().isVisible()) {
-            int extraEach = (h - nameMin.height - stereoMin.height) / 2;
-
-            getStereotypeFig().setBounds(x, y + extraEach, w, stereoMin.height);
-            getNameFig().setBounds(x, y + stereoMin.height + extraEach, w,
-				   nameMin.height);
-        } else {
-            int extraEach = (h - nameMin.height) / 2;
-
-            getNameFig().setBounds(x, y + extraEach, w, nameMin.height);
+        int extraEach = (newH - nameMin.height - stereoMin.height) / 2;
+        if (!(stereoMin.height == 0 && stereoMin.width == 0)) {
+            /* At least one stereotype is visible */
+            getStereotypeFig().setBounds(x, y + extraEach, newW, getStereotypeFig().getHeight());
         }
+        getNameFig().setBounds(x, y + stereoMin.height + extraEach, newW,
+                nameMin.height);
 
         // Set the bounds of the bigPort and cover
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.