Author: pwang
Date: 2011-09-27 15:44:55 -0700 (Tue, 27 Sep 2011)
New Revision: 27001

Modified:
   
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/DropNetworkViewTask.java
   
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/gui/ShapePalette.java
Log:
Support 'specify name' for new node

Modified: 
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/DropNetworkViewTask.java
===================================================================
--- 
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/DropNetworkViewTask.java
   2011-09-27 22:42:09 UTC (rev 27000)
+++ 
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/DropNetworkViewTask.java
   2011-09-27 22:44:55 UTC (rev 27001)
@@ -15,14 +15,15 @@
 import org.cytoscape.model.CyNode;
 
 import org.cytoscape.dnd.DropUtil;
+import org.cytoscape.editor.internal.gui.ShapePalette;
 import org.cytoscape.event.CyEventHelper;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.view.vizmap.VisualStyle;
+import javax.swing.JOptionPane;
 
-
 public class DropNetworkViewTask extends AbstractNetworkViewTask {
 
        private final Transferable t;
@@ -33,6 +34,7 @@
 
        private static final Logger logger = 
LoggerFactory.getLogger(DropNetworkViewTask.class);
        
+       
        public DropNetworkViewTask(VisualMappingManager vmm, CyNetworkView 
view, Transferable t, Point2D xformPt, CyEventHelper eh) {
                super(view);
                this.t = t;
@@ -52,8 +54,16 @@
                CyNode n = net.addNode();
                
                // set the name attribute for the new node
-               String nodeName = "Node_"+ new_node_index;
-               new_node_index++;
+               String nodeName = "";
+               
+               if (ShapePalette.specifyIdentifier){
+                       nodeName = JOptionPane.showInputDialog("Please specify 
a name");
+               }
+               else {
+                       nodeName = "Node_"+ new_node_index;             
+                       new_node_index++;
+               }
+
                n.getCyRow().set("name", nodeName);
                
                eh.flushPayloadEvents();
@@ -62,7 +72,6 @@
                
nv.setVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION,xformPt.getY());
                view.updateView();
                
-               
                // Apply visual style
                VisualStyle vs = vmm.getVisualStyle(view);
                vs.apply(view);

Modified: 
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/gui/ShapePalette.java
===================================================================
--- 
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/gui/ShapePalette.java
      2011-09-27 22:42:09 UTC (rev 27000)
+++ 
core3/impl/trunk/editor-impl/src/main/java/org/cytoscape/editor/internal/gui/ShapePalette.java
      2011-09-27 22:44:55 UTC (rev 27001)
@@ -131,7 +131,7 @@
                pnlSpecifyIdentifier.setBackground(Color.white);
 
                pnlSpecifyIdentifier.setMaximumSize(new 
java.awt.Dimension(32767, 100));
-               JLabel chkSpecifyLabel = new JLabel("Specify Identifier:");
+               JLabel chkSpecifyLabel = new JLabel("Specify Name:");
                chkSpecifyIdentifier = new javax.swing.JCheckBox();
                chkSpecifyIdentifier.setToolTipText("Checking the box will 
allow you to choose the identifier for added nodes and edges.");
                pnlSpecifyIdentifier.setLayout(new java.awt.GridBagLayout());

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