Author: kono
Date: 2012-07-03 18:08:20 -0700 (Tue, 03 Jul 2012)
New Revision: 29752

Added:
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/VisualStyleBuilder.java
Removed:
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/VisualStyleBuilder.java
Modified:
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalysisExecutor.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyActivator.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/data/Messages.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/AnalysisDialog.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/ConnComponentsDialog.java
   
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/MapParameterDialog.java
Log:
fixes #1201 Visualization function enabled.

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalysisExecutor.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalysisExecutor.java
        2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalysisExecutor.java
        2012-07-04 01:08:20 UTC (rev 29752)
@@ -32,6 +32,7 @@
 import org.slf4j.LoggerFactory;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
 import de.mpg.mpi_inf.bioinf.netanalyzer.ui.AnalysisDialog;
+import de.mpg.mpi_inf.bioinf.netanalyzer.ui.VisualStyleBuilder;
 
 /**
  * Initializer and starter of a separate thread dedicated to network analysis.

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
    2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
    2012-07-04 01:08:20 UTC (rev 29752)
@@ -35,6 +35,7 @@
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.NetworkStatus;
 import de.mpg.mpi_inf.bioinf.netanalyzer.ui.InterpretationDialog;
 import de.mpg.mpi_inf.bioinf.netanalyzer.ui.Utils;
+import de.mpg.mpi_inf.bioinf.netanalyzer.ui.VisualStyleBuilder;
 
 /**
  * Action handler for the menu item "Analyze Network".

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
     2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
     2012-07-04 01:08:20 UTC (rev 29752)
@@ -23,6 +23,8 @@
 
 import org.cytoscape.application.CyApplicationManager;
 import org.cytoscape.application.swing.CySwingApplication;
+import org.cytoscape.task.create.NewNetworkSelectedNodesAndEdgesTaskFatory;
+import org.cytoscape.work.TaskManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.CCInfo;
@@ -40,11 +42,17 @@
 
        private static final Logger logger = 
LoggerFactory.getLogger(ConnComponentAction.class);
 
+       private final NewNetworkSelectedNodesAndEdgesTaskFatory tf;
+       private final TaskManager<?, ?> tm;
+       
        /**
         * Initializes a new instance of <code>ConnComponentAction</code>.
         */
-       public ConnComponentAction(CyApplicationManager 
appMgr,CySwingApplication swingApp) {
+       public ConnComponentAction(CyApplicationManager 
appMgr,CySwingApplication swingApp, final 
NewNetworkSelectedNodesAndEdgesTaskFatory tf, final TaskManager<?, ?> tm) {
                super(Messages.AC_CONNCOMP,appMgr,swingApp);
+               this.tf = tf;
+               this.tm = tm;
+               
                setPreferredMenu(NetworkAnalyzer.PARENT_MENU + 
Messages.AC_MENU_MODIFICATION);
        }
 
@@ -72,7 +80,7 @@
                                
Utils.showInfoBox(swingApp.getJFrame(),Messages.DT_CONNCOMP, msg);
                        } else {
                                Arrays.sort(comps, new CCInfoInvComparator());
-                               ConnComponentsDialog d = new 
ConnComponentsDialog(swingApp.getJFrame(), network, comps);
+                               ConnComponentsDialog d = new 
ConnComponentsDialog(swingApp.getJFrame(), network, comps, tf, tm);
                                d.setVisible(true);
                        }
                } catch (InnerException ex) {

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyActivator.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyActivator.java
     2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyActivator.java
     2012-07-04 01:08:20 UTC (rev 29752)
@@ -1,7 +1,3 @@
-
-
-
-
 package de.mpg.mpi_inf.bioinf.netanalyzer;
 
 import org.cytoscape.application.swing.CySwingApplication;
@@ -22,6 +18,7 @@
 import de.mpg.mpi_inf.bioinf.netanalyzer.AboutAction;
 import de.mpg.mpi_inf.bioinf.netanalyzer.LoadNetstatsAction;
 import de.mpg.mpi_inf.bioinf.netanalyzer.AnalyzeNetworkAction;
+import de.mpg.mpi_inf.bioinf.netanalyzer.ui.VisualStyleBuilder;
 
 import org.cytoscape.application.swing.CyAction;
 
@@ -29,10 +26,12 @@
 import org.osgi.framework.BundleContext;
 
 import org.cytoscape.service.util.AbstractCyActivator;
+import org.cytoscape.task.create.NewNetworkSelectedNodesAndEdgesTaskFatory;
 import org.cytoscape.view.model.CyNetworkViewManager;
 import org.cytoscape.view.vizmap.VisualMappingFunctionFactory;
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.view.vizmap.VisualStyleFactory;
+import org.cytoscape.work.swing.DialogTaskManager;
 
 import java.util.Properties;
 
@@ -43,7 +42,8 @@
                super();
        }
 
-
+       
+       @Override
        public void start(BundleContext bc) {
 
                CyApplicationManager cyApplicationManagerServiceRef = 
getService(bc,CyApplicationManager.class);
@@ -58,6 +58,10 @@
                VisualMappingFunctionFactory continupousMappingFactoryRef = 
getService(bc,VisualMappingFunctionFactory.class,"(mapping.type=continuous)");
                VisualMappingFunctionFactory passthroughMappingFactoryRef = 
getService(bc,VisualMappingFunctionFactory.class,"(mapping.type=passthrough)");
                
+               // Create network from selection
+               NewNetworkSelectedNodesAndEdgesTaskFatory 
newNetworkSelectedNodesEdgesTaskFactoryServiceRef = 
getService(bc,NewNetworkSelectedNodesAndEdgesTaskFatory.class);
+               DialogTaskManager taskManager = getService(bc, 
DialogTaskManager.class);
+               
                // FIXME refactor this code
                Plugin plugin = new Plugin(cySwingApplicationServiceRef);
                
@@ -71,17 +75,16 @@
                AboutAction aboutAction = new 
AboutAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef);
                AnalyzeSubsetAction analyzeSubsetAction = new 
AnalyzeSubsetAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,
 analyzeNetworkAction);
                BatchAnalysisAction batchAnalysisAction = new 
BatchAnalysisAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,cyNetworkManagerServiceRef,cyNetworkViewReaderManagerServiceRef,
 loadNetstatsAction);
-               CompareAction compareAction = new 
CompareAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,cyNetworkManagerServiceRef);
-               ConnComponentAction connComponentAction = new 
ConnComponentAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef);
                
+               // Disabled because similar function is available from Network 
Merge
+               //CompareAction compareAction = new 
CompareAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,cyNetworkManagerServiceRef);
+               ConnComponentAction connComponentAction = new 
ConnComponentAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,
 newNetworkSelectedNodesEdgesTaskFactoryServiceRef, taskManager);
                
                PlotParameterAction plotParameterAction = new 
PlotParameterAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,
 analyzeNetworkAction);
                RemDupEdgesAction remDupEdgesAction = new 
RemDupEdgesAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,cyNetworkManagerServiceRef);
                RemoveSelfLoopsAction removeSelfLoopsAction = new 
RemoveSelfLoopsAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef,cyNetworkManagerServiceRef);
                SettingsAction settingsAction = new 
SettingsAction(cyApplicationManagerServiceRef,cySwingApplicationServiceRef);
                
-
-               
                registerService(bc,analyzeNetworkAction,CyAction.class, new 
Properties());
                registerService(bc,analyzeSubsetAction,CyAction.class, new 
Properties());
                registerService(bc,batchAnalysisAction,CyAction.class, new 
Properties());
@@ -89,11 +92,10 @@
                registerService(bc,plotParameterAction,CyAction.class, new 
Properties());
                registerService(bc,mapParameterAction,CyAction.class, new 
Properties());
                registerService(bc,settingsAction,CyAction.class, new 
Properties());
-               registerService(bc,compareAction,CyAction.class, new 
Properties());
+               //registerService(bc,compareAction,CyAction.class, new 
Properties());
                registerService(bc,connComponentAction,CyAction.class, new 
Properties());
                registerService(bc,remDupEdgesAction,CyAction.class, new 
Properties());
                registerService(bc,removeSelfLoopsAction,CyAction.class, new 
Properties());
                registerService(bc,aboutAction,CyAction.class, new 
Properties());
        }
-}
-
+}
\ No newline at end of file

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
      2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
      2012-07-04 01:08:20 UTC (rev 29752)
@@ -36,6 +36,7 @@
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.io.StatsSerializer;
 import de.mpg.mpi_inf.bioinf.netanalyzer.ui.AnalysisDialog;
 import de.mpg.mpi_inf.bioinf.netanalyzer.ui.Utils;
+import de.mpg.mpi_inf.bioinf.netanalyzer.ui.VisualStyleBuilder;
 
 /**
  * Action handler for the menu item &quot;Load Network Statistics&quot;.

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
      2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
      2012-07-04 01:08:20 UTC (rev 29752)
@@ -31,6 +31,7 @@
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.io.SettingsSerializer;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.settings.PluginSettings;
 import de.mpg.mpi_inf.bioinf.netanalyzer.ui.MapParameterDialog;
+import de.mpg.mpi_inf.bioinf.netanalyzer.ui.VisualStyleBuilder;
 
 /**
  * Action handler for the menu item &quot;Visualize Parameters&quot;.

Deleted: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/VisualStyleBuilder.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/VisualStyleBuilder.java
      2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/VisualStyleBuilder.java
      2012-07-04 01:08:20 UTC (rev 29752)
@@ -1,140 +0,0 @@
-package de.mpg.mpi_inf.bioinf.netanalyzer;
-
-import java.awt.Color;
-
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.view.presentation.property.BasicVisualLexicon;
-import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
-import org.cytoscape.view.vizmap.VisualMappingFunctionFactory;
-import org.cytoscape.view.vizmap.VisualStyle;
-import org.cytoscape.view.vizmap.VisualStyleFactory;
-import org.cytoscape.view.vizmap.mappings.PassthroughMapping;
-
-import de.mpg.mpi_inf.bioinf.netanalyzer.data.io.SettingsSerializer;
-
-public class VisualStyleBuilder {
-
-       private static final String VS_NAME_PREFIX = "Network Analyzer Style: ";
-
-       // Preset defaults
-       private static final Color NODE_COLOR = Color.WHITE;
-       private static final Color NODE_LABEL_COLOR = new Color(100, 100, 100);
-       private static final Color EDGE_COLOR = new Color(100, 100, 100);
-
-       private final VisualStyleFactory vsFactory;
-
-       private final VisualMappingFunctionFactory passthroughFactory;
-       private final VisualMappingFunctionFactory continuousFactory;
-
-       public VisualStyleBuilder(final VisualStyleFactory vsFactory,
-                       final VisualMappingFunctionFactory passthroughFactory, 
final VisualMappingFunctionFactory continuousFactory) {
-               this.vsFactory = vsFactory;
-               this.passthroughFactory = passthroughFactory;
-               this.continuousFactory = continuousFactory;
-       }
-
-       /**
-        * Creates a new visual style in Cytoscape's VizMapper depending on the 
by
-        * the user defined mappings of computed attributes.
-        * 
-        * @return New visual style.
-        **/
-       public VisualStyle createVisualStyle(final CyNetworkView networkView) {
-
-               final CyNetwork network = networkView.getModel();
-               // Create new visual style
-               final String name = network.getRow(network).get(CyNetwork.NAME, 
String.class);
-               final VisualStyle visualStyle = 
vsFactory.createVisualStyle(VS_NAME_PREFIX + name);
-
-               // Network VP
-               final Color backGroundColor = 
SettingsSerializer.getPluginSettings().getBackgroundColor();
-               
visualStyle.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT, 
backGroundColor);
-
-               // Node Label Mapping
-               final PassthroughMapping<String, String> labelPassthrough = 
(PassthroughMapping<String, String>) passthroughFactory
-                               .createVisualMappingFunction(CyNetwork.NAME, 
String.class, BasicVisualLexicon.NODE_LABEL);
-               visualStyle.addVisualMappingFunction(labelPassthrough);
-
-               // Node View Defaults
-               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, 
NodeShapeVisualProperty.ELLIPSE);
-               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, 
NODE_COLOR);
-               
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_LABEL_COLOR, 
NODE_LABEL_COLOR);
-               
-               
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_BORDER_WIDTH, 0.0d);
-               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_WIDTH, 30d);
-               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_HEIGHT, 
30d);
-               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 30d);
-
-               // Edge View Defaults
-               visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_WIDTH, 
3.0d);
-               visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_PAINT, 
EDGE_COLOR);
-
-               // // Apply new visual settings
-               // if (attrNodeColor.length() > 0) {
-               // // Continuous Mapping - set node color
-               // name += "_NodeColor_" + attrNodeColor;
-               // ContinuousMapping conMapNodeColor = 
getColorMapping(attrNodeColor,
-               // ObjectMapping.NODE_MAPPING);
-               // conMapNodeColor = addBoundaries(conMapNodeColor, 
attrNodeColor,
-               // mapNodeColor, SettingsSerializer
-               // .getPluginSettings().getBrightColor(),
-               // SettingsSerializer.getPluginSettings().getMiddleColor(),
-               // SettingsSerializer.getPluginSettings().getDarkColor());
-               // Calculator nodeColorCalculator = new
-               // BasicCalculator("NetworkAnalyzer Node Color Calc", 
conMapNodeColor,
-               // VisualPropertyType.NODE_FILL_COLOR);
-               // nodeAppCalc.setCalculator(nodeColorCalculator);
-               // }
-               // if (attrNodeSize.length() > 0) {
-               // // Continuous Mapping - set node size
-               // name += "_NodeSize_" + attrNodeSize;
-               // 
visualStyle.getDependency().set(VisualPropertyDependency.Definition.NODE_SIZE_LOCKED,
-               // false);
-               // ContinuousMapping conMapNodeSize = 
getSizeMapping(attrNodeSize,
-               // ObjectMapping.NODE_MAPPING);
-               // conMapNodeSize = addBoundaries(conMapNodeSize, attrNodeSize,
-               // mapNodeSize, new Double(10.0),
-               // new Double(50.0), new Double(100.0));
-               // Calculator nodeHeightCalculator = new
-               // BasicCalculator("NetworkAnalyzer Node Height Calc", 
conMapNodeSize,
-               // VisualPropertyType.NODE_HEIGHT);
-               // Calculator nodeWidthCalculator = new
-               // BasicCalculator("NetworkAnalyzer Node Width Calc", 
conMapNodeSize,
-               // VisualPropertyType.NODE_WIDTH);
-               // nodeAppCalc.setCalculator(nodeHeightCalculator);
-               // nodeAppCalc.setCalculator(nodeWidthCalculator);
-               // }
-               // if (attrEdgeColor.length() > 0) {
-               // // Continuous Mapping - set edge color
-               // name += "_EdgeColor_" + attrEdgeColor;
-               // ContinuousMapping conMapEdgeColor = 
getColorMapping(attrEdgeColor,
-               // ObjectMapping.EDGE_MAPPING);
-               // conMapEdgeColor = addBoundaries(conMapEdgeColor, 
attrEdgeColor,
-               // mapEdgeColor, SettingsSerializer
-               // .getPluginSettings().getBrightColor(),
-               // SettingsSerializer.getPluginSettings().getMiddleColor(),
-               // SettingsSerializer.getPluginSettings().getDarkColor());
-               // Calculator edgeColorCalculator = new
-               // BasicCalculator("NetworkAnalyzer Edge Color Calc", 
conMapEdgeColor,
-               // VisualPropertyType.EDGE_COLOR);
-               // edgeAppCalc.setCalculator(edgeColorCalculator);
-               // }
-               // if (attrEdgeSize.length() > 0) {
-               // // Continuous Mapping - set line width
-               // name += "_EdgeSize_" + attrEdgeSize;
-               // ContinuousMapping conMapEdgeSize = 
getSizeMapping(attrEdgeSize,
-               // ObjectMapping.EDGE_MAPPING);
-               // conMapEdgeSize = addBoundaries(conMapEdgeSize, attrEdgeSize,
-               // mapEdgeSize, new Double(1.0), new Double(4.0),
-               // new Double(8.0));
-               // Calculator edgeSizeCalculator = new
-               // BasicCalculator("NetworkAnalyzer Edge Size Calc", 
conMapEdgeSize,
-               // VisualPropertyType.EDGE_LINE_WIDTH);
-               // edgeAppCalc.setCalculator(edgeSizeCalculator);
-               // }
-
-               return visualStyle;
-       }
-
-}

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/data/Messages.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/data/Messages.java
   2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/data/Messages.java
   2012-07-04 01:08:20 UTC (rev 29752)
@@ -215,7 +215,10 @@
 
        public static String SM_CHOOSEINTERPR = "Please choose an 
interpretation for the edges.";
 
-       public static String SM_CLOSEWARN = "<html>You have not saved the 
network statistics. They will be lost when you close this window.<br>Are you 
sure you want to close the window?";
+       public static String SM_CLOSEWARN = "<html>You have not saved the 
network statistics. " +
+                       "They will be lost when you close this window." +
+                       "<br /><br />Are you sure you want to close the 
window?<br /><br />" +
+                       "(Note: Statistics will be saved as normal table data, 
not the Network Analyzer property file)</html>";
 
        public static String SM_CONNECTED = " is connected, i.e. has a single 
connected component.";
 
@@ -332,7 +335,7 @@
 
        public static String AC_COMPARE = "Compare Two Networks";
 
-       public static String AC_CONNCOMP = "Connected Components";
+       public static String AC_CONNCOMP = "Extract Connected Components...";
 
        public static String AC_LOAD = "Load Network Statistics";
 
@@ -344,7 +347,7 @@
        /**
         * Name of Submenu in Cytoscape's menubar, where network modification 
actions are added.
         */
-       public static String AC_MENU_MODIFICATION = "Network Modifications";
+       public static String AC_MENU_MODIFICATION = "Subnetwork Creation";
 
        public static String AC_PLOTPARAM = "Plot Parameters";
 
@@ -354,7 +357,7 @@
 
        public static String AC_REMSELFLOOPS = "Remove Self-Loops";
 
-       public static String AC_MAPPARAM = "Visualize Parameters";
+       public static String AC_MAPPARAM = "Generate Visual Style from 
Statistics...";
 
        // Labels of items in dialogs
 

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/AnalysisDialog.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/AnalysisDialog.java
       2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/AnalysisDialog.java
       2012-07-04 01:08:20 UTC (rev 29752)
@@ -47,7 +47,6 @@
 import de.mpg.mpi_inf.bioinf.netanalyzer.InnerException;
 import de.mpg.mpi_inf.bioinf.netanalyzer.NetworkAnalyzer;
 import de.mpg.mpi_inf.bioinf.netanalyzer.Plugin;
-import de.mpg.mpi_inf.bioinf.netanalyzer.VisualStyleBuilder;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.ComplexParam;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.Decorators;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/ConnComponentsDialog.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/ConnComponentsDialog.java
 2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/ConnComponentsDialog.java
 2012-07-04 01:08:20 UTC (rev 29752)
@@ -49,6 +49,12 @@
 import org.cytoscape.model.CyEdge;
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.task.create.NewNetworkSelectedNodesAndEdgesTaskFatory;
+import org.cytoscape.work.AbstractTask;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskManager;
+import org.cytoscape.work.TaskMonitor;
 
 import de.mpg.mpi_inf.bioinf.netanalyzer.ConnComponentAnalyzer;
 import de.mpg.mpi_inf.bioinf.netanalyzer.CyNetworkUtils;
@@ -64,6 +70,9 @@
 public class ConnComponentsDialog extends JDialog
        implements ActionListener, DocumentListener, ListSelectionListener {
 
+       private final NewNetworkSelectedNodesAndEdgesTaskFatory tf;
+       private final TaskManager<?, ?> tm;
+       
        /**
         * Initializes a new instance of <code>ConnComponentsDialog</code>.
         * 
@@ -73,11 +82,15 @@
         * @throws HeadlessException if 
<code>GraphicsEnvironment.isHeadless()</code> returns
         *         <code>true</code>.
         */
-       public ConnComponentsDialog(Frame aOwner, CyNetwork aNetwork, CCInfo[] 
aComponents)
+       public ConnComponentsDialog(Frame aOwner, CyNetwork aNetwork, CCInfo[] 
aComponents,
+                       final NewNetworkSelectedNodesAndEdgesTaskFatory tf, 
final TaskManager<?, ?> tm)
                throws HeadlessException {
                super(aOwner, Messages.DT_CONNCOMP, true);
                network = aNetwork;
                components = aComponents;
+               this.tf = tf;
+               this.tm = tm;
+               
                initControls();
                pack();
                setResizable(false);
@@ -95,13 +108,24 @@
                        setVisible(false);
                        dispose();
                } else if (btnExtract == src) {
+                       // Reset
+                       for(CyNode node: network.getNodeList())
+                               network.getRow(node).set(CyNetwork.SELECTED, 
false);
+                       for(CyEdge edge: network.getEdgeList())
+                               network.getRow(edge).set(CyNetwork.SELECTED, 
false);
+                       
                        CCInfo comp = components[listComp.getSelectedIndex()];
-                       ArrayList<CyNode> nodes = new 
ArrayList<CyNode>(ConnComponentAnalyzer.getNodesOf(network, comp));
-                       Set<CyEdge> edges = 
CyNetworkUtils.getAllConnectingEdges(network,nodes);
-                       // TODO figure out what the procedure should be for 
creating new networks from selected nodes/edges.
-                       // This should be resolved in the 
NewNetworkFromNodesAndEdges tasks in core-task-impl, not here.
-//                     Cytoscape.createNetwork(nodes, edges, 
fieldNetName.getText());
-                       JOptionPane.showMessageDialog(getOwner(), "This 
functionality is not yet implemented");
+                       final List<CyNode> nodes = new 
ArrayList<CyNode>(ConnComponentAnalyzer.getNodesOf(network, comp));
+                       final Set<CyEdge> edges = 
CyNetworkUtils.getAllConnectingEdges(network,nodes);
+                       
+                       for(CyNode node: nodes)
+                               network.getRow(node).set(CyNetwork.SELECTED, 
true);
+                       for(CyEdge edge: edges)
+                               network.getRow(edge).set(CyNetwork.SELECTED, 
true);
+                       
+                       final TaskIterator itr = tf.createTaskIterator(network);
+                       tm.execute(itr);
+                       //fieldNetName.getText();
                }
        }
 
@@ -124,7 +148,7 @@
                        } else {
                                title = title + "_" + i;
                        }
-                       fieldNetName.setText(title);
+                       //fieldNetName.setText(title);
                }
        }
 
@@ -194,22 +218,23 @@
                panList.add(scrollList);
                contentPane.add(panList);
 
-               JPanel panExtract = new JPanel(new BorderLayout());
-               
panExtract.setBorder(BorderFactory.createTitledBorder(Messages.DI_EXTRCOMP));
-               panExtract.add(new JLabel(Messages.DI_EXTRCOMPLONG), 
BorderLayout.NORTH);
-               fieldNetName = new JTextField();
-               fieldNetName.getDocument().addDocumentListener(this);
-               panExtract.add(fieldNetName, BorderLayout.CENTER);
+//             JPanel panExtract = new JPanel(new BorderLayout());
+//             
panExtract.setBorder(BorderFactory.createTitledBorder(Messages.DI_EXTRCOMP));
+//             panExtract.add(new JLabel(Messages.DI_EXTRCOMPLONG), 
BorderLayout.NORTH);
+//             fieldNetName = new JTextField();
+//             fieldNetName.getDocument().addDocumentListener(this);
+//             panExtract.add(fieldNetName, BorderLayout.CENTER);
                btnExtract = Utils.createButton(Messages.DI_EXTR, null, this);
                btnExtract.setEnabled(false);
-               JPanel panExtr = new JPanel(new 
FlowLayout(FlowLayout.TRAILING));
-               panExtr.add(btnExtract);
-               panExtract.add(panExtr, BorderLayout.SOUTH);
-               contentPane.add(panExtract);
+//             JPanel panExtr = new JPanel(new 
FlowLayout(FlowLayout.TRAILING));
+//             panExtr.add(btnExtract);
+//             panExtract.add(panExtr, BorderLayout.SOUTH);
+//             contentPane.add(panExtract);
 
                JPanel panButtons = new JPanel();
                panButtons.setAlignmentX(Component.CENTER_ALIGNMENT);
                btnClose = Utils.createButton(Messages.DI_CLOSE, null, this);
+               panButtons.add(btnExtract);
                panButtons.add(btnClose);
                contentPane.add(panButtons);
                setContentPane(contentPane);
@@ -219,7 +244,7 @@
         * Updates the &quot;enabled&quot; status of the Extract button.
         */
        private void updateBtnExtract() {
-               if ("".equals(fieldNetName.getText()) || 
listComp.getSelectedIndex() == -1) {
+               if (listComp.getSelectedIndex() == -1) {
                        btnExtract.setEnabled(false);
                } else {
                        btnExtract.setEnabled(true);
@@ -251,8 +276,8 @@
         */
        private JList listComp;
 
-       /**
-        * Text field for entering the name of a new network.
-        */
-       private JTextField fieldNetName;
+//     /**
+//      * Text field for entering the name of a new network.
+//      */
+//     private JTextField fieldNetName;
 }

Modified: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/MapParameterDialog.java
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/MapParameterDialog.java
   2012-07-03 23:57:12 UTC (rev 29751)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/MapParameterDialog.java
   2012-07-04 01:08:20 UTC (rev 29752)
@@ -45,7 +45,6 @@
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.view.vizmap.VisualStyle;
 
-import de.mpg.mpi_inf.bioinf.netanalyzer.VisualStyleBuilder;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
 import de.mpg.mpi_inf.bioinf.netanalyzer.data.io.SettingsSerializer;
 
@@ -164,7 +163,7 @@
                }
                
                // Create a new style and register it
-               final VisualStyle newStyle = 
vsBuilder.createVisualStyle(networkView);
+               final VisualStyle newStyle = 
vsBuilder.createVisualStyle(networkView, this);
                vmm.addVisualStyle(newStyle);
                
                vmm.setVisualStyle(newStyle, networkView);
@@ -458,93 +457,6 @@
        }
 
        /**
-        * Creates a continuous mapping of a node or edge attribute to the 
color of the nodes/edges.
-        * 
-        * @param attr
-        *            Attribute to be mapped to the color of nodes/edges.
-        * @param objectMapping
-        *            Contains the information whether a node or edge attribute 
is mapped.
-        * @return A continuous mapping ot an attribute to the color of 
nodes/edges.
-       
-       private ContinuousMapping getColorMapping(String attr, byte 
objectMapping) {
-               ContinuousMapping conMapColor = new 
ContinuousMapping(Color.WHITE, objectMapping);
-               conMapColor.setControllingAttributeName(attr, network, false);
-
-               Interpolator numToColor = new LinearNumberToColorInterpolator();
-               conMapColor.setInterpolator(numToColor);
-
-               return conMapColor;
-       }
-        */
-
-       /**
-        * Creates a continuous mapping of a node or edge attribute to the size 
of the nodes (width &
-        * height)/edges(tickness).
-        * 
-        * @param attr
-        *            Attribute to be mapped to the size of nodes/edges.
-        * @param objectMapping
-        *            Contains the information whether a node or edge attribute 
is mapped.
-        * @return A continuous mapping ot an attribute to the size of 
nodes/edges.
-       
-       private ContinuousMapping getSizeMapping(String attr, byte 
objectMapping) {
-               ContinuousMapping conMapSize = new ContinuousMapping(new 
Double(1.0), objectMapping);
-               conMapSize.setControllingAttributeName(attr, network, false);
-
-               Interpolator numToNum = new LinearNumberToNumberInterpolator();
-               conMapSize.setInterpolator(numToNum);
-
-               return conMapSize;
-       }
-        */
-
-       /**
-        * Adds boundaries to the continuous mapping by defining minimal, 
maximal and middle values for both color
-        * and size mapping.
-        * 
-        * @param conMap
-        *            Continuous mapping for which boundaries are set.
-        * @param attr
-        *            Node/Edge attribute that is mapped.
-        * @param mapType
-        *            Type of the mapping, i.e. low values to small sizes or 
otherwise or low values to bright
-        *            colors and otherwise respectively.
-        * @param min
-        *            Minimal value of size/color for the mapping.
-        * @param mid
-        *            Middle value of size/color for the mapping.
-        * @param max
-        *            Maximal value of size/color for the mapping.
-        * @return The value of the <code>conMap</code> parameter.
-        
-       private ContinuousMapping addBoundaries(ContinuousMapping conMap, 
String attr, String mapType,
-                       Object min, Object mid, Object max) {
-               Object min_ = min;
-               Object mid_ = mid;
-               Object max_ = max;
-               if (min instanceof Color && 
mapType.equals(Messages.DI_LOWTODARK)) {
-                       min_ = max;
-                       max_ = min;
-               }
-               if (min instanceof Double && 
mapType.equals(Messages.DI_LOWTOLARGE)) {
-                       min_ = max;
-                       max_ = min;
-               }
-
-               // Create boundary conditions less than, equals, greater than
-               BoundaryRangeValues bv0 = new BoundaryRangeValues(min_, min_, 
min_);
-               BoundaryRangeValues bv1 = new BoundaryRangeValues(mid_, mid_, 
mid_);
-               BoundaryRangeValues bv2 = new BoundaryRangeValues(max_, max_, 
max_);
-
-               // Set the attribute point values associated with the boundary 
values
-               conMap.addPoint(minAttrValue.get(attr).doubleValue(), bv0);
-               conMap.addPoint(meanAttrValue.get(attr).doubleValue(), bv1);
-               conMap.addPoint(maxAttrValue.get(attr).doubleValue(), bv2);
-
-               return conMap;
-       }
-*/
-       /**
         * Unique ID for this version of this class. It is used in 
serialization.
         */
        private static final long serialVersionUID = 1514650388927387666L;
@@ -625,55 +537,55 @@
        /**
         * Attribute that is mapped to node size.
         */
-       private String attrNodeSize;
+       protected String attrNodeSize;
 
        /**
         * Type of mapping the node attributes, i.e. low values to small sizes 
or otherwise.
         */
-       private String mapNodeSize;
+       protected String mapNodeSize;
 
        /**
         * Attribute that is mapped to node color.
         */
-       private String attrNodeColor;
+       protected String attrNodeColor;
 
        /**
         * Type of mapping the node attributes, i.e. low values to bright 
colors or otherwise.
         */
-       private String mapNodeColor;
+       protected String mapNodeColor;
 
        /**
         * Attribute that is mapped to edge size.
         */
-       private String attrEdgeSize;
+       protected String attrEdgeSize;
 
        /**
         * Type of mapping the edge attributes, i.e. low values to small sizes 
or otherwise.
         */
-       private String mapEdgeSize;
+       protected String mapEdgeSize;
 
        /**
         * Attribute that is mapped to edge color.
         */
-       private String attrEdgeColor;
+       protected String attrEdgeColor;
 
        /**
         * Type of mapping the edge attributes, i.e. low values to bright 
colors or otherwise.
         */
-       private String mapEdgeColor;
+       protected String mapEdgeColor;
 
        /**
         * Map with the minimal computed value for each attribute.
         */
-       private HashMap<String, Double> minAttrValue;
+       protected HashMap<String, Double> minAttrValue;
 
        /**
         * Map with the maximal computed value for each attribute.
         */
-       private HashMap<String, Double> maxAttrValue;
+       protected HashMap<String, Double> maxAttrValue;
 
        /**
         * Map with the mean computed value for each attribute.
         */
-       private HashMap<String, Double> meanAttrValue;
+       protected HashMap<String, Double> meanAttrValue;
 }

Copied: 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/VisualStyleBuilder.java
 (from rev 29740, 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/VisualStyleBuilder.java)
===================================================================
--- 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/VisualStyleBuilder.java
                           (rev 0)
+++ 
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ui/VisualStyleBuilder.java
   2012-07-04 01:08:20 UTC (rev 29752)
@@ -0,0 +1,172 @@
+package de.mpg.mpi_inf.bioinf.netanalyzer.ui;
+
+import java.awt.Color;
+import java.awt.Paint;
+
+import org.cytoscape.model.CyColumn;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
+import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
+import org.cytoscape.view.vizmap.VisualMappingFunction;
+import org.cytoscape.view.vizmap.VisualMappingFunctionFactory;
+import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.view.vizmap.VisualStyleFactory;
+import org.cytoscape.view.vizmap.mappings.BoundaryRangeValues;
+import org.cytoscape.view.vizmap.mappings.ContinuousMapping;
+import org.cytoscape.view.vizmap.mappings.PassthroughMapping;
+
+import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
+import de.mpg.mpi_inf.bioinf.netanalyzer.data.io.SettingsSerializer;
+
+public class VisualStyleBuilder {
+
+       private static final String VS_NAME_PREFIX = "Network Analyzer Style: ";
+
+       // Preset defaults
+       private static final Color NODE_COLOR = Color.WHITE;
+       private static final Color NODE_LABEL_COLOR = new Color(130, 130, 130);
+       private static final Color EDGE_COLOR = new Color(100, 100, 100);
+
+       private final VisualStyleFactory vsFactory;
+
+       private final VisualMappingFunctionFactory passthroughFactory;
+       private final VisualMappingFunctionFactory continuousFactory;
+
+       public VisualStyleBuilder(final VisualStyleFactory vsFactory,
+                       final VisualMappingFunctionFactory passthroughFactory, 
final VisualMappingFunctionFactory continuousFactory) {
+               this.vsFactory = vsFactory;
+               this.passthroughFactory = passthroughFactory;
+               this.continuousFactory = continuousFactory;
+       }
+
+       /**
+        * Creates a new visual style in Cytoscape's VizMapper depending on the 
by
+        * the user defined mappings of computed attributes.
+        * 
+        * @return New visual style.
+        **/
+       public VisualStyle createVisualStyle(final CyNetworkView networkView, 
final MapParameterDialog parameterDialog) {
+
+               final CyNetwork network = networkView.getModel();
+               // Create new visual style
+               final String name = network.getRow(network).get(CyNetwork.NAME, 
String.class);
+               final VisualStyle visualStyle = 
vsFactory.createVisualStyle(VS_NAME_PREFIX + name);
+
+               // Network VP
+               final Color backGroundColor = 
SettingsSerializer.getPluginSettings().getBackgroundColor();
+               
visualStyle.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT, 
backGroundColor);
+
+               // Node Label Mapping
+               final PassthroughMapping<String, String> labelPassthrough = 
(PassthroughMapping<String, String>) passthroughFactory
+                               .createVisualMappingFunction(CyNetwork.NAME, 
String.class, BasicVisualLexicon.NODE_LABEL);
+               visualStyle.addVisualMappingFunction(labelPassthrough);
+
+               // Node View Defaults
+               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, 
NodeShapeVisualProperty.ELLIPSE);
+               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, 
NODE_COLOR);
+               
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_LABEL_COLOR, 
NODE_LABEL_COLOR);
+
+               
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_BORDER_WIDTH, 0.0d);
+               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_WIDTH, 30d);
+               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_HEIGHT, 
30d);
+               visualStyle.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 30d);
+               
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_TRANSPARENCY, 200);
+
+               // Edge View Defaults
+               
visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_TRANSPARENCY, 100);
+               visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_WIDTH, 
3.0d);
+               visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_PAINT, 
EDGE_COLOR);
+
+               // Apply new visual settings
+               if (parameterDialog.attrNodeColor.length() > 0) {
+                       // Continuous Mapping - set node color
+                       final CyColumn col = 
network.getDefaultNodeTable().getColumn(parameterDialog.attrNodeColor);
+                       Class<?> attrValueType = col.getType();
+                       final VisualMappingFunction<?, Paint> conMapNodeColor = 
continuousFactory.createVisualMappingFunction(
+                                       parameterDialog.attrNodeColor, 
attrValueType, BasicVisualLexicon.NODE_FILL_COLOR);
+                       addBoundaries(parameterDialog, conMapNodeColor, 
parameterDialog.attrNodeColor,
+                                       parameterDialog.mapNodeColor, 
SettingsSerializer.getPluginSettings().getBrightColor(),
+                                       
SettingsSerializer.getPluginSettings().getMiddleColor(), 
SettingsSerializer.getPluginSettings()
+                                                       .getDarkColor());
+                       visualStyle.addVisualMappingFunction(conMapNodeColor);
+               }
+
+               if (parameterDialog.attrNodeSize.length() > 0) {
+                       final CyColumn col = 
network.getDefaultNodeTable().getColumn(parameterDialog.attrNodeSize);
+                       Class<?> attrValueType = col.getType();
+                       VisualMappingFunction<?, Double> conMapNodeSize = 
continuousFactory.createVisualMappingFunction(
+                                       parameterDialog.attrNodeSize, 
attrValueType, BasicVisualLexicon.NODE_SIZE);
+                       addBoundaries(parameterDialog, conMapNodeSize, 
parameterDialog.attrNodeSize, parameterDialog.mapNodeSize, new Double(10.0),
+                                       new Double(50.0), new Double(100.0));
+                       visualStyle.addVisualMappingFunction(conMapNodeSize);
+               }
+               if (parameterDialog.attrEdgeColor.length() > 0) {
+                       final CyColumn col = 
network.getDefaultEdgeTable().getColumn(parameterDialog.attrEdgeColor);
+                       Class<?> attrValueType = col.getType();
+                       final VisualMappingFunction<?, Paint> conMapEdgeColor = 
continuousFactory.createVisualMappingFunction(
+                                       parameterDialog.attrEdgeColor, 
attrValueType, BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT);
+                       addBoundaries(parameterDialog, conMapEdgeColor, 
parameterDialog.attrEdgeColor, parameterDialog.mapEdgeColor, SettingsSerializer
+                                       .getPluginSettings().getBrightColor(), 
SettingsSerializer.getPluginSettings().getMiddleColor(),
+                                       
SettingsSerializer.getPluginSettings().getDarkColor());
+                       visualStyle.addVisualMappingFunction(conMapEdgeColor);
+               }
+               if (parameterDialog.attrEdgeSize.length() > 0) {
+                       final CyColumn col = 
network.getDefaultEdgeTable().getColumn(parameterDialog.attrEdgeSize);
+                       Class<?> attrValueType = col.getType();
+                       VisualMappingFunction<?, Double> conMapEdgeSize = 
continuousFactory.createVisualMappingFunction(
+                                       parameterDialog.attrEdgeSize, 
attrValueType, BasicVisualLexicon.EDGE_WIDTH);
+                       addBoundaries(parameterDialog, conMapEdgeSize, 
parameterDialog.attrEdgeSize, parameterDialog.mapEdgeSize, new Double(1.0), new 
Double(4.0),
+                                       new Double(8.0));
+                       visualStyle.addVisualMappingFunction(conMapEdgeSize);
+               }
+
+               return visualStyle;
+       }
+
+       /**
+        * Adds boundaries to the continuous mapping by defining minimal, 
maximal
+        * and middle values for both color and size mapping.
+        * 
+        * @param conMapNodeColor
+        *            Continuous mapping for which boundaries are set.
+        * @param attr
+        *            Node/Edge attribute that is mapped.
+        * @param mapType
+        *            Type of the mapping, i.e. low values to small sizes or
+        *            otherwise or low values to bright colors and otherwise
+        *            respectively.
+        * @param min
+        *            Minimal value of size/color for the mapping.
+        * @param mid
+        *            Middle value of size/color for the mapping.
+        * @param max
+        *            Maximal value of size/color for the mapping.
+        * @return The value of the <code>conMap</code> parameter.
+        **/
+       private void addBoundaries(final MapParameterDialog parameterDialog,
+                       VisualMappingFunction<?, ?> conMapNodeColor, String 
attr, String mapType, Object min, Object mid,
+                       Object max) {
+               Object min_ = min;
+               Object mid_ = mid;
+               Object max_ = max;
+               if (min instanceof Color && 
mapType.equals(Messages.DI_LOWTODARK)) {
+                       min_ = max;
+                       max_ = min;
+               }
+               if (min instanceof Double && 
mapType.equals(Messages.DI_LOWTOLARGE)) {
+                       min_ = max;
+                       max_ = min;
+               }
+
+               // Create boundary conditions less than, equals, greater than
+               BoundaryRangeValues bv0 = new BoundaryRangeValues(min_, min_, 
min_);
+               BoundaryRangeValues bv1 = new BoundaryRangeValues(mid_, mid_, 
mid_);
+               BoundaryRangeValues bv2 = new BoundaryRangeValues(max_, max_, 
max_);
+
+               // Set the attribute point values associated with the boundary 
values
+               ((ContinuousMapping) 
conMapNodeColor).addPoint(parameterDialog.minAttrValue.get(attr).doubleValue(), 
bv0);
+               ((ContinuousMapping) 
conMapNodeColor).addPoint(parameterDialog.meanAttrValue.get(attr).doubleValue(),
 bv1);
+               ((ContinuousMapping) 
conMapNodeColor).addPoint(parameterDialog.maxAttrValue.get(attr).doubleValue(), 
bv2);
+       }
+}

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