svn commit: r17292 - trunk/src/argouml-app/src/org/argouml/uml/diagram: static_structure/ui ui

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-08-23 22:46:51-0700
New Revision: 17292

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineText.java

Log:
Honour the linewidth in the size calculation.

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=17292&r1=17291&r2=17292
==============================================================================
--- 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	2009-08-23 22:46:51-0700
@@ -359,7 +359,7 @@
         aSize.width += indentX + 1; 
 
         // we want at least some of the package body to be displayed
-        aSize.height += 30;
+        aSize.height += 28 + 2 * getLineWidth();
 
         // And now aSize has the answer
         return aSize;

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineText.java?view=diff&pathrev=17292&r1=17291&r2=17292
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineText.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineText.java	2009-08-23 22:46:51-0700
@@ -136,6 +136,11 @@
         addModelListener();
     }
     
+    /**
+     * TODO: This function attempts to optimize the more generic 
+     * code in the parent, which also works correctly in this case. 
+     * Is this a good idea?
+     */
     @Override
     public Dimension getMinimumSize() {
         Dimension d = new Dimension();
@@ -153,8 +158,15 @@
             maxH = getFontMetrics().getHeight();
             maxW = getFontMetrics().stringWidth(getText());
         }
-        int overallH = (maxH + getTopMargin() + getBotMargin());
-        int overallW = maxW + getLeftMargin() + getRightMargin();
+
+        /* Now force minimum dimensions for the text: */
+        maxW = Math.max(maxW, MIN_TEXT_WIDTH);
+
+        /* Now add the areas around the text to return the complete size: */
+        int overallH = maxH + getTopMargin() + getBotMargin()
+            + 2 * getLineWidth();
+        int overallW = maxW + getLeftMargin() + getRightMargin()
+            + 2 * getLineWidth();
         d.width = overallW;
         d.height = overallH;
         return d;

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2386636

To unsubscribe from this discussion, e-mail: [[email protected]].
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.