Author: pwang
Date: 2009-12-14 17:11:33 -0800 (Mon, 14 Dec 2009)
New Revision: 18759
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
Log:
Get better suggested Node ID
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
2009-12-14 23:44:15 UTC (rev 18758)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
2009-12-15 01:11:33 UTC (rev 18759)
@@ -282,7 +282,7 @@
CyNetwork selectedNetwork = dlg.getSelectedNetwork();
// Create a new Node
- String nodeID =
selectedNetwork.getIdentifier();//"node" + counter;
+ String nodeID =
getSuggestedNodeID(selectedNetwork);//selectedNetwork.getIdentifier();//"node"
+ counter;
if (ShapePalette.specifyIdentifier){
nodeID = getNodeID(nodeID);
@@ -310,6 +310,23 @@
}
}
+ private String getSuggestedNodeID(CyNetwork pSelectedNetwork){
+
+ String suggestedNodeID = pSelectedNetwork.getIdentifier();
+
+ while (true){
+ CyNode aNode = Cytoscape.getCyNode(suggestedNodeID);
+ if (aNode == null){
+ // suggestedNodeID is still available, so we
get one we need
+ break;
+ }
+
+ suggestedNodeID += suggestedNodeID + "_"+counter;
+ }
+
+ return suggestedNodeID;
+ }
+
/**
* A stub routine that currently just adds a node at the drop position.
In
* theory, the URL can be traversed and the retrieved document parsed to
--
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.