Author: pwang
Date: 2009-11-24 14:39:24 -0800 (Tue, 24 Nov 2009)
New Revision: 18568

Modified:
   cytoscape/trunk/src/cytoscape/visual/ui/NestedNetworkMenuListener.java
Log:
Add menu item "Delete Nested Network"

Modified: cytoscape/trunk/src/cytoscape/visual/ui/NestedNetworkMenuListener.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/ui/NestedNetworkMenuListener.java      
2009-11-24 22:34:12 UTC (rev 18567)
+++ cytoscape/trunk/src/cytoscape/visual/ui/NestedNetworkMenuListener.java      
2009-11-24 22:39:24 UTC (rev 18568)
@@ -1,5 +1,5 @@
 /*
- File: NodeBypassMenuListener.java
+ File: NestedNetworkMenuListener.java
 
  Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
 
@@ -68,15 +68,23 @@
         * @param nodeView The clicked NodeView
         * @param menu popup menu to add the Bypass menu
         */
-       public void addNodeContextMenuItems(NodeView nodeView, JPopupMenu menu) 
{
-               
+       public void addNodeContextMenuItems(NodeView nodeView, JPopupMenu menu) 
{               
                if (menu == null){
                        menu = new JPopupMenu();                
                }
+               JMenu jm = new JMenu("Nested network");
+                               
+               final JMenuItem jm1 = new JCheckBoxMenuItem(new 
SetNestedNetworkMenuItemAction(nodeView));
+               final JMenuItem jm2 = new JCheckBoxMenuItem(new 
DeleteNestedNetworkMenuItemAction(nodeView));
 
-               final JMenuItem jmi = new JCheckBoxMenuItem(new 
SetNestedNetworkMenuItemAction(nodeView));
-
-               menu.add(jmi);
+               if (nodeView.getNode().getNestedNetwork() == null){
+                       jm2.setEnabled(false);
+               }
+               
+               jm.add(jm1);
+               jm.add(jm2);
+                               
+               menu.add(jm);
        }
        
 
@@ -95,4 +103,21 @@
                        dlg.setVisible(true);
                }
        }
+
+       //
+       class DeleteNestedNetworkMenuItemAction extends AbstractAction {
+               NodeView nodeView;
+               public DeleteNestedNetworkMenuItemAction(NodeView nodeView){
+                       super("Delete Nested Network");
+                       this.nodeView = nodeView;
+               }
+               
+               public void actionPerformed(ActionEvent e) {
+                       if (this.nodeView.getNode().getNestedNetwork() == null){
+                               return;
+                       }
+                       this.nodeView.getNode().setNestedNetwork(null);
+               }
+       }
+
 }

--

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