Author: scooter
Date: 2010-09-16 13:08:43 -0700 (Thu, 16 Sep 2010)
New Revision: 21896
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/build.xml
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodeGroupViewer.java
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeMenuListener.java
Log:
Clean-up in conjunction with new CyGroup cleanup.
Modified: csplugins/trunk/ucsf/scooter/metaNodePlugin2/build.xml
===================================================================
--- csplugins/trunk/ucsf/scooter/metaNodePlugin2/build.xml 2010-09-16
19:02:01 UTC (rev 21895)
+++ csplugins/trunk/ucsf/scooter/metaNodePlugin2/build.xml 2010-09-16
20:08:43 UTC (rev 21896)
@@ -5,7 +5,7 @@
<property name = "build" location = "build"/>
<property name = "build.compiler" value = "modern"/>
<!-- path to Cytoscape under development (CVS) -->
- <property name = "lib" location = "../../../../cytoscape"/>
+ <property name = "lib" location = "../../../../cytoscape/build"/>
<property name = "jar" location = "jar"/>
<property name = "doc" location = "doc"/>
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodeGroupViewer.java
===================================================================
---
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodeGroupViewer.java
2010-09-16 19:02:01 UTC (rev 21895)
+++
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/MetaNodeGroupViewer.java
2010-09-16 20:08:43 UTC (rev 21896)
@@ -32,7 +32,9 @@
*/
package metaNodePlugin2;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import cytoscape.CyNetwork;
@@ -142,7 +144,9 @@
* This is called when a new group has been created that
* we care about. This version of the groupCreated
* method is called by XGMML and provides the CyNetworkView
- * that is in the process of being created.
+ * that is in the process of being created. Note that to
+ * be efficient, this is called after all of the groups
+ * have been created, so we can do this all at once.
*
* @param group the CyGroup that was just created
* @param view the CyNetworkView that is being created
@@ -150,6 +154,11 @@
public void groupCreated(CyGroup group, CyNetworkView myview) {
// logger.debug("groupCreated("+group+", view)");
if (MetaNodeManager.getMetaNode(group) == null) {
+ // Have we already been here?
+ if (MetaNodeManager.getMetaNodeCount() == 0) {
+ initializeGroups(myview);
+ return;
+ }
MetaNode newNode =
MetaNodeManager.createMetaNode(group);
// We need to be a little tricky if we are restoring a
collapsed
@@ -163,6 +172,7 @@
network.hideNode(group.getGroupNode());
}
}
+
// logger.debug("registering");
logger.info("updating group panel for new group: "+group);
updateGroupPanel();
@@ -243,6 +253,22 @@
return;
}
+ // This method is called on the first notification that we have a group.
+ private void initializeGroups(CyNetworkView view) {
+ List<CyGroup> metaGroups = CyGroupManager.getGroupList(this);
+ if (metaGroups != null) {
+ for (CyGroup group: metaGroups) {
+ // Create the metanode
+ MetaNode newNode =
MetaNodeManager.createMetaNode(group);
+ if (group.getState() ==
MetaNodePlugin2.COLLAPSED) {
+ newNode.recollapse(view);
+ }
+ }
+ }
+ logger.info("updating group panel");
+ updateGroupPanel();
+ }
+
public void registerWithGroupPanel() {
try {
Map<String,Object> args = new HashMap<String,Object>();
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
===================================================================
---
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
2010-09-16 19:02:01 UTC (rev 21895)
+++
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/model/MetaNodeManager.java
2010-09-16 20:08:43 UTC (rev 21896)
@@ -88,6 +88,9 @@
mn.setUseNestedNetworks(useNestedNetworksDefault);
mn.setHideMetaNode(hideMetanodeDefault);
mn.setMetaNodeOpacity(metanodeOpacityDefault);
+ if (metaGroup.getNetwork() == null) {
+ metaGroup.setNetwork(Cytoscape.getCurrentNetwork(),
false);
+ }
return mn;
}
@@ -126,6 +129,19 @@
}
/**
+ * Get the number of metanodes we currently have. This is used
+ * by the group viewer to determine if it needs to initialize everything
+ * the first time it gets called
+ *
+ * @return the number of metanodes we know about
+ */
+ static public int getMetaNodeCount() {
+ if (metaMap == null)
+ return 0;
+ return metaMap.size();
+ }
+
+ /**
* Expand all MetaNodes
*/
static public void expandAll() {
Modified:
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeMenuListener.java
===================================================================
---
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeMenuListener.java
2010-09-16 19:02:01 UTC (rev 21895)
+++
csplugins/trunk/ucsf/scooter/metaNodePlugin2/src/metaNodePlugin2/ui/MetanodeMenuListener.java
2010-09-16 20:08:43 UTC (rev 21896)
@@ -275,7 +275,7 @@
nodeGroups = node.getGroups();
}
- // List current named selections
+ // List current metaNodes
for (CyGroup group: groupList) {
CyNode groupNode = group.getGroupNode();
List<CyGroup> parents = groupNode.getGroups();
--
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.