Author: pwang
Date: 2009-08-06 12:41:18 -0700 (Thu, 06 Aug 2009)
New Revision: 17723

Modified:
   
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/GroupHandler.java
   
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/LayoutRegion.java
Log:
Refresh region after user dragged node on screen.

Modified: 
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/GroupHandler.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/GroupHandler.java
    2009-08-06 19:05:42 UTC (rev 17722)
+++ 
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/GroupHandler.java
    2009-08-06 19:41:18 UTC (rev 17723)
@@ -156,6 +156,9 @@
 
        private static final String REGION_NETWORK_ATT = "__Region_network";
 
+       private boolean nodeDragged = false;
+       private List<LayoutRegion> affectedRegions = null;
+       
        /**
         * String used to compare against os.name System property -
         * to determine if we are running on Windows platform.
@@ -247,23 +250,24 @@
                                return;
                        }
                        // The group belong to one or more groups
+                       nodeDragged = true;
                        //System.out.println("drag on a node belong to group, 
expand their boxes");
 
                        List<LayoutRegion> regionList = 
LayoutRegionManager.getRegionListForView(Cytoscape.getCurrentNetworkView());
-                       List<LayoutRegion> regions = new 
ArrayList<LayoutRegion>();
+                       affectedRegions = new ArrayList<LayoutRegion>();
                        
                        for (int i=0; i< groupList.size(); i++){
                                for (int j=0; j< regionList.size(); j++){       
        
                                        if (groupList.get(i)== 
regionList.get(j).getMyGroup()){
-                                               regions.add(regionList.get(j));
+                                               
affectedRegions.add(regionList.get(j));
                                        }
                                }
                        }
                        
                        // expand boxes if the nodeView moves outside the box
-                       for (int i=0; i< regions.size(); i++){
-                               System.out.println("region to be expand: "+ 
regions.get(i).getMyGroup().getGroupName());
-                               
regions.get(i).expand(Cytoscape.getCurrentNetworkView().getNodeView(node));
+                       for (int i=0; i< affectedRegions.size(); i++){
+                               //System.out.println("region to be expand: "+ 
affectedRegions.get(i).getMyGroup().getGroupName());
+                               
affectedRegions.get(i).expand(Cytoscape.getCurrentNetworkView().getNodeView(node));
                        }
 
                        return;
@@ -358,6 +362,13 @@
                        dragging = false;
                }
 
+               if (nodeDragged){
+                       if (affectedRegions != null){
+                               for (int i=0; i< affectedRegions.size(); i++){
+                                       affectedRegions.get(i).refresh(); // 
adjust the box size
+                               }
+                       }
+               }
                // reset all flags
                moving = false;
                dragging = false;
@@ -365,6 +376,9 @@
                stretching = false;
                regionToStretch = null;
                edgeBeingStretched = NOT_ON_EDGE;
+               nodeDragged = false;
+               affectedRegions = null;
+               
                ((DGraphView) Cytoscape.getCurrentNetworkView()).getCanvas()
                                .setSelecting(true);
                ((DGraphView) 
Cytoscape.getCurrentNetworkView()).enableNodeSelection();

Modified: 
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/LayoutRegion.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/LayoutRegion.java
    2009-08-06 19:05:42 UTC (rev 17722)
+++ 
csplugins/trunk/ucsd/mes/groupResults/src/org/cytoscape/groups/results/LayoutRegion.java
    2009-08-06 19:41:18 UTC (rev 17723)
@@ -856,4 +856,9 @@
                
                return xy;
        }
+       
+       public void refresh(){
+               double[] region = getRectValues(myGroup);
+               setBounds(region[0], region[1], region[2], region[3]);
+       }
 }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to