svn commit: r12958 - trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-07-02 10:06:08-0700
New Revision: 12958

Modified:
   trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java

Log:
Remove dependency cycle through org.argouml.ui.cmd and org.argouml.uml.diagram.xxxx.ui.

See also issue 4798. 

This reduces ArgoUML functionality by not allowing "Arrange->Size To Fit Contents" on Figs that enclose something, until issue 4798 is solved.

Modified: trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java?view=diff&rev=12958&p1=trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java&p2=trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java&r1=12957&r2=12958
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java	(original)
+++ trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java	2007-07-02 10:06:08-0700
@@ -27,11 +27,8 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Vector;
-import org.argouml.i18n.Translator;
-import org.argouml.uml.diagram.state.ui.FigCompositeState;
-import org.argouml.uml.diagram.static_structure.ui.FigPackage;
-
 
+import org.argouml.i18n.Translator;
 import org.tigris.gef.base.Cmd;
 import org.tigris.gef.base.Editor;
 import org.tigris.gef.base.Globals;
@@ -41,7 +38,9 @@
 
 /**
  * A command to set selected figs to their minimum size. <p>
- * Despite its name, really the minimum size is selected here! 
+ * Despite its name, really the minimum size is selected here! <p>
+ * 
+ * TODO: Rename this class.
  *
  * @author Markus Klink
  */
@@ -49,8 +48,9 @@
 
     /**
      * Constant to indicate command should set preferred size of Fig.
-     * @deprecated by mvw for 0.24.alpha3
+     * @deprecated by mvw for 0.24.alpha3. Nobody uses this...
      */
+    @Deprecated
     public static final int PREFERRED_SIZE = 0;
 
     /** constant for MINIMUM_SIZE */
@@ -67,9 +67,12 @@
     
     /**
      * Constructor for the command.
+     * @deprecated by MVW in V0.25.3. 
+     * Use the constructor without params instead.
      *
      * @param theMode one of the defined constants
      */
+    @Deprecated
     public CmdSetPreferredSize(int theMode) {
 //        super(Translator.localize("action.size-to-fit-contents"));
 	super(Translator.localize("action.set-" + wordFor(theMode) + "-size"));
@@ -132,10 +135,13 @@
 
         for (int i = 0; i < size; i++) {
             Fig fi = (Fig) figs.get(i);
-            // only resize elements which the user would also be able
-            // to resize.
-            if (fi.isResizable() && (!((fi instanceof FigPackage)
-		                     || (fi instanceof FigCompositeState)))) {
+            /* Only resize elements which the user would also be able
+             * to resize: */
+            if (fi.isResizable() 
+                    /* But exclude elements that enclose others, 
+                     * since their algorithms to calculate the minimum size 
+                     * does not take enclosed objects into account: */
+                    && (fi.getEnclosedFigs().size() == 0)) {
                 if (mode == PREFERRED_SIZE) {
                     fi.setSize(fi.getPreferredSize());
                 } else {
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.