Author: kono
Date: 2010-11-05 19:21:05 -0700 (Fri, 05 Nov 2010)
New Revision: 22753

Added:
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTask.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTaskFactory.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
Removed:
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/CopyStyleAction.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/RemoveMappingAction.java
Modified:
   core3/vizmap-gui-impl/trunk/pom.xml
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/SelectedVisualStyleManagerImpl.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/RenameVisualStyleTaskFactory.java
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/VizMapperUtil.java
   
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
   
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
   
core3/vizmap-impl/trunk/src/main/java/org/cytoscape/view/vizmap/internal/VisualMappingManagerImpl.java
Log:
Still fixing commands (tasks).

Modified: core3/vizmap-gui-impl/trunk/pom.xml
===================================================================
--- core3/vizmap-gui-impl/trunk/pom.xml 2010-11-06 01:39:48 UTC (rev 22752)
+++ core3/vizmap-gui-impl/trunk/pom.xml 2010-11-06 02:21:05 UTC (rev 22753)
@@ -78,7 +78,6 @@
                        <artifactId>default-mappings</artifactId>
                        <version>1.0-SNAPSHOT</version>
                </dependency>
-
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>swing-application-api</artifactId>

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
 2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
 2010-11-06 02:21:05 UTC (rev 22753)
@@ -131,11 +131,11 @@
        public DefaultViewEditorImpl(final DefaultViewPanelImpl mainView,
                        final EditorManager editorFactory,
                        final CyApplicationManager cyApplicationManager,
-                       final VisualStyle selectedStyle, final 
VisualMappingManager vmm)
+                       final VisualMappingManager vmm)
        {
                super();
                this.vmm = vmm;
-               this.selectedStyle = selectedStyle;
+               this.selectedStyle = this.vmm.getDefaultVisualStyle();
                vpSets = new HashMap<String, Set<VisualProperty<?>>>();
                listMap = new HashMap<String, JList>();
 

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/SelectedVisualStyleManagerImpl.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/SelectedVisualStyleManagerImpl.java
        2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/SelectedVisualStyleManagerImpl.java
        2010-11-06 02:21:05 UTC (rev 22753)
@@ -1,5 +1,6 @@
 package org.cytoscape.view.vizmap.gui.internal;
 
+import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.view.vizmap.VisualStyle;
 import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
 import org.cytoscape.view.vizmap.gui.event.SelectedVisualStyleSwitchedEvent;
@@ -16,11 +17,11 @@
        
        protected final VisualStyle defaultVS;
        
-       public SelectedVisualStyleManagerImpl(final VisualStyle defaultVS) {
-               if(defaultVS == null)
-                       throw new NullPointerException("Default Visual Style 
should be provided.  It should not be null.");
+       public SelectedVisualStyleManagerImpl(final VisualMappingManager vmm) {
+               if(vmm == null)
+                       throw new NullPointerException("Visual Mapping Manager 
is missing.");
                
-               this.defaultVS = defaultVS;
+               this.defaultVS = vmm.getDefaultVisualStyle();
        }
 
        public VisualStyle getDefaultVisualStyle() {

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/CopyStyleAction.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/CopyStyleAction.java
        2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/CopyStyleAction.java
        2010-11-06 02:21:05 UTC (rev 22753)
@@ -1,100 +0,0 @@
-/*
- Copyright (c) 2006, 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.action;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import org.cytoscape.view.vizmap.VisualStyle;
-import org.cytoscape.view.vizmap.gui.internal.util.VizMapperUtil;
-
-/**
- *
- */
-public class CopyStyleAction extends AbstractVizMapperAction {
-       private VizMapperUtil vizMapperUtil;
-       
-       /**
-        * Creates a new CopyStyleAction object.
-        */
-       public CopyStyleAction(VizMapperUtil vizMapperUtil) {
-               super();
-               this.vizMapperUtil = vizMapperUtil;
-       }
-
-       private static final long serialVersionUID = 1244735696944563618L;
-
-       /**
-        * DOCUMENT ME!
-        * 
-        * @param e
-        *            DOCUMENT ME!
-        */
-       public void actionPerformed(ActionEvent e) {
-               //FIXME
-               // Pick currently selected visual style in the combobox.
-//             final VisualStyle currentStyle = this.vizMapperMainPanel
-//                             .getSelectedVisualStyle();
-//
-//             // Copy-to
-//             final VisualStyle clone = vmm.copyVisualStyle(currentStyle);
-//
-//             final String newName = 
vizMapperUtil.getStyleName(vizMapperMainPanel,
-//                             clone);
-//
-//             if ((newName == null) || (newName.trim().length() == 0)) {
-//                     return;
-//             }
-//
-//             clone.setTitle(newName);
-//
-//             final Component defPanel = defViewEditor.getDefaultView(clone);
-//FIXME
-               //              final CyNetworkView view = ((DefaultViewEditor) 
defPanel).getView();
-//             final Dimension panelSize = vizMapperMainPanel.getDefaultPanel()
-//                             .getSize();
-//
-//             if (view != null) {
-//                     System.out.println("Creating Default Image for new 
visual style "
-//                                     + newName);
-//                     vizMapperMainPanel.updateDefaultImage(clone, view, 
panelSize);
-//                     
vizMapperMainPanel.setDefaultViewImagePanel(vizMapperMainPanel
-//                                     .getDefaultImageManager().get(clone));
-//             }
-//
-//             vizMapperMainPanel.switchVS(clone);
-       }
-}

Deleted: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/RemoveMappingAction.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/RemoveMappingAction.java
    2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/action/RemoveMappingAction.java
    2010-11-06 02:21:05 UTC (rev 22753)
@@ -1,110 +0,0 @@
-package org.cytoscape.view.vizmap.gui.internal.action;
-
-import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
-import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.vizmap.VisualStyle;
-import org.cytoscape.view.vizmap.gui.internal.AbstractVizMapperPanel;
-import org.cytoscape.view.vizmap.gui.internal.VizMapperProperty;
-
-import com.l2fprod.common.propertysheet.Property;
-import com.l2fprod.common.propertysheet.PropertySheetTableModel.Item;
-
-public class RemoveMappingAction extends AbstractVizMapperAction {
-
-       private static final long serialVersionUID = -6131535468683162915L;
-       
-       public RemoveMappingAction(){
-               super();
-       }
-
-       public void actionPerformed(ActionEvent e) {
-
-               final int selected = propertySheetPanel.getTable()
-                               .getSelectedRow();
-               // FIXME
-
-//             if (0 <= selected) {
-//                     Item item = (Item) propertySheetPanel.getTable()
-//                                     .getValueAt(selected, 0);
-//                     Property curProp = item.getProperty();
-//
-//                     if (curProp instanceof VizMapperProperty) {
-//                             final VisualProperty<?> type = 
((VizMapperProperty<VisualProperty<?>>) curProp)
-//                                             .getHiddenObject();
-//
-//                             if (type == null)
-//                                     return;
-//
-//                             String[] message = {
-//                                             "The Mapping for " + 
type.getDisplayName()
-//                                                             + " will be 
removed.", "Proceed?" };
-//
-//                             int value = 
JOptionPane.showConfirmDialog(vizMapperMainPanel,
-//                                             message, "Remove Mapping", 
JOptionPane.YES_NO_OPTION);
-//
-//                             if (value == JOptionPane.YES_OPTION) {
-//                                     // If Continuous Mapper is displayed, 
kill it.
-//                                     if 
(editorWindowManager.isRegistered(type))
-//                                             
editorWindowManager.removeEditorWindow(type);
-//
-//                                     removeMapping(type);
-//                             }
-//                     }
-//             }
-       }
-
-       private <T> void removeMapping(final VisualProperty<T> type, 
VisualStyle style) {
-               //FIXME
-//             final VisualStyle vs = 
this.vizMapperMainPanel.getSelectedVisualStyle();
-//             
-//             // Remove mapping from the style.
-//             vs.removeVisualMappingFunction(type);
-//
-//             // Update GUI
-//             final Property[] props = propertySheetPanel
-//                             .getProperties();
-//             Property toBeRemoved = null;
-//
-//             for (Property p : props) {
-//                     if (p.getDisplayName().equals(type.getDisplayName())) {
-//                             toBeRemoved = p;
-//                             break;
-//                     }
-//             }
-//
-//             propertySheetPanel.removeProperty(toBeRemoved);
-//
-//             vizMapPropertySheetBuilder.removeProperty(toBeRemoved, style);
-//
-//             /*
-//              * Finally, move the visual property to "unused list"
-//              */
-//             vizMapPropertySheetBuilder.getUnusedVisualPropType().add(type);
-//
-//             VizMapperProperty<VisualProperty<T>> prop = new 
VizMapperProperty<VisualProperty<T>>();
-//             prop.setCategory(AbstractVizMapperPanel.CATEGORY_UNUSED);
-//             prop.setDisplayName(type.getDisplayName());
-//             prop.setHiddenObject(type);
-//             prop.setValue("Double-Click to create...");
-//             propertySheetPanel.addProperty(prop);
-//
-//             List<Property> target = 
vizMapPropertySheetBuilder.getPropertyMap().get(vs.getTitle());
-//             if (target != null)
-//                     target.add(prop);
-//
-//             propertySheetPanel.repaint();
-       }
-       
-       public void propertyChange(PropertyChangeEvent e) {
-               if(e.getPropertyName().equals("REMOVE_MAPPING") && 
e.getNewValue() != null) {
-                       // FIXME
-                       //removeMapping((VisualProperty) e.getNewValue());
-               }
-       }
-
-}

Added: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTask.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTask.java
                              (rev 0)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTask.java
      2010-11-06 02:21:05 UTC (rev 22753)
@@ -0,0 +1,48 @@
+package org.cytoscape.view.vizmap.gui.internal.task;
+
+import java.awt.Component;
+
+import org.cytoscape.view.vizmap.VisualMappingManager;
+import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.view.vizmap.VisualStyleFactory;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
+import org.cytoscape.view.vizmap.gui.internal.util.VizMapperUtil;
+import org.cytoscape.work.AbstractTask;
+import org.cytoscape.work.TaskMonitor;
+
+public class CopyVisualStyleTask extends AbstractTask {
+
+       private final SelectedVisualStyleManager manager;
+       private final VizMapperUtil util;
+       private final Component parent;
+       private final VisualMappingManager vmm;
+
+       private final VisualStyleFactory factory;
+
+       public CopyVisualStyleTask(final VisualMappingManager vmm,
+                       final VisualStyleFactory factory,
+                       final SelectedVisualStyleManager manager, final 
VizMapperUtil util,
+                       final Component parent) {
+
+               this.manager = manager;
+               this.util = util;
+               this.parent = parent;
+               this.factory = factory;
+               this.vmm = vmm;
+       }
+
+       @Override
+       public void run(TaskMonitor monitor) throws Exception {
+
+               final VisualStyle originalStyle = 
manager.getCurrentVisualStyle();
+               final String name = util.getStyleName(parent, originalStyle);
+
+               // Ignore if user does not enter new name.
+               if (name == null)
+                       return;
+
+               final VisualStyle copiedStyle = 
factory.getInstance(originalStyle);
+               vmm.addVisualStyle(copiedStyle);
+       }
+
+}

Added: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTaskFactory.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTaskFactory.java
                               (rev 0)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/CopyVisualStyleTaskFactory.java
       2010-11-06 02:21:05 UTC (rev 22753)
@@ -0,0 +1,38 @@
+package org.cytoscape.view.vizmap.gui.internal.task;
+
+import java.awt.Component;
+
+import org.cytoscape.view.vizmap.VisualMappingManager;
+import org.cytoscape.view.vizmap.VisualStyleFactory;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
+import org.cytoscape.view.vizmap.gui.internal.util.VizMapperUtil;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.TaskIterator;
+
+public class CopyVisualStyleTaskFactory implements TaskFactory {
+
+       private final SelectedVisualStyleManager manager;
+       private final VizMapperUtil util;
+       private final Component parent;
+       private final VisualMappingManager vmm;
+
+       private final VisualStyleFactory factory;
+
+       public CopyVisualStyleTaskFactory(final VisualMappingManager vmm,
+                       final VisualStyleFactory factory,
+                       final SelectedVisualStyleManager manager, final 
VizMapperUtil util,
+                       final Component parent) {
+               this.manager = manager;
+               this.vmm = vmm;
+               this.util = util;
+               this.factory = factory;
+               this.parent = parent;
+       }
+
+       @Override
+       public TaskIterator getTaskIterator() {
+               return new TaskIterator(new CopyVisualStyleTask(vmm, factory, 
manager,
+                               util, parent));
+       }
+
+}

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/RenameVisualStyleTaskFactory.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/RenameVisualStyleTaskFactory.java
     2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/RenameVisualStyleTaskFactory.java
     2010-11-06 02:21:05 UTC (rev 22753)
@@ -1,5 +1,33 @@
 package org.cytoscape.view.vizmap.gui.internal.task;
 
-public class RenameVisualStyleTaskFactory {
+import java.awt.Component;
 
+import org.cytoscape.view.vizmap.VisualMappingManager;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
+import org.cytoscape.view.vizmap.gui.internal.util.VizMapperUtil;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.TaskIterator;
+
+public class RenameVisualStyleTaskFactory implements TaskFactory {
+
+       private final VisualMappingManager vmm;
+       private final SelectedVisualStyleManager manager;
+       private final VizMapperUtil util;
+       private final Component parent;
+
+       public RenameVisualStyleTaskFactory(final VisualMappingManager vmm,
+                       final SelectedVisualStyleManager manager, final 
VizMapperUtil util,
+                       final Component parent) {
+               this.manager = manager;
+               this.vmm = vmm;
+               this.util = util;
+               this.parent = parent;
+       }
+
+       @Override
+       public TaskIterator getTaskIterator() {
+               return new TaskIterator(new RenameVisualStyleTask(manager, vmm, 
util,
+                               parent));
+       }
+
 }

Added: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
                            (rev 0)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
    2010-11-06 02:21:05 UTC (rev 22753)
@@ -0,0 +1,5 @@
+package org.cytoscape.view.vizmap.gui.internal.task.generators;
+
+public class GenerateValuesTask {
+
+}

Added: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
                             (rev 0)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
     2010-11-06 02:21:05 UTC (rev 22753)
@@ -0,0 +1,5 @@
+package org.cytoscape.view.vizmap.gui.internal.task.generators;
+
+public class GenerateValuesTaskFactory {
+
+}

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/VizMapperUtil.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/VizMapperUtil.java
    2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/VizMapperUtil.java
    2010-11-06 02:21:05 UTC (rev 22753)
@@ -49,7 +49,7 @@
                // name
                while (true) {
                        String ret = (String) 
JOptionPane.showInputDialog(parentComponent,
-                                       "Please enter new name for the visual 
style.",
+                                       "Please enter name for the new Visual 
Style.",
                                        "Enter Visual Style Name", 
JOptionPane.QUESTION_MESSAGE,
                                        null, null, suggestedName);
 

Modified: 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
    2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
    2010-11-06 02:21:05 UTC (rev 22753)
@@ -4,10 +4,6 @@
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                       http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd";
        default-lazy-init="false">
-
-
-       <!-- Export Ding's default VS as service. -->
-       <osgi:service id="defaultVSService" ref="defaultVS" 
auto-export="interfaces" />
        
        <!-- Export Service Listeners -->
        <osgi:service id="selectedVisualStyleManagerService" 
ref="selectedVisualStyleManager" auto-export="interfaces" />
@@ -108,14 +104,27 @@
                <osgi:service-properties>
                        <entry key="service.type" value="vizmapUI.taskFactory" 
/>
                        <entry key="menu" value="main" />
-                       <entry key="title" value="Remove Selected Visual Style" 
/>
+                       <entry key="title" value="Remove Visual Style" />
                </osgi:service-properties>
        </osgi:service>
+       <osgi:service id="renameVisualStyleTaskFactoryService"
+               ref="renameVisualStyleTaskFactory" auto-export="interfaces">
+               <osgi:service-properties>
+                       <entry key="service.type" value="vizmapUI.taskFactory" 
/>
+                       <entry key="menu" value="main" />
+                       <entry key="title" value="Rename Visual Style" />
+               </osgi:service-properties>
+       </osgi:service>
+       <osgi:service id="copyVisualStyleTaskFactoryService"
+               ref="copyVisualStyleTaskFactory" auto-export="interfaces">
+               <osgi:service-properties>
+                       <entry key="service.type" value="vizmapUI.taskFactory" 
/>
+                       <entry key="menu" value="main" />
+                       <entry key="title" value="Copy Visual Style" />
+               </osgi:service-properties>
+       </osgi:service>
+       
 
-       
-       
-       <osgi:service id="copyStyleActionService" ref="copyStyleAction"
-               interface="org.cytoscape.view.vizmap.gui.action.VizMapUIAction" 
/>
        <osgi:service id="createLegendActionService" ref="createLegendAction"
                interface="org.cytoscape.view.vizmap.gui.action.VizMapUIAction" 
/>
 
@@ -139,12 +148,6 @@
                </osgi:service-properties>
        </osgi:service>
 
-       <osgi:service id="removeMappingActionService" ref="removeMappingAction"
-               interface="org.cytoscape.view.vizmap.gui.action.VizMapUIAction">
-               <osgi:service-properties>
-                       <entry key="service.type" value="vizmapUI.contextMenu" 
/>
-               </osgi:service-properties>
-       </osgi:service>
 
        <osgi:set id="vizMapperActionServiceRef"
                interface="org.cytoscape.view.vizmap.gui.action.VizMapUIAction"

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
 2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
 2010-11-06 02:21:05 UTC (rev 22753)
@@ -27,7 +27,7 @@
        </bean>
        
        <bean id="selectedVisualStyleManager" 
class="org.cytoscape.view.vizmap.gui.internal.SelectedVisualStyleManagerImpl">
-               <constructor-arg ref="defaultVS" />
+               <constructor-arg ref="vmmServiceRef" />
        </bean>
 
        <!-- Default Visual Style Builder -->
@@ -172,7 +172,6 @@
                <constructor-arg ref="defaultViewPanel" />
                <constructor-arg ref="editorManager" />
                <constructor-arg ref="cyApplicationManagerServiceRef" />
-               <constructor-arg ref="defaultVS" />
                <constructor-arg ref="vmmServiceRef" />
        </bean>
 
@@ -186,8 +185,7 @@
        <!-- Task Factories for Vizmapper. These actions will be exported as 
Service. -->
 
        <bean name="createNewVisualStyleTaskFactory"
-               
class="org.cytoscape.view.vizmap.gui.internal.task.CreateNewVisualStyleTaskFactory"
-               depends-on="vizMapperMainPanel">
+               
class="org.cytoscape.view.vizmap.gui.internal.task.CreateNewVisualStyleTaskFactory">
                <constructor-arg ref="visualStyleFactoryServiceRef" />
                <constructor-arg ref="vizMapperUtil" />
                <constructor-arg ref="dingVisualLexiconServiceRef" />
@@ -195,11 +193,27 @@
        </bean>
        
        <bean name="removeVisualStyleTaskFactory"
-               
class="org.cytoscape.view.vizmap.gui.internal.task.DeleteVisualStyleTaskFactory"
-               depends-on="vizMapperMainPanel">
+               
class="org.cytoscape.view.vizmap.gui.internal.task.DeleteVisualStyleTaskFactory">
                <constructor-arg ref="vmmServiceRef" />
                <constructor-arg ref="selectedVisualStyleManager"/>
        </bean>
+       
+       <bean name="renameVisualStyleTaskFactory"
+               
class="org.cytoscape.view.vizmap.gui.internal.task.RenameVisualStyleTaskFactory">
+               <constructor-arg ref="vmmServiceRef" />
+               <constructor-arg ref="selectedVisualStyleManager"/>
+               <constructor-arg ref="vizMapperUtil" />
+               <constructor-arg ref="vizMapperMainPanel" />
+       </bean>
+       
+       <bean name="copyVisualStyleTaskFactory"
+               
class="org.cytoscape.view.vizmap.gui.internal.task.CopyVisualStyleTaskFactory">
+               <constructor-arg ref="visualStyleFactoryServiceRef" />
+               <constructor-arg ref="vmmServiceRef" />
+               <constructor-arg ref="selectedVisualStyleManager"/>
+               <constructor-arg ref="vizMapperUtil" />
+               <constructor-arg ref="vizMapperMainPanel" />
+       </bean>
 
 
        <!--<bean name="removeStyleAction"
@@ -219,16 +233,6 @@
                <constructor-arg ref="vizMapperUtil" />
        </bean>-->
 
-       <bean name="copyStyleAction"
-               
class="org.cytoscape.view.vizmap.gui.internal.action.CopyStyleAction"
-               autowire="autodetect" depends-on="vizMapperMainPanel">
-               <property name="menuLabel" 
value="${vizMapperMainPanel.menu.copyStyleAction}" />
-               <property name="iconId"
-                       value="${vizMapperMainPanel.menu.copyStyleAction.icon}" 
/>
-
-               <constructor-arg ref="vizMapperUtil" />
-       </bean>
-
        <bean name="createLegendAction"
                
class="org.cytoscape.view.vizmap.gui.internal.action.CreateLegendAction"
                autowire="autodetect" depends-on="vizMapperMainPanel">
@@ -259,14 +263,6 @@
        <bean id="filledBoxRenderer" 
class="javax.swing.table.DefaultTableCellRenderer" />
 
        <!-- Context Menu Commands -->
-       <bean name="removeMappingAction"
-               
class="org.cytoscape.view.vizmap.gui.internal.action.RemoveMappingAction"
-               depends-on="vizMapperMainPanel" autowire="autodetect">
-               <property name="menuLabel"
-                       value="${vizMapperMainPanel.menu.removeMappingAction}" 
/>
-               <property name="iconId"
-                       
value="${vizMapperMainPanel.menu.removeMappingAction.icon}" />
-       </bean>
 
        <bean id="vizMapPropertySheetBuilder"
                
class="org.cytoscape.view.vizmap.gui.internal.VizMapPropertySheetBuilder">
@@ -294,12 +290,6 @@
                <constructor-arg ref="propertySheetPanel" />
        </bean>
 
-       <!-- Create Default Visual Style using VMM -->
-       <bean id="defaultVS" factory-bean="defaultVisualStyleBuilder"
-               factory-method="getDefaultStyle">
-               <constructor-arg ref="dingVisualLexiconServiceRef" />
-       </bean>
-
        <bean name="vizMapperMainPanel"
                
class="org.cytoscape.view.vizmap.gui.internal.VizMapperMainPanel"
                depends-on="colorMgr,

Modified: 
core3/vizmap-impl/trunk/src/main/java/org/cytoscape/view/vizmap/internal/VisualMappingManagerImpl.java
===================================================================
--- 
core3/vizmap-impl/trunk/src/main/java/org/cytoscape/view/vizmap/internal/VisualMappingManagerImpl.java
      2010-11-06 01:39:48 UTC (rev 22752)
+++ 
core3/vizmap-impl/trunk/src/main/java/org/cytoscape/view/vizmap/internal/VisualMappingManagerImpl.java
      2010-11-06 02:21:05 UTC (rev 22753)
@@ -41,11 +41,7 @@
 
 import org.cytoscape.event.CyEventHelper;
 import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.view.model.NullDataType;
 import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.property.NullVisualProperty;
-import org.cytoscape.view.presentation.property.TwoDVisualLexicon;
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.view.vizmap.VisualStyle;
 import org.cytoscape.view.vizmap.VisualStyleFactory;
@@ -58,7 +54,7 @@
 public class VisualMappingManagerImpl implements VisualMappingManager {
        private static final String DEFAULT_STYLE_NAME = "Default";
 
-       private VisualStyle defaultStyle;
+       private final VisualStyle defaultStyle;
 
        private final Map<CyNetworkView, VisualStyle> network2VisualStyleMap;
        private final Set<VisualStyle> visualStyles;
@@ -142,10 +138,15 @@
                        throw new IllegalArgumentException(
                                        "Cannot remove default visual style.");
 
-               if (this.network2VisualStyleMap.values().contains(vs))
-                       throw new IllegalArgumentException(
-                                       "Visual Style is associated with a view 
and cannot be removed.");
-
+               
+               // Use default for all views using this vs.
+               if (this.network2VisualStyleMap.values().contains(vs)) {
+                       for(final CyNetworkView view: 
network2VisualStyleMap.keySet()) {
+                               if(network2VisualStyleMap.get(view).equals(vs))
+                                       network2VisualStyleMap.put(view, 
defaultStyle);
+                       }
+               }
+               
                cyEventHelper
                                .fireSynchronousEvent(new 
VisualStyleAboutToBeRemovedEvent(
                                                this, vs));

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