Author: mes
Date: 2012-03-23 15:28:46 -0700 (Fri, 23 Mar 2012)
New Revision: 28638

Added:
   
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyEdgeViewContextMenuFactory.java
   
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyMenuItem.java
   
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyNodeViewContextMenuFactory.java
Log:
refs #793 initial support for node and edge view context menus

Added: 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyEdgeViewContextMenuFactory.java
===================================================================
--- 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyEdgeViewContextMenuFactory.java
                               (rev 0)
+++ 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyEdgeViewContextMenuFactory.java
       2012-03-23 22:28:46 UTC (rev 28638)
@@ -0,0 +1,61 @@
+
+/*
+ File: CyEdgeViewContextMenuFactory.java
+
+ Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications.  In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage.  See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.cytoscape.application.swing;
+
+import javax.swing.JMenuItem;
+import org.cytoscape.view.model.CyNetworkView; 
+import org.cytoscape.view.model.View; 
+import org.cytoscape.model.CyEdge; 
+
+/**
+ * A factory interface used to produce a CyMenuItem (JMenuItem) that
+ * will be added to the context menu for the specified edge view. 
+ * @CyAPI.Spi.Interface
+ */
+public interface CyEdgeViewContextMenuFactory {
+
+    /**
+     * This method should return a CyMenuItem to be added to the context
+     * menu of the specified edge view.
+     * @param netView The CyNetworkView containing the edge view in question.
+     * @param edgeView The View<CyEdge> whose menu will be updated with 
the
+     * returned CyMenuItem.
+     * @return The CyMenuItem to be added to the edge view's context menu.
+     */
+       CyMenuItem createMenuItem(CyNetworkView netView, View<CyEdge> edgeView);
+}

Added: 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyMenuItem.java
===================================================================
--- 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyMenuItem.java
                         (rev 0)
+++ 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyMenuItem.java
 2012-03-23 22:28:46 UTC (rev 28638)
@@ -0,0 +1,82 @@
+
+
+/*
+ File: CyMenuItem.java
+
+ Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications.  In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage.  See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.cytoscape.application.swing;
+
+import javax.swing.JMenuItem;
+
+/**
+ * A simple wrapper class that allows a JMenuItem to be associated with 
+ * a gravity value which defines where in a menu the item should fall.
+ * @CyAPI.Final.Class
+ */
+public final class CyMenuItem {
+
+       private final JMenuItem menuItem;
+       private final float gravity;
+
+       /**
+        * Constructor.
+        * @param menuItem to JMenuItem to be added to the menu.
+        * @param gravity the gravity of the menu item to be added. 
+        */
+       public CyMenuItem(JMenuItem menuItem, float gravity) {
+               if ( menuItem == null )
+                       throw new NullPointerException("menu item cannot be 
null");
+               this.menuItem = menuItem;
+               this.gravity = gravity;
+       }
+
+       /**
+        * Returns the menu item to be placed in a menu according to the 
specified menu gravity.
+        * @return the menu item to be placed in a menu according to the 
specified menu gravity.
+        */
+       public JMenuItem getMenuItem() {
+               return menuItem;
+       }
+
+       /**
+        * Returns the gravity used to place the menu item in a menu.
+        * Gravity is a numeric value associated with each menu item. MenuItems 
in the same menu pull-down
+        * are sorted in ascending order based on their gravity values.
+        * @return The gravity used to place the menu item in a menu.
+        */
+       public float getMenuGravity() {
+               return gravity;
+       }
+}

Added: 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyNodeViewContextMenuFactory.java
===================================================================
--- 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyNodeViewContextMenuFactory.java
                               (rev 0)
+++ 
core3/api/trunk/swing-application-api/src/main/java/org/cytoscape/application/swing/CyNodeViewContextMenuFactory.java
       2012-03-23 22:28:46 UTC (rev 28638)
@@ -0,0 +1,60 @@
+
+/*
+ File: CyNodeViewContextMenuFactory.java
+
+ Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications.  In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage.  See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+package org.cytoscape.application.swing;
+
+import org.cytoscape.view.model.CyNetworkView; 
+import org.cytoscape.view.model.View; 
+import org.cytoscape.model.CyNode; 
+
+/**
+ * A factory interface used to produce a CyMenuItem (JMenuItem) that
+ * will be added to the context menu for the specified node view. 
+ * @CyAPI.Spi.Interface
+ */
+public interface CyNodeViewContextMenuFactory {
+
+       /**
+        * This method should return a CyMenuItem to be added to the context
+        * menu of the specified node view.
+        * @param netView The CyNetworkView containing the node view in 
question.
+        * @param nodeView The View&lt;CyNode&gt; whose menu will be updated 
with the
+        * returned CyMenuItem.
+        * @return The CyMenuItem to be added to the node view's context menu.
+        */
+       CyMenuItem createMenuItem(CyNetworkView netView, View<CyNode> nodeView);
+}

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