Author: scooter
Date: 2010-01-30 18:18:44 -0800 (Sat, 30 Jan 2010)
New Revision: 19083

Modified:
   
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodePlugin2.java
   
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNode.java
   
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeSettingsDialog.java
Log:
Updates to fix various restore problems with metanodes


Modified: 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodePlugin2.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodePlugin2.java
       2010-01-31 02:17:38 UTC (rev 19082)
+++ 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodePlugin2.java
       2010-01-31 02:18:44 UTC (rev 19083)
@@ -153,7 +153,6 @@
                        logger.error(e.getMessage());
                }
 
-
                // Create our main plugin menu
                JMenu menu = new JMenu("MetaNode Operations");
                menu.addMenuListener(new MetanodeMenuListener(null));
@@ -232,8 +231,12 @@
                                // We are, we need to "fix up" the network
                                newNode.recollapse(recursive, multipleEdges, 
myview);
                        } else {
-                               CyNetwork network = myview.getNetwork();
-                               network.hideNode(group.getGroupNode());
+                               if (settingsDialog.getSizeToBoundingBox()) {
+                                       newNode.expand(true, null, true);
+                               } else {
+                                       CyNetwork network = myview.getNetwork();
+                                       network.hideNode(group.getGroupNode());
+                               }
                        }
                }
                // logger.debug("registering");
@@ -695,7 +698,7 @@
                  menu.add(item);
                }
        }
-       
+
   /**
    * This class gets attached to the menu item.
    */

Modified: 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNode.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNode.java
        2010-01-31 02:17:38 UTC (rev 19082)
+++ 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNode.java
        2010-01-31 02:18:44 UTC (rev 19083)
@@ -979,7 +979,7 @@
                if (!isNodeHidden(partner)) {
                        if (DEBUG) logger.debug("Restoring edge 
"+edge.getIdentifier()+" partner = "+partner.getIdentifier());
                        network.restoreEdge(edge);
-                       if (networkView != null)
+                       if (networkView != null && networkView != 
Cytoscape.getNullNetworkView());
                                networkView.applyVizMap(edge);
                } else {
                        if (DEBUG) logger.debug("Not restoring edge 
"+edge.getIdentifier()+". "+

Modified: 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeSettingsDialog.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeSettingsDialog.java
     2010-01-31 02:17:38 UTC (rev 19082)
+++ 
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeSettingsDialog.java
     2010-01-31 02:18:44 UTC (rev 19083)
@@ -52,6 +52,8 @@
 import cytoscape.groups.CyGroupViewer;
 import cytoscape.layout.Tunable;
 import cytoscape.layout.TunableListener;
+import cytoscape.visual.VisualPropertyDependency;
+import cytoscape.visual.VisualStyle;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -61,6 +63,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.swing.BorderFactory;
@@ -351,7 +354,6 @@
                        AttributeHandler.setDefault(CyAttributes.TYPE_BOOLEAN, 
(AttributeHandlingType)getListValue(t));
                        metanodeProperties.setProperty(t.getName(), 
t.getValue().toString());
                }
-
        }
 
        public void revertSettings() {
@@ -371,6 +373,13 @@
                attrList.setLowerBound(getAttributes());
        }
 
+       public boolean getSizeToBoundingBox() {
+               updateSettings(false);
+               String bv = 
(String)metanodeProperties.getProperties().get("sizeToBoundingBox");
+               sizeToBoundingBox = Boolean.parseBoolean(bv);
+               return sizeToBoundingBox;
+       }
+
        private String[] getAttributes() {
                CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
                CyAttributes edgeAttributes = Cytoscape.getEdgeAttributes();
@@ -459,9 +468,10 @@
                        MetaNode.setHideMetaNodeDefault(hideMetanode);
                } else if (t.getName().equals("sizeToBoundingBox")) {
       boolean sizeToBoundingBox = ((Boolean) t.getValue()).booleanValue();
-                       if (sizeToBoundingBox) 
+                       if (sizeToBoundingBox) {
                                opacityTunable.setImmutable(false);
-                       else
+                               modifyVizMap();
+                       } else
                                opacityTunable.setImmutable(true);
                        MetaNode.setSizeToBoundingBoxDefault(sizeToBoundingBox);
                } else if (t.getName().equals("metanodeOpacity")) {
@@ -572,4 +582,12 @@
                doLayout();
                pack();
        }
+
+       private void modifyVizMap() {
+               // Get the current Visual Style
+               VisualStyle currentStyle = 
Cytoscape.getCurrentNetworkView().getVisualStyle();
+
+               // Now set the dependency
+               
currentStyle.getDependency().set(VisualPropertyDependency.Definition.NODE_SIZE_LOCKED,
 false);
+       }
 }

-- 
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