svn commit: r14604 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-05-03 12:34:04-0700
New Revision: 14604

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

Log:
This code probably doesn't belong here but I need to fix it here for now.

Make sure that enclosing and enclosed know of eachother both ways.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java?view=diff&rev=14604&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java&r1=14603&r2=14604
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java	2008-05-03 12:34:04-0700
@@ -96,10 +96,10 @@
         super.actionPerformed(ae);
         try {
             /*Here the actions to divide a region*/
-            Fig f = TargetManager.getInstance().getFigTarget();
+            FigNodeModelElement f = (FigNodeModelElement) TargetManager.getInstance().getFigTarget();
 
             if (Model.getFacade().isAConcurrentRegion(f.getOwner())) {
-                f = f.getEnclosingFig();
+                f = (FigNodeModelElement) f.getEnclosingFig();
             }
 
             List<Fig> nodesInside;
@@ -113,8 +113,7 @@
             Rectangle rName =
                 ((FigNodeModelElement) f).getNameFig().getBounds();
             Rectangle rFig = f.getBounds();
-            Fig encloser = null;
-            encloser = f;
+            final FigCompositeState figCompositeState = (FigCompositeState) f;
             if (!(gm instanceof MutableGraphModel)) {
                 return;
             }
@@ -132,7 +131,7 @@
                                             rFig.height - rName.height - 10);
 
                 region.setLocation(f.getX() + 3, f.getY() + rName.height + 5);
-                region.setEnclosingFig(encloser);
+                region.setEnclosingFig(figCompositeState);
                 region.setLayer(lay);
                 lay.add(region);
 
@@ -147,6 +146,7 @@
                         FigStateVertex curFig =
                             (FigStateVertex) nodesInside.get(i);
                         curFig.setEnclosingFig(region);
+                        region.addEnclosedFig(curFig);
                         curFig.redrawEnclosedFigs();
                     }
                 }
@@ -160,8 +160,9 @@
 
             regionNew.setLocation(f.getX() + 3, f.getY() + rFig.height - 1);
 
-            ((FigCompositeState) f).setBounds(rFig.height + 130);
-            regionNew.setEnclosingFig(encloser);
+            figCompositeState.setBounds(rFig.height + 130);
+            regionNew.setEnclosingFig(figCompositeState);
+            figCompositeState.addEnclosedFig(regionNew);
             regionNew.setLayer(lay);
             lay.add(regionNew);
             editor.getSelectionManager().select(f);
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.