Author: apico
Date: 2011-06-04 19:18:36 -0700 (Sat, 04 Jun 2011)
New Revision: 25648
Modified:
csplugins/trunk/ucsf/scooter/nodeCharts/src/main/java/nodeCharts/command/NodeChartCommandHandler.java
Log:
syncs the optional 'network' arg with networkview selection. Previously,
regardless of the network arg passed in, the view was always
getCurrentNetworkView(). Now it simply uses the network arg to grab the
corresponding view and defaults to current view.
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 01:00:39 UTC (rev 25647)
+++
csplugins/trunk/ucsf/scooter/nodeCharts/src/main/java/nodeCharts/command/NodeChartCommandHandler.java
2011-06-05 02:18:36 UTC (rev 25648)
@@ -120,13 +120,12 @@
public CyCommandResult execute(String command, Map<String, Object>args)
throws
CyCommandException, RuntimeException {
- CyNetworkView view = Cytoscape.getCurrentNetworkView();
- return executeNodeChart(command, args, true, view);
+ return executeNodeChart(command, args, true);
}
private CyCommandResult executeNodeChart(String command, Map<String,
Object>args,
- boolean saveCommand,
CyNetworkView view)
+ boolean saveCommand)
throws
CyCommandException, RuntimeException {
CyCommandResult result = new CyCommandResult();
@@ -144,10 +143,11 @@
}
CyNetwork network = getNetwork(command, args);
+ CyNetworkView view = getNetworkView(command, args);
List<CyNode> nodeList = getNodeList(network, result, args);
if (nodeList == null)
throw new CyCommandException("can't find node(s) or
none specified");
-
+
// Handle built-ins
if (command.equals(CLEAR)) {
for (CyNode node: nodeList) {
@@ -309,7 +309,7 @@
// Get the command args
Map<String,Object> args =
nodeAttributes.getMapAttribute(nodeName, chart);
// Execute it
- CyCommandResult comResult =
executeNodeChart(command, args, false, view);
+ CyCommandResult comResult =
executeNodeChart(command, args, false);
resultList.add(comResult);
}
}
@@ -370,6 +370,18 @@
return net;
}
+ 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))
+ return Cytoscape.getCurrentNetworkView();
+
+ CyNetworkView netview = Cytoscape.getNetworkView(netviewName);
+ if (netview == Cytoscape.getNullNetworkView())
+ throw new
CyCommandException(namespace.getNamespaceName()+": no such network
"+netviewName);
+
+ return netview;
+ }
+
private String makeNodeList(Collection<CyNode>nodes) {
String nodeList = "";
if (nodes == null || nodes.size() == 0)
--
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.