svn commit: r15167 - trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-07-05 05:50:11-0700
New Revision: 15167

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java

Log:
Issue 5071: Order the return of encloseFigs helps towards this bug. Needs further testing to determine if this is a full fix.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java?view=diff&rev=15167&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java&r1=15166&r2=15167
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigCompositeState.java	2008-07-05 05:50:11-0700
@@ -31,6 +31,7 @@
 import java.beans.PropertyChangeEvent;
 import java.util.Iterator;
 import java.util.List;
+import java.util.TreeMap;
 import java.util.Vector;
 
 import org.argouml.model.Model;
@@ -159,7 +160,6 @@
         Dimension nameDim = getNameFig().getMinimumSize();
         List regionsList = getEnclosedFigs();
 
-
         /* If it is concurrent and contains concurrent regions,
         the bottom region has a minimum height*/
         if (getOwner() != null) {
@@ -167,8 +167,8 @@
                     && !regionsList.isEmpty()
                     && regionsList.get(regionsList.size() - 1)
                         instanceof FigConcurrentRegion) {
-                FigConcurrentRegion f = ((FigConcurrentRegion) regionsList
-                        .get(regionsList.size() - 1));
+                FigConcurrentRegion f = 
+                    ((FigConcurrentRegion) regionsList.get(regionsList.size() - 1));
                 Rectangle regionBounds = f.getBounds();
                 if ((h - oldBounds.height + regionBounds.height)
                         <= (f.getMinimumSize().height)) {
@@ -220,6 +220,19 @@
         }
 
     }
+    
+    @Override
+    public Vector<Fig> getEnclosedFigs() {
+        Vector<Fig> enclosedFigs = super.getEnclosedFigs();
+        
+        TreeMap<Integer, Fig> figsByY = new TreeMap<Integer, Fig>();
+        for (Fig fig : enclosedFigs) {
+            if (fig instanceof FigConcurrentRegion) {
+                figsByY.put(fig.getY(), fig);
+            }
+        }
+        return new Vector<Fig>(figsByY.values());
+    }
 
     /**
      * To resize only when a new concurrent region is added,
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.