Author: apico
Date: 2011-06-04 22:30:53 -0700 (Sat, 04 Jun 2011)
New Revision: 25650

Modified:
   
csplugins/trunk/ucsf/scooter/nodeCharts/src/main/java/nodeCharts/command/NodeChartCommandHandler.java
Log:
reloadChart was choking on the child nodes of nested/expanded metanodes. The 
chart commands stored in node attrs becomes invalid once you expand or nest, 
because the nodes switch network membership. I added a quick check on the attr 
before executing it. 

Modified: 
csplugins/trunk/ucsf/scooter/nodeCharts/src/main/java/nodeCharts/command/NodeChartCommandHandler.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/nodeCharts/src/main/java/nodeCharts/command/NodeChartCommandHandler.java
       2011-06-05 02:41:08 UTC (rev 25649)
+++ 
csplugins/trunk/ucsf/scooter/nodeCharts/src/main/java/nodeCharts/command/NodeChartCommandHandler.java
       2011-06-05 05:30:53 UTC (rev 25650)
@@ -309,6 +309,15 @@
                                        String command = 
chart.substring(12,chart.lastIndexOf('_'));
                                        // Get the command args
                                        Map<String,Object> args = 
nodeAttributes.getMapAttribute(nodeName, chart);
+                                       /* 
+                                        * Watch out for inconsistent 
nodelist-network assignments in
+                                        * chartlist attr. These can arise, 
e.g., when metanode children
+                                        * are assigned to parent network 
(i.e., expanded) or to nested
+                                        * networks, making former chart 
commands invalid.
+                                        */
+                                       if (!((String) 
args.get("network")).equals(view.getNetwork().getTitle())){
+                                               continue;
+                                       }
                                        // Execute it
                                        CyCommandResult comResult = 
executeNodeChart(command, args, false);
                                        resultList.add(comResult);
@@ -372,13 +381,13 @@
        }
 
        private CyNetworkView getNetworkView(String command, Map<String, 
Object> args) throws CyCommandException {
-               String netviewName = getArg(command, 
NodeChartCommandHandler.NETWORK, args);
-               if (netviewName == null || 
netviewName.equals(NodeChartCommandHandler.CURRENT))
+               String netName = getArg(command, 
NodeChartCommandHandler.NETWORK, args);
+               if (netName == null || 
netName.equals(NodeChartCommandHandler.CURRENT))
                        return Cytoscape.getCurrentNetworkView();
 
-               CyNetworkView netview = Cytoscape.getNetworkView(netviewName);
+               CyNetworkView netview = Cytoscape.getNetworkView(netName);
                if (netview == Cytoscape.getNullNetworkView())
-                       throw new 
CyCommandException(namespace.getNamespaceName()+": no such network 
"+netviewName);
+                       throw new 
CyCommandException(namespace.getNamespaceName()+": no such network "+netName);
 
                return netview;
        }

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