Author: kono
Date: 2011-02-03 15:08:50 -0800 (Thu, 03 Feb 2011)
New Revision: 24019

Removed:
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassHack.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypass.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/NodeBypass.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypass.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypassNetworkListener.java
Modified:
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassManager.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypassMenuTaskFactory.java
   
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
Log:
Checkbox menu is working for context menu.

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
       2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
       2011-02-03 23:08:50 UTC (rev 24019)
@@ -27,37 +27,34 @@
 */
 package org.cytoscape.ding.impl;
 
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Point;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
 import javax.swing.AbstractAction;
+import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.Point;
-import java.awt.datatransfer.Transferable;
-import java.util.Map; 
-import java.util.Collection; 
-import java.util.List; 
-import java.util.ArrayList; 
 
+import org.cytoscape.ding.EdgeView;
 import org.cytoscape.ding.NodeView;
-import org.cytoscape.ding.EdgeView;
-
-import org.cytoscape.util.swing.JMenuTracker;
-import org.cytoscape.work.Task;
-import org.cytoscape.work.TaskFactory;
-import org.cytoscape.work.TaskIterator;
-import org.cytoscape.work.TaskManager;
+import org.cytoscape.dnd.DropNetworkViewTaskFactory;
+import org.cytoscape.dnd.DropNodeViewTaskFactory;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.task.EdgeViewTaskFactory;
 import org.cytoscape.task.NetworkViewTaskFactory;
 import org.cytoscape.task.NodeViewTaskFactory;
-import org.cytoscape.task.EdgeViewTaskFactory;
-import org.cytoscape.dnd.DropNetworkViewTaskFactory;
-import org.cytoscape.dnd.DropNodeViewTaskFactory;
-
+import org.cytoscape.util.swing.JMenuTracker;
 import org.cytoscape.view.model.View;
-import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.model.CyNode;
-import org.cytoscape.model.CyEdge;
+import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.work.TaskFactory;
 
 // TODO Consider generalizing this class so that it can be used by anyone
 // who needs a popup menu based on TaskFactories.
@@ -96,7 +93,7 @@
 
                                for ( EdgeViewTaskFactory evtf : usableTFs ) {
                                        
evtf.setEdgeView(ev,m_view.cyNetworkView);
-                                       createMenuItem( menu, evtf, tracker, 
m_view.edgeViewTFs.get(evtf) );
+                                       createMenuItem(ev, menu, evtf, tracker, 
m_view.edgeViewTFs.get(evtf) );
                                }
 
                                menu.show(invoker, x, y);
@@ -127,7 +124,7 @@
                                for ( DropNodeViewTaskFactory nvtf : usableTFs 
) {
                                        
nvtf.setNodeView(nv,m_view.cyNetworkView);
                                        
nvtf.setDropInformation(t,rawPt,xformPt);
-                                       createMenuItem(menu, nvtf, tracker, 
m_view.dropNodeViewTFs.get( nvtf ));
+                                       createMenuItem(nv, menu, nvtf, tracker, 
m_view.dropNodeViewTFs.get( nvtf ));
                                }
 
                                menu.show(invoker, (int)(rawPt.getX()), 
(int)(rawPt.getY()));
@@ -158,7 +155,7 @@
 
                                for ( NodeViewTaskFactory nvtf : usableTFs ) {
                                        
nvtf.setNodeView(nv,m_view.cyNetworkView);
-                                       createMenuItem(menu, nvtf, tracker, 
m_view.nodeViewTFs.get( nvtf ));
+                                       createMenuItem(nv, menu, nvtf, tracker, 
m_view.nodeViewTFs.get( nvtf ));
                                }
 
                                menu.show(invoker, x, y);
@@ -184,7 +181,7 @@
                        for ( DropNetworkViewTaskFactory nvtf : usableTFs ) {
                                nvtf.setNetworkView(m_view.cyNetworkView);
                                nvtf.setDropInformation(t,rawPt,xformPt);
-                               createMenuItem(menu, nvtf, tracker, 
m_view.dropEmptySpaceTFs.get( nvtf ) );
+                               createMenuItem(null, menu, nvtf, tracker, 
m_view.dropEmptySpaceTFs.get( nvtf ) );
                        }
                        menu.show(invoker, (int)(rawPt.getX()), 
(int)(rawPt.getY()));
                // execute the task directly if only one factory exists 
@@ -202,11 +199,11 @@
                // build a menu of actions if more than factory exists
                Collection<NetworkViewTaskFactory> usableTFs = 
getPreferredActions(m_view.emptySpaceTFs,action);
                if ( usableTFs.size() > 1 ) {
-                       JPopupMenu menu = new JPopupMenu("Double Click Menu: 
empty");
-                       JMenuTracker tracker = new JMenuTracker(menu);
+                       final JPopupMenu menu = new JPopupMenu("Double Click 
Menu: empty");
+                       final JMenuTracker tracker = new JMenuTracker(menu);
                        for ( NetworkViewTaskFactory nvtf : usableTFs ) {
                                nvtf.setNetworkView(m_view.cyNetworkView);
-                               createMenuItem(menu, nvtf, tracker, 
m_view.emptySpaceTFs.get( nvtf ) );
+                               createMenuItem(null, menu, nvtf, tracker, 
m_view.emptySpaceTFs.get( nvtf ) );
                        }
                        menu.show(invoker, x, y);
                // execute the task directly if only one factory exists 
@@ -222,20 +219,43 @@
         * "title" and "preferredMenu" keywords, depending on which are present
         * in the service properties.
         */
-       private void createMenuItem(JPopupMenu popup, TaskFactory tf, 
+       private void createMenuItem(View<?> view, JPopupMenu popup, TaskFactory 
tf, 
                                    JMenuTracker tracker, Map props) { 
 
                String title = (String)(props.get("title"));
                String pref = (String)(props.get("preferredMenu"));
+               boolean useCheckBoxMenuItem = false;
+               
+               final Object useCheckBox = props.get("useCheckBoxMenuItem");
+               final Object targetVP = props.get("targetVP");
+               boolean isSelected = false;
+               if(view != null)
+                       isSelected = view.isValueLocked((VisualProperty<?>) 
targetVP);
+               
+               if ( useCheckBox != null ) {
+                       try {
+                               useCheckBoxMenuItem = 
Boolean.parseBoolean(useCheckBox.toString());
+                       } catch (Exception e) {
+                               useCheckBoxMenuItem = false;
+                       }
+               } else {
+                       useCheckBoxMenuItem = false;
+               }
 
                // no title and no preferred menu
                if ( title == null && pref == null ) {
                        title = "Unidentified Task: " + 
Integer.toString(tf.hashCode());
-                       popup.add( new JMenuItem( new PopupAction(tf, title) ) 
);
+                       if(useCheckBoxMenuItem)
+                               popup.add( new JCheckBoxMenuItem( new 
PopupAction(tf, title) ) );
+                       else
+                               popup.add( new JMenuItem( new PopupAction(tf, 
title) ) );
 
                // title, but no preferred menu
                } else if ( title != null && pref == null ) {
-                       popup.add( new JMenuItem( new PopupAction(tf, title) ) 
);
+                       if(useCheckBoxMenuItem)
+                               popup.add( new JCheckBoxMenuItem( new 
PopupAction(tf, title) ) );
+                       else
+                               popup.add( new JMenuItem( new PopupAction(tf, 
title) ) );
                        
                // no title, but preferred menu
                } else if ( title == null && pref != null ) {
@@ -245,19 +265,30 @@
                        if ( last > 0 ) {
                                title = pref.substring(last+1);
                                pref = pref.substring(0,last);
-                               JMenu menu = tracker.getMenu(pref);
-                               menu.add( new JMenuItem( new PopupAction(tf, 
title) ) );
+                               final JMenu menu = tracker.getMenu(pref);
+                               if(useCheckBoxMenuItem) {
+                                       final JCheckBoxMenuItem checkBox = new 
JCheckBoxMenuItem( new PopupAction(tf, title));
+                                       checkBox.setSelected(isSelected);
+                                       menu.add(checkBox);                     
                
+                               } else
+                                       menu.add( new JMenuItem( new 
PopupAction(tf, title) ) );
                        // otherwise just use the preferred menu as the 
menuitem name
                        } else {
                                title = pref;
-                               popup.add( new JMenuItem( new PopupAction(tf, 
title) ) );
+                               if(useCheckBoxMenuItem)
+                                       popup.add( new JCheckBoxMenuItem( new 
PopupAction(tf, title) ) );
+                               else
+                                       popup.add( new JMenuItem( new 
PopupAction(tf, title) ) );
                        }
 
                // title and preferred menu
                } else {
                        JMenu menu = tracker.getMenu(pref);
-                       menu.add( new JMenuItem( new PopupAction(tf, title) ) );
-               }  
+                       if(useCheckBoxMenuItem)
+                               menu.add( new JCheckBoxMenuItem( new 
PopupAction(tf, title) ) );
+                       else
+                               menu.add( new JMenuItem( new PopupAction(tf, 
title) ) );
+               } 
        }
 
        /**

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassHack.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassHack.java
     2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassHack.java
     2011-02-03 23:08:50 UTC (rev 24019)
@@ -1,67 +0,0 @@
-
-/*
- File: BypassHack.java 
-
- Copyright (c) 2007, 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.view.vizmap.gui.internal.bypass;
-
-import org.cytoscape.model.CyTableEntry;
-
-/**
- * ARgh.  This is a horrible, horrible hack that allows LabelPosition to
- * be set dynamically for vizmap bypass as you drag the icon around in
- * the label position dialog.  This class provides access to the current
- * node (or edge) that has had it's context menu clicked.  This class allows
- * the dialog to get the node then set the bypass value as things move rather
- * than waiting for the user to click OK. This could be used by other 
- * VisualPropertys in a similar fashion, but currently isn't.
- * <b>This code should NEVER propagate to newer versions of Cytoscape!!!</b>
- * This should be handled in a completely different way in the future.
- */
-public class BypassHack {
-       private static CyTableEntry curr = null;
-
-       static void setCurrentObject(CyTableEntry o) {
-               curr = o;
-       }
-
-       public static CyTableEntry getCurrentObject() {
-               return curr;
-       }
-
-       static void finished() {
-               curr = null;
-       }
-}

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassManager.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassManager.java
  2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/BypassManager.java
  2011-02-03 23:08:50 UTC (rev 24019)
@@ -73,9 +73,10 @@
                        final String newMenu = menuText + "." + 
vp.getDisplayName();
                        if (child.getChildren().size() == 0) {
                                // Leaf
-                               final Dictionary<String, String> vpProp = new 
Hashtable<String, String>();
+                               final Dictionary<String, Object> vpProp = new 
Hashtable<String, Object>();
                                vpProp.put(MENU_KEY, newMenu);
                                vpProp.put("useCheckBoxMenuItem", "true");
+                               vpProp.put("targetVP", vp);
 
                                if 
(vp.getTargetDataType().equals(CyNode.class)) {
                                        final NodeViewTaskFactory ntf = new 
NodeBypassMenuTaskFactory(
@@ -83,7 +84,8 @@
                                                                        
.getRange().getType()), selectedManager);
                                        registrar.registerService(ntf, 
NodeViewTaskFactory.class, vpProp);
                                } else if 
(vp.getTargetDataType().equals(CyEdge.class)) {
-                                       final EdgeViewTaskFactory etf = new 
EdgeBypassMenuTaskFactory();
+                                       final EdgeViewTaskFactory etf = new 
EdgeBypassMenuTaskFactory(null, vp, editorManager.getValueEditor(vp
+                                                       .getRange().getType()), 
selectedManager);
                                        registrar.registerService(etf, 
EdgeViewTaskFactory.class, vpProp);
                                }
                                logger.debug("Bypass context menu registered: "

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypass.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypass.java
     2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypass.java
     2011-02-03 23:08:50 UTC (rev 24019)
@@ -1,87 +0,0 @@
-/*
- File: EdgeBypass.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.view.vizmap.gui.internal.bypass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
-import org.cytoscape.model.CyEdge;
-import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.property.TwoDVisualLexicon;
-import org.cytoscape.view.vizmap.gui.editor.EditorManager;
-
-class EdgeBypass extends VizMapBypass {
-
-       EdgeBypass(EditorManager ef, VisualLexicon lexicon) {
-               super(ef, lexicon);
-               this.visualProperties = lexicon
-                               .getAllDescendants(TwoDVisualLexicon.EDGE);
-       }
-
-       JMenuItem addMenu(CyEdge e) {
-               graphObj = e;
-
-               JMenu menu = new JMenu("Visual Mapping Bypass");
-               menu.add(new JLabel("Change Edge Visualization"));
-               menu.addSeparator();
-               // horrible, horrible hack
-               BypassHack.setCurrentObject(e);
-
-               for (VisualProperty<?> vp : visualProperties)
-                       // FIXME: pass in network instance so that it will be 
limited to
-                       // that
-                       addMenuItem(menu, vp);
-
-               addResetAllMenuItem(menu);
-
-               return menu;
-       }
-
-       protected List<String> getBypassNames() {
-               List<String> l = new ArrayList<String>();
-
-               for (VisualProperty<?> vp : visualProperties)
-                       l.add(vp.getDisplayName());
-
-               return l;
-       }
-}

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypassMenuTaskFactory.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypassMenuTaskFactory.java
      2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/EdgeBypassMenuTaskFactory.java
      2011-02-03 23:08:50 UTC (rev 24019)
@@ -1,14 +1,34 @@
 package org.cytoscape.view.vizmap.gui.internal.bypass;
 
+import java.awt.Component;
+
 import org.cytoscape.model.CyEdge;
 import org.cytoscape.task.AbstractEdgeViewTaskFactory;
+import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
+import org.cytoscape.view.vizmap.gui.editor.ValueEditor;
 import org.cytoscape.work.TaskIterator;
 
 public class EdgeBypassMenuTaskFactory extends AbstractEdgeViewTaskFactory {
 
+       private final VisualProperty<?> vp;
+       private final ValueEditor<?> editor;
+
+       private final Component parent;
+
+       private final SelectedVisualStyleManager selectedManager;
+
+       public EdgeBypassMenuTaskFactory(final Component parent,
+                       final VisualProperty<?> vp, final ValueEditor<?> editor,
+                       final SelectedVisualStyleManager selectedManager) {
+               this.vp = vp;
+               this.editor = editor;
+               this.parent = parent;
+               this.selectedManager = selectedManager;
+       }
+
        @Override
        public TaskIterator getTaskIterator() {
-               return null;
-               //return new TaskIterator(new BypassTask<CyEdge>(edgeView));
+               return new TaskIterator(new BypassTask<CyEdge>(parent, editor, 
vp, edgeView, netView, selectedManager));
        }
 }

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/NodeBypass.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/NodeBypass.java
     2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/NodeBypass.java
     2011-02-03 23:08:50 UTC (rev 24019)
@@ -1,85 +0,0 @@
-/*
- File: NodeBypass.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.view.vizmap.gui.internal.bypass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.property.TwoDVisualLexicon;
-import org.cytoscape.view.vizmap.gui.editor.EditorManager;
-
-class NodeBypass extends VizMapBypass {
-
-       NodeBypass(EditorManager ef, VisualLexicon lexicon) {
-               super(ef, lexicon);
-               this.visualProperties = 
lexicon.getAllDescendants(TwoDVisualLexicon.NODE);
-       }
-
-       JMenuItem addMenu(CyNode n) {
-               graphObj = n;
-               JMenu menu = new JMenu("Visual Mapping Bypass");
-               menu.add(new JLabel("Change Node Visualization"));
-               menu.addSeparator();
-               // horrible, horrible hack
-               BypassHack.setCurrentObject(n);
-
-               for (VisualProperty<?> type : visualProperties)
-                       addMenuItem(menu, type);
-
-               menu.addSeparator();
-
-               addResetAllMenuItem(menu);
-
-               return menu;
-       }
-
-       protected List<String> getBypassNames() {
-               List<String> l = new ArrayList<String>();
-
-               for (VisualProperty<?> vp : visualProperties)
-                       l.add(vp.getDisplayName());
-
-               return l;
-       }
-}

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypass.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypass.java
   2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypass.java
   2011-02-03 23:08:50 UTC (rev 24019)
@@ -1,163 +0,0 @@
-/*
- File: VizMapBypass.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.view.vizmap.gui.internal.bypass;
-
-import java.awt.event.ActionEvent;
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
-import org.cytoscape.model.CyRow;
-import org.cytoscape.model.CyTableEntry;
-import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.vizmap.VisualMappingManager;
-import org.cytoscape.view.vizmap.gui.editor.EditorManager;
-
-
-/**
- * An abstract class providing common methods and data structures to the Node
- * and Edge bypass classes.
- */
-abstract class VizMapBypass {
-       
-       protected Collection<VisualProperty<?>> visualProperties;
-       
-       protected VisualMappingManager vmm;
-       protected CyTableEntry graphObj = null;
-
-       abstract protected List<String> getBypassNames();
-
-       protected EditorManager editorFactory;
-       protected VisualLexicon lexicon;
-
-       VizMapBypass(EditorManager editorFactory, VisualLexicon lexicon) {
-               this.editorFactory = editorFactory;
-               this.lexicon = lexicon;
-       }
-
-       protected void addResetAllMenuItem(JMenu menu) {
-               JMenuItem jmi = new JMenuItem(new AbstractAction("Reset All") {
-                               private final static long serialVersionUID = 
1202339876700753L;
-
-                               public void actionPerformed(ActionEvent e) {
-                                       List<String> names = getBypassNames();
-                                       CyRow row = graphObj.getCyRow();
-
-                                       for (String attrName : names)
-                                               row.set("name", ""); // TODO 
should be null instead?
-
-                                       // 
Cytoscape.redrawGraph(vmm.getNetworkView());
-                                       BypassHack.finished();
-                               }
-                       });
-               menu.add(jmi);
-       }
-
-       protected void addResetMenuItem(JMenu menu, final VisualProperty<?> 
type) {
-               JMenuItem jmi = new JMenuItem(new AbstractAction("[ Reset " + 
type.getDisplayName() + " ]") {
-                               private final static long serialVersionUID = 
1202339876709140L;
-
-                               public void actionPerformed(ActionEvent e) {
-                                       CyRow row = graphObj.getCyRow();
-
-                                       row.set(type.getDisplayName(), ""); // 
TODO set to null instead?
-
-                                       // 
Cytoscape.redrawGraph(vmm.getNetworkView());
-                                       BypassHack.finished();
-                               }
-                       });
-               menu.add(jmi);
-       }
-
-       
-       //TODO: is this OK???
-       protected <T extends Object> void addMenuItem(final JMenu menu, final 
VisualProperty<T> vp) {
-               final JMenuItem jmi = new JCheckBoxMenuItem(new 
AbstractAction(vp.getDisplayName()) {
-                               private final static long serialVersionUID = 
1202339876717506L;
-
-                               public void actionPerformed(ActionEvent e) {
-                                       Object obj = null;
-
-                                       try {
-                                               obj = 
editorFactory.showVisualPropertyValueEditor(menu, vp, vp.getDefault());
-                                       } catch (Exception ex) {
-                                               ex.printStackTrace();
-                                               obj = null;
-                                       }
-
-                                       if (obj == null)
-                                               return;
-
-                                       //TODO: what's the replacement?
-//                                     String val = 
ObjectToString.getStringValue(obj);
-//                                     CyDataTable table = 
graphObj.attrs().getDataTable();
-//
-//                                     if 
(!table.getColumnTypeMap().containsKey(type.getDisplayName()))
-//                                             
table.createColumn(type.getDisplayName(), String.class, false);
-//
-//                                     
graphObj.attrs().set(type.getDisplayName(), val);
-//                                     // 
Cytoscape.redrawGraph(vmm.getNetworkView());
-//                                     BypassHack.finished();
-                               }
-                       });
-
-               menu.add(jmi);
-
-               String attrString = 
graphObj.getCyRow().get(vp.getDisplayName(), String.class);
-
-               if ((attrString == null) || (attrString.length() == 0))
-                       jmi.setSelected(false);
-               else {
-                       jmi.setSelected(true);
-                       addResetMenuItem(menu, vp);
-               }
-       }
-
-       /**
-        *  DOCUMENT ME!
-        *
-        * @param vmm DOCUMENT ME!
-        */
-       public void setVmm(VisualMappingManager vmm) {
-               this.vmm = vmm;
-       }
-}

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypassNetworkListener.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypassNetworkListener.java
    2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/bypass/VizMapBypassNetworkListener.java
    2011-02-03 23:08:50 UTC (rev 24019)
@@ -1,73 +0,0 @@
-/*
- File: VizMapBypassNetworkListener.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.view.vizmap.gui.internal.bypass;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.cytoscape.session.CyApplicationManager;
-import org.cytoscape.view.vizmap.gui.editor.EditorManager;
-
-
-/**
- * Adds NodeView and EdgeView vizmap bypass listeners to network views as
- * the views are created.
- */
-public class VizMapBypassNetworkListener implements PropertyChangeListener {
-       private final EditorManager ef;
-       private final CyApplicationManager applicationManager;
-       
-       public VizMapBypassNetworkListener(final EditorManager ef, final 
CyApplicationManager applicationManager) {
-               this.ef = ef;
-               this.applicationManager = applicationManager;
-       }
-
-       /**
-        * Listens for NETWORK_VIEW_CREATED events and if it hears one, it adds
-        * node and edge context menu listeners to the view.
-        * @param evnt The event we're hearing.
-        */
-       public void propertyChange(PropertyChangeEvent evnt) {
-//             if (evnt.getPropertyName() == 
CySwingApplication.NETWORK_VIEW_CREATED) {
-//                     NodeBypassMenuListener node_menu_listener = new 
NodeBypassMenuListener(ef);
-//                     
applicationManager.getCurrentNetworkView().addNodeContextMenuListener(node_menu_listener);
-//
-//                     EdgeBypassMenuListener edge_menu_listener = new 
EdgeBypassMenuListener(ef);
-//                     
applicationManager.getCurrentNetworkView().addEdgeContextMenuListener(edge_menu_listener);
-//             }
-       }
-}

Modified: 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
 2011-02-03 21:42:44 UTC (rev 24018)
+++ 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
 2011-02-03 23:08:50 UTC (rev 24019)
@@ -47,14 +47,6 @@
        <bean id="propertySheetPanel" 
class="com.l2fprod.common.propertysheet.PropertySheetPanel" />
 
 
-
-       <bean id="vizMapBypassNetworkListener"
-               
class="org.cytoscape.view.vizmap.gui.internal.bypass.VizMapBypassNetworkListener">
-               <constructor-arg ref="editorManager" />
-               <constructor-arg 
ref="cyApplicationManagerServiceRef"></constructor-arg>
-       </bean>
-
-
        <!-- Editor Manager -->
 
        <bean id="nodeAttributeComboBoxEditor" factory-bean="editorManager" 
factory-method="getNodeEditor" />

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