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

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-02-12 10:41:41-0800
New Revision: 16794

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

Log:
Fix for the problem I mentioned in issue 3736: Reloading causes the regions not to be enclosed by the composite state, i.e. they do not move when the composite state is moved.


Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java?view=diff&pathrev=16794&r1=16793&r2=16794
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java	2009-02-12 10:41:41-0800
@@ -44,8 +44,10 @@
 import org.argouml.uml.diagram.DiagramSettings;
 import org.argouml.uml.diagram.ui.ActionAddConcurrentRegion;
 import org.tigris.gef.base.Globals;
+import org.tigris.gef.base.Layer;
 import org.tigris.gef.base.Selection;
 import org.tigris.gef.graph.GraphModel;
+import org.tigris.gef.presentation.Fig;
 import org.tigris.gef.presentation.FigLine;
 import org.tigris.gef.presentation.FigRect;
 import org.tigris.gef.presentation.FigText;
@@ -170,6 +172,30 @@
         }
         updateNameText();
     }
+
+    /**
+     * The moment we add this fig to a layer, 
+     * especially during load,
+     * it needs to be made aware that it 
+     * is enclosed by a FigCompositeState.
+     * This fixes issue 3736.
+     * 
+     * @param lay the layer
+     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#setLayer(org.tigris.gef.base.Layer)
+     */
+    @Override
+    public void setLayer(Layer lay) {
+        super.setLayer(lay);
+        for (Fig f : lay.getContents()) {
+            if (f instanceof FigCompositeState) {
+                if (f.getOwner() 
+                        == Model.getFacade().getContainer(getOwner())) {
+                    setEnclosingFig(f);
+                    break; // there can only be one
+                }
+            }
+        }
+    }
     
     /*
      * @see java.lang.Object#clone()

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

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.