Author: apico
Date: 2011-05-06 14:59:55 -0700 (Fri, 06 May 2011)
New Revision: 24953
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/commands/MetaNodeCommandHandler.java
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
Log:
impl expandAll and collapseAll per network (other than current) and
corresponding CyCommands
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/commands/MetaNodeCommandHandler.java
===================================================================
---
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/commands/MetaNodeCommandHandler.java
2011-05-06 20:37:22 UTC (rev 24952)
+++
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/commands/MetaNodeCommandHandler.java
2011-05-06 21:59:55 UTC (rev 24953)
@@ -76,9 +76,15 @@
COLLAPSE("collapse",
"Collapse a metanode",
"metanode|networkview=current"),
+ COLLAPSEALL("collapse all",
+ "Collapse all metanodes",
+ "networkview=current"),
EXPAND("expand",
"Expand a metanode",
"metanode|networkview=current"),
+ EXPANDALL("expand all",
+ "Expand all metanodes",
+ "networkview=current"),
LISTEDGES("list edges",
"List the edges in a particular metanode",
"metanode"),
@@ -283,6 +289,16 @@
// "Expand a metanode",
// "metanode|networkview=current"),
//
+ } else if (Command.COLLAPSEALL.equals(command)){
+ // Get the network view
+ CyNetworkView view = Cytoscape.getCurrentNetworkView();
+ if (args.containsKey(NETWORKVIEW) &&
!CURRENT.equalsIgnoreCase((String)args.get(NETWORKVIEW))) {
+ view =
Cytoscape.getNetworkView((String)args.get(NETWORKVIEW));
+ if (view == null || view ==
Cytoscape.getNullNetworkView())
+ throw new RuntimeException("metanode:
can't find a network view for "+args.get(NETWORKVIEW));
+ }
+ MetaNodeManager.collapseAll(view);
+
} else if (Command.EXPAND.equals(command)) {
if (metaNode == null) {
throw new RuntimeException("metanode: expand
requires a metanode");
@@ -309,6 +325,16 @@
// "List the edges in a particular metanode",
// "metanode"),
//
+ } else if (Command.EXPANDALL.equals(command)){
+ // Get the network view
+ CyNetworkView view = Cytoscape.getCurrentNetworkView();
+ if (args.containsKey(NETWORKVIEW) &&
!CURRENT.equalsIgnoreCase((String)args.get(NETWORKVIEW))) {
+ view =
Cytoscape.getNetworkView((String)args.get(NETWORKVIEW));
+ if (view == null || view ==
Cytoscape.getNullNetworkView())
+ throw new RuntimeException("metanode:
can't find a network view for "+args.get(NETWORKVIEW));
+ }
+ MetaNodeManager.expandAll(view);
+
} else if (Command.LISTEDGES.equals(command)) {
if (metaGroup == null)
throw new RuntimeException("metanode: list
edges requires a metanode name");
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
===================================================================
---
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
2011-05-06 20:37:22 UTC (rev 24952)
+++
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
2011-05-06 21:59:55 UTC (rev 24953)
@@ -161,6 +161,17 @@
// vizmapper.applyAppearances();
nView.updateView();
}
+ static public void expandAll(CyNetworkView view) {
+ CyNetworkView nView = view;
+ Collection<MetaNode> metaNodes = metaMap.values();
+ for (MetaNode mNode: metaNodes) {
+ if (mNode.isHidden())
+ continue;
+ if (mNode.isCollapsed())
+
mNode.getCyGroup().setState(MetaNodePlugin2.EXPANDED);
+ }
+ nView.updateView();
+ }
/**
* Collapse all MetaNodes
@@ -176,6 +187,15 @@
// vizmapper.applyAppearances();
nView.updateView();
}
+ static public void collapseAll(CyNetworkView view) {
+ CyNetworkView nView = view;
+ Collection<MetaNode> metaNodes = metaMap.values();
+ for (MetaNode mNode: metaNodes) {
+ if (!mNode.isCollapsed())
+
mNode.getCyGroup().setState(MetaNodePlugin2.COLLAPSED);
+ }
+ nView.updateView();
+ }
/**
* Sets whether or not we hide the metnode when we expand the
--
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.