Author: kono
Date: 2012-07-18 16:46:02 -0700 (Wed, 18 Jul 2012)
New Revision: 29927
Modified:
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/task/AnalyzeNetworkTask.java
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CreateNewNetworkPanel.java
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CyActivator.java
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/VisualStyleBuilder.java
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenDialog.java
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/task/AnalyzeAndVisualizeNetworkTask.java
Log:
fixes #1275 Automatic Visual Style generator task had been implemented.
Modified:
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/task/AnalyzeNetworkTask.java
===================================================================
---
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/task/AnalyzeNetworkTask.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/network-analyzer-impl/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/task/AnalyzeNetworkTask.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -19,14 +19,13 @@
import de.mpg.mpi_inf.bioinf.netanalyzer.data.NetworkInspection;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.NetworkInterpretation;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.NetworkStatus;
-import de.mpg.mpi_inf.bioinf.netanalyzer.ui.InterpretationDialog;
public class AnalyzeNetworkTask extends AbstractNetworkCollectionTask {
- @Tunable(description = "Analyze as Directed Graph?")
+ //@Tunable(description = "Analyze as Directed Graph?")
public Boolean directed = false;
- @Tunable(description = "Analyze only selected nodes?")
+ //@Tunable(description = "Analyze only selected nodes?")
public Boolean selectedOnly = false;
@@ -69,7 +68,6 @@
if(interpr == null)
throw new NullPointerException("NetworkInterpretation
is null.");
- System.out.println(interpr + " found.");
final NetworkAnalyzer analyzer;
if (directed)
analyzer = new DirNetworkAnalyzer(network, nodes,
interpr);
@@ -83,11 +81,9 @@
final NetworkStatus status = NetworkStatus.getStatus(aInsp);
final NetworkInterpretation[] interpretations =
status.getInterpretations();
for(NetworkInterpretation ni: interpretations) {
- System.out.println(ni + ": Directed = " +
ni.isDirected());
if(directed == ni.isDirected())
return ni;
}
-
return null;
}
Modified:
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CreateNewNetworkPanel.java
===================================================================
---
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CreateNewNetworkPanel.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CreateNewNetworkPanel.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -19,11 +19,14 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.JRadioButton;
import javax.swing.border.LineBorder;
import org.cytoscape.application.CyApplicationConfiguration;
@@ -37,7 +40,7 @@
import org.cytoscape.property.CyProperty;
import org.cytoscape.task.analyze.AnalyzeNetworkCollectionTaskFactory;
import org.cytoscape.task.read.LoadNetworkURLTaskFactory;
-import org.cytoscape.view.layout.CyLayoutAlgorithmManager;
+import org.cytoscape.task.visualize.ApplyPreferredLayoutTaskFactory;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.events.NetworkViewAddedEvent;
import org.cytoscape.view.model.events.NetworkViewAddedListener;
@@ -64,9 +67,12 @@
private JLabel fromDB;
private JLabel fromWebService;
+ private final JRadioButton importOnlyButton = new JRadioButton("Import
only");
+ private final JRadioButton layoutButton = new JRadioButton("Import and
Layout");
+ private final JRadioButton visualizeButton = new JRadioButton("Import,
Analyze, and Visualize");
+
// List of Preset Data
private JComboBox networkList;
- private JCheckBox layout;
// Parent window, usually it's Cytoscape Desktop
private Window parent;
@@ -82,22 +88,26 @@
private final AnalyzeNetworkCollectionTaskFactory
analyzeNetworkCollectionTaskFactory;
private final VisualStyleBuilder vsBuilder;
private final VisualMappingManager vmm;
-
+
private Set<CyNetwork> networkToBeAnalyzed;
private Set<CyNetworkView> networkViews;
+ private final ApplyPreferredLayoutTaskFactory
applyPreferredLayoutTaskFactory;
+
CreateNewNetworkPanel(Window parent, final BundleContext bc, final
DialogTaskManager guiTaskManager,
final TaskFactory importNetworkFileTF, final
LoadNetworkURLTaskFactory loadTF,
final CyApplicationConfiguration config, final
DataSourceManager dsManager,
final CyProperty<Properties> props,
final AnalyzeNetworkCollectionTaskFactory
analyzeNetworkCollectionTaskFactory,
- final VisualStyleBuilder vsBuilder, final
VisualMappingManager vmm) {
+ final VisualStyleBuilder vsBuilder, final
VisualMappingManager vmm,
+ final ApplyPreferredLayoutTaskFactory
applyPreferredLayoutTaskFactory) {
this.parent = parent;
this.bc = bc;
this.props = props;
this.analyzeNetworkCollectionTaskFactory =
analyzeNetworkCollectionTaskFactory;
this.vsBuilder = vsBuilder;
this.vmm = vmm;
+ this.applyPreferredLayoutTaskFactory =
applyPreferredLayoutTaskFactory;
this.importNetworkFromURLTF = loadTF;
this.importNetworkFileTF = importNetworkFileTF;
@@ -121,7 +131,7 @@
});
networkList.setEnabled(true);
-
+
networkToBeAnalyzed = new HashSet<CyNetwork>();
networkViews = new HashSet<CyNetworkView>();
}
@@ -153,9 +163,10 @@
}
private void initComponents() {
- this.layout = new JCheckBox();
- layout.setText("Analyze and Visualize Network");
- layout.setToolTipText("This option analyze the network and
visualize it based on its basic statistics.");
+ importOnlyButton.setToolTipText("Just import network data.");
+ layoutButton.setToolTipText("Import network and apply preffered
layout algorithm.");
+ visualizeButton
+ .setToolTipText("Import a network and analyze
it. Then visualize the network based on its basic statistics.");
this.loadNetwork = new JLabel("From file...");
this.loadNetwork.setCursor(new Cursor(Cursor.HAND_CURSOR));
@@ -163,7 +174,6 @@
loadNetwork.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent ev) {
- parent.dispose();
loadFromFile();
}
});
@@ -187,21 +197,53 @@
}
});
- this.setLayout(new GridLayout(5, 1));
- this.add(loadNetwork);
- this.add(fromWebService);
- this.add(fromDB);
- this.add(networkList);
- this.add(layout);
+ this.setLayout(new GridLayout(2, 1));
+ final JPanel topPanel = new JPanel();
+ topPanel.setOpaque(false);
+ topPanel.setLayout(new GridLayout(4, 1));
+ final JPanel bottomPanel = new JPanel();
+ bottomPanel.setOpaque(false);
+ bottomPanel.setLayout(new GridLayout(1, 1));
+
+ topPanel.add(fromWebService);
+ topPanel.add(loadNetwork);
+ topPanel.add(fromDB);
+ topPanel.add(networkList);
+
+ bottomPanel.add(initOptionPanel());
+
+ this.add(topPanel);
+ this.add(bottomPanel);
+
}
+ private JPanel initOptionPanel() {
+ final JPanel optionPanel = new JPanel();
+
+
optionPanel.setBorder(BorderFactory.createTitledBorder("Options"));
+ optionPanel.setLayout(new GridLayout(3, 1));
+
+ final ButtonGroup gr = new ButtonGroup();
+ gr.add(importOnlyButton);
+ gr.add(layoutButton);
+ gr.add(visualizeButton);
+ gr.setSelected(importOnlyButton.getModel(), true);
+
+ optionPanel.add(importOnlyButton);
+ optionPanel.add(layoutButton);
+ optionPanel.add(visualizeButton);
+ optionPanel.setOpaque(false);
+
+ return optionPanel;
+ }
+
private final void loadFromFile() {
-
guiTaskManager.execute(importNetworkFileTF.createTaskIterator());
+ final TaskIterator itr =
importNetworkFileTF.createTaskIterator();
+ importNetwork(itr);
}
private void loadPreset() {
-
// Get selected file from the combo box
final Object file = networkList.getSelectedItem();
if (file == null)
@@ -216,20 +258,23 @@
logger.error("Source URL is invalid", e);
}
- parent.dispose();
-
final TaskIterator loadTaskIt =
importNetworkFromURLTF.loadCyNetworks(url);
+ importNetwork(loadTaskIt);
+ }
- if (layout.isSelected()) {
-
props.getProperties().setProperty(CyLayoutAlgorithmManager.DEFAULT_LAYOUT_PROPERTY_NAME,
LAYOUT_ALGORITHM);
+ private void importNetwork(final TaskIterator loadTaskIt) {
+
+ if (layoutButton.isSelected()) {
+
loadTaskIt.append(applyPreferredLayoutTaskFactory.createTaskIterator(networkViews));
+ }
+ if (visualizeButton.isSelected()) {
loadTaskIt.append(analyzeNetworkCollectionTaskFactory.createTaskIterator(networkToBeAnalyzed));
loadTaskIt.append(new
AnalyzeAndVisualizeNetworkTask(networkViews, vsBuilder, vmm));
}
guiTaskManager.execute(loadTaskIt);
+ parent.dispose();
}
-
-
/**
* Due to its dependency, we need to import this service dynamically.
*
@@ -250,18 +295,14 @@
@Override
public void handleEvent(NetworkAddedEvent e) {
- final boolean shouldAnalyze = layout.isSelected();
- if (shouldAnalyze) {
- final CyNetwork network = e.getNetwork();
- networkToBeAnalyzed.add(network);
- }
-
+ final CyNetwork network = e.getNetwork();
+ networkToBeAnalyzed.add(network);
}
@Override
public void handleEvent(NetworkViewAddedEvent e) {
CyNetworkView networkView = e.getNetworkView();
- if(networkView != null)
+ if (networkView != null)
networkViews.add(e.getNetworkView());
}
}
Modified:
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CyActivator.java
===================================================================
---
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CyActivator.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/CyActivator.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -12,6 +12,7 @@
import org.cytoscape.task.analyze.AnalyzeNetworkCollectionTaskFactory;
import org.cytoscape.task.read.LoadNetworkURLTaskFactory;
import org.cytoscape.task.read.OpenSessionTaskFactory;
+import org.cytoscape.task.visualize.ApplyPreferredLayoutTaskFactory;
import org.cytoscape.util.swing.OpenBrowser;
import org.cytoscape.view.presentation.property.values.BendFactory;
import org.cytoscape.view.vizmap.VisualMappingFunctionFactory;
@@ -28,6 +29,7 @@
public void start(BundleContext bc) {
+ final ApplyPreferredLayoutTaskFactory
applyPreferredLayoutTaskFactory = getService(bc,
ApplyPreferredLayoutTaskFactory.class);
BendFactory bendFactory = getService(bc, BendFactory.class);
CyServiceRegistrar cyServiceRegistrar = getService(bc,
CyServiceRegistrar.class);
VisualMappingManager vmm = getService(bc,
VisualMappingManager.class);
@@ -61,7 +63,7 @@
openBrowserServiceRef,
recentlyOpenedTrackerServiceRef, openSessionTaskFactory,
dialogTaskManagerServiceRef,
importNetworkFileTF, importNetworkTF,
cyApplicationConfigurationServiceRef,
dsManagerServiceRef, cytoscapePropertiesServiceRef,
- analyzeNetworkCollectionTaskFactory,
cyServiceRegistrar, vsBuilder, vmm);
+ analyzeNetworkCollectionTaskFactory,
cyServiceRegistrar, vsBuilder, vmm, applyPreferredLayoutTaskFactory);
registerAllServices(bc, welcomeScreenAction, new Properties());
}
Modified:
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/VisualStyleBuilder.java
===================================================================
---
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/VisualStyleBuilder.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/VisualStyleBuilder.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -1,6 +1,7 @@
package org.cytoscape.welcome.internal;
import java.awt.Color;
+import java.awt.Font;
import java.awt.Paint;
import java.util.List;
import java.util.Set;
@@ -25,11 +26,31 @@
public class VisualStyleBuilder {
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(150, 150, 150);
- private static final String nodeColorColumn = "Indegree";
- private static final String NODE_SIZE_COLUMN = "Indegree";
+ private static final Color NODE_BORDER_COLOR = new Color(180, 180, 180);
+ private static final Color NODE_MAPPING_COLOR = new Color(0x00, 0xCE,
0xD1);
+ private static final Color EDGE_MAPPING_MIN_COLOR = new Color(180, 180,
180);
+ private static final Color EDGE_MAPPING_MAX_COLOR = new Color(0x7A,
0xC5, 0xCD);
+
+ private static final Color NODE_LABEL_COLOR = new Color(160, 160, 160);
+ private static final Color EDGE_COLOR = new Color(180, 180, 180);
+ private static final String NODE_COLOR_COLUMN = "BetweennessCentrality";
+ private static final String NODE_SIZE_COLUMN = "BetweennessCentrality";
+ private static final String NODE_LABEL_SIZE_COLUMN =
"BetweennessCentrality";
+ private static final String EDGE_WIDTH_COLUMN = "EdgeBetweenness";
+ private static final String EDGE_COLOR_COLUMN = "EdgeBetweenness";
+
+ private static Font NODE_LABEL_FONT;
+ static {
+ NODE_LABEL_FONT = new Font("HelveticaNeue-UltraLight",
Font.PLAIN, 10);
+ if(NODE_LABEL_FONT == null)
+ NODE_LABEL_FONT = new Font("SansSerif", Font.PLAIN, 10);
+ }
+
+ // Bend definition. We can tweak this value later.
+ private static final String EDGE_BEND_DEFINITION =
"0.8117209636412094,0.5840454410278249,0.6715391110621636";
+ private static final String NODE_LABEL_POSITION_DEFINITION =
"S,NW,c,0.00,0.00";
+
private final VisualStyleFactory vsFactory;
private final BendFactory bendFactory;
@@ -64,111 +85,118 @@
// Node View Defaults
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_SHAPE,
NodeShapeVisualProperty.ELLIPSE);
+
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_BORDER_PAINT,
NODE_BORDER_COLOR);
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_LABEL_FONT_FACE,
NODE_LABEL_FONT);
+
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_LABEL_TRANSPARENCY, 190);
+
+
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_BORDER_WIDTH, 1.0d);
+
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_BORDER_TRANSPARENCY, 150);
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_WIDTH, 30d);
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_HEIGHT,
30d);
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 30d);
-
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_TRANSPARENCY, 200);
+
visualStyle.setDefaultValue(BasicVisualLexicon.NODE_TRANSPARENCY, 190);
// Edge View Defaults
-
visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_TRANSPARENCY, 150);
- visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_WIDTH,
2.0d);
+
visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_TRANSPARENCY, 80);
+ visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_WIDTH,
1.0d);
visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_PAINT,
EDGE_COLOR);
- final double angle = Math.PI/2;
- Double sinVal = Math.sin(angle);
- Double cosVal = Math.cos(angle);
- final Bend defBend =
bendFactory.parseSerializableString("0.8117209636412094,0.5840454410278249,0.6715391110621636");
+
+ final Bend defBend =
bendFactory.parseSerializableString(EDGE_BEND_DEFINITION);
visualStyle.setDefaultValue(BasicVisualLexicon.EDGE_BEND,
defBend);
-
- // Apply new visual settings
-
- final CyColumn col =
network.getDefaultNodeTable().getColumn(nodeColorColumn);
+
+ // Node Color
+ final CyColumn col =
network.getDefaultNodeTable().getColumn(NODE_COLOR_COLUMN);
Class<?> attrValueType = col.getType();
@SuppressWarnings("unchecked")
- final ContinuousMapping<Integer, Paint> conMapNodeColor =
((ContinuousMapping<Integer, Paint>) continupousMappingFactory
- .createVisualMappingFunction(nodeColorColumn,
attrValueType, BasicVisualLexicon.NODE_FILL_COLOR));
- // Create boundary conditions less than, equals, greater than
+ final ContinuousMapping<Double, Paint> conMapNodeColor =
((ContinuousMapping<Double, Paint>) continupousMappingFactory
+ .createVisualMappingFunction(NODE_COLOR_COLUMN,
attrValueType, BasicVisualLexicon.NODE_FILL_COLOR));
final BoundaryRangeValues<Paint> bv0 = new
BoundaryRangeValues<Paint>(Color.white, Color.white, Color.white);
- final BoundaryRangeValues<Paint> bv1 = new
BoundaryRangeValues<Paint>(Color.RED, Color.RED, Color.RED);
-
- // Set the attribute point values associated with the boundary
values
- final Integer min = ((Number)
pickMin(network.getDefaultNodeTable(), col)).intValue();
- final Integer max = ((Number)
pickMax(network.getDefaultNodeTable(), col)).intValue();
+ final BoundaryRangeValues<Paint> bv1 = new
BoundaryRangeValues<Paint>(NODE_MAPPING_COLOR, NODE_MAPPING_COLOR,
+ NODE_MAPPING_COLOR);
+ final Double min = pickMin(network.getDefaultNodeTable(), col);
+ final Double max = pickMax(network.getDefaultNodeTable(), col);
conMapNodeColor.addPoint(min, bv0);
conMapNodeColor.addPoint(max, bv1);
visualStyle.addVisualMappingFunction(conMapNodeColor);
-
+
+ // Node Size
final CyColumn nodeSizeCol =
network.getDefaultNodeTable().getColumn(NODE_SIZE_COLUMN);
Class<?> nodeSizeColType = nodeSizeCol.getType();
@SuppressWarnings("unchecked")
- final ContinuousMapping<Integer, Double> conMapNodeSize =
((ContinuousMapping<Integer, Double>) continupousMappingFactory
+ final ContinuousMapping<Double, Double> conMapNodeSize =
((ContinuousMapping<Double, Double>) continupousMappingFactory
.createVisualMappingFunction(NODE_SIZE_COLUMN,
nodeSizeColType, BasicVisualLexicon.NODE_SIZE));
- // Create boundary conditions less than, equals, greater than
final BoundaryRangeValues<Double> bvns0 = new
BoundaryRangeValues<Double>(10d, 10d, 10d);
- final BoundaryRangeValues<Double> bvns1 = new
BoundaryRangeValues<Double>(200d, 200d, 200d);
+ final BoundaryRangeValues<Double> bvns1 = new
BoundaryRangeValues<Double>(100d, 100d, 100d);
- // Set the attribute point values associated with the boundary
values
- final Integer minSize = ((Number)
pickMin(network.getDefaultNodeTable(), col)).intValue();
- final Integer maxSize = ((Number)
pickMax(network.getDefaultNodeTable(), col)).intValue();
- conMapNodeSize.addPoint(minSize, bvns0);
- conMapNodeSize.addPoint(maxSize, bvns1);
+ conMapNodeSize.addPoint(min, bvns0);
+ conMapNodeSize.addPoint(max, bvns1);
visualStyle.addVisualMappingFunction(conMapNodeSize);
+
+ // Node Label Size
+ final CyColumn nodeLabelSizeCol =
network.getDefaultNodeTable().getColumn(NODE_LABEL_SIZE_COLUMN);
+ Class<?> nodeLabelSizeColType = nodeLabelSizeCol.getType();
+ @SuppressWarnings("unchecked")
+ final ContinuousMapping<Double, Integer> conMapNodeLabelSize =
((ContinuousMapping<Double, Integer>) continupousMappingFactory
+
.createVisualMappingFunction(NODE_LABEL_SIZE_COLUMN, nodeLabelSizeColType,
+
BasicVisualLexicon.NODE_LABEL_FONT_SIZE));
+ final BoundaryRangeValues<Integer> bvnls0 = new
BoundaryRangeValues<Integer>(10, 10, 10);
+ final BoundaryRangeValues<Integer> bvnls1 = new
BoundaryRangeValues<Integer>(100, 100, 100);
+ // FIXME: replace min&max if you use different column
+ conMapNodeLabelSize.addPoint(min, bvnls0);
+ conMapNodeLabelSize.addPoint(max, bvnls1);
+ visualStyle.addVisualMappingFunction(conMapNodeLabelSize);
+
+ // Edge Width
+ final CyColumn edgeWidthCol =
network.getDefaultEdgeTable().getColumn(EDGE_WIDTH_COLUMN);
+ final Class<?> edgeWidthColType = edgeWidthCol.getType();
+ @SuppressWarnings("unchecked")
+ final ContinuousMapping<Double, Double> conMapEdgeWidth =
((ContinuousMapping<Double, Double>) continupousMappingFactory
+ .createVisualMappingFunction(EDGE_WIDTH_COLUMN,
edgeWidthColType, BasicVisualLexicon.EDGE_WIDTH));
+ final BoundaryRangeValues<Double> bvew0 = new
BoundaryRangeValues<Double>(1d, 1d, 1d);
+ final BoundaryRangeValues<Double> bvew1 = new
BoundaryRangeValues<Double>(12d, 12d, 12d);
+ final Double minEdge = pickMin(network.getDefaultEdgeTable(),
edgeWidthCol);
+ final Double maxEdge = pickMax(network.getDefaultEdgeTable(),
edgeWidthCol);
+
+ conMapEdgeWidth.addPoint(minEdge, bvew0);
+ conMapEdgeWidth.addPoint(maxEdge, bvew1);
+ visualStyle.addVisualMappingFunction(conMapEdgeWidth);
+
+ // Edge transparency
+ final CyColumn edgeTransCol =
network.getDefaultEdgeTable().getColumn(EDGE_WIDTH_COLUMN);
+ final Class<?> edgeTransColType = edgeTransCol.getType();
+ @SuppressWarnings("unchecked")
+ final ContinuousMapping<Double, Integer> conMapEdgeTrans =
((ContinuousMapping<Double, Integer>) continupousMappingFactory
+ .createVisualMappingFunction(EDGE_WIDTH_COLUMN,
edgeTransColType, BasicVisualLexicon.EDGE_TRANSPARENCY));
+ final BoundaryRangeValues<Integer> bvet0 = new
BoundaryRangeValues<Integer>(80, 80, 80);
+ final BoundaryRangeValues<Integer> bvet1 = new
BoundaryRangeValues<Integer>(220, 220, 220);
+ conMapEdgeTrans.addPoint(minEdge, bvet0);
+ conMapEdgeTrans.addPoint(maxEdge, bvet1);
+ visualStyle.addVisualMappingFunction(conMapEdgeTrans);
+
+ // Edge Color
+ final CyColumn edgeColorCol =
network.getDefaultEdgeTable().getColumn(EDGE_COLOR_COLUMN);
+ final Class<?> edgeColorColType = edgeColorCol.getType();
+ @SuppressWarnings("unchecked")
+ final ContinuousMapping<Double, Paint> conMapEdgeColor =
((ContinuousMapping<Double, Paint>) continupousMappingFactory
+ .createVisualMappingFunction(EDGE_COLOR_COLUMN,
edgeColorColType,
+
BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT));
+ final BoundaryRangeValues<Paint> bvec0 = new
BoundaryRangeValues<Paint>(EDGE_MAPPING_MIN_COLOR,
+ EDGE_MAPPING_MIN_COLOR, EDGE_MAPPING_MIN_COLOR);
+ final BoundaryRangeValues<Paint> bvec1 = new
BoundaryRangeValues<Paint>(EDGE_MAPPING_MAX_COLOR,
+ EDGE_MAPPING_MAX_COLOR, EDGE_MAPPING_MAX_COLOR);
+ conMapEdgeColor.addPoint(minEdge, bvec0);
+ conMapEdgeColor.addPoint(maxEdge, bvec1);
+ visualStyle.addVisualMappingFunction(conMapEdgeColor);
+
+ // Set Lock
Set<VisualPropertyDependency<?>> deps =
visualStyle.getAllVisualPropertyDependencies();
- for(VisualPropertyDependency<?> dep:deps) {
+ for (VisualPropertyDependency<?> dep : deps) {
final String depName = dep.getIdString();
- if(depName.equals("nodeSizeLocked"))
+ if (depName.equals("nodeSizeLocked"))
dep.setDependency(true);
}
-
-
-
- // if (parameterDialog.attrNodeSize.length() > 0) {
- // final CyColumn col =
- //
network.getDefaultNodeTable().getColumn(parameterDialog.attrNodeSize);
- // Class<?> attrValueType = col.getType();
- // VisualMappingFunction<?, Double> conMapNodeSize =
- // continupousMappingFactory.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 =
- // continupousMappingFactory.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 =
- // continupousMappingFactory.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;
}
@@ -178,7 +206,11 @@
Double minNumber = Double.POSITIVE_INFINITY;
for (CyRow row : rows) {
- Double value = ((Number) row.get(column.getName(),
column.getType())).doubleValue();
+ final Object rawValue = row.get(column.getName(),
column.getType());
+ if (rawValue == null)
+ continue;
+
+ Double value = ((Number) rawValue).doubleValue();
if (value < minNumber)
minNumber = value;
}
@@ -190,7 +222,11 @@
Double maxNumber = Double.NEGATIVE_INFINITY;
for (CyRow row : rows) {
- Double value = ((Number) row.get(column.getName(),
column.getType())).doubleValue();
+ final Object rawValue = row.get(column.getName(),
column.getType());
+ if (rawValue == null)
+ continue;
+
+ Double value = ((Number) rawValue).doubleValue();
if (value > maxNumber)
maxNumber = value;
}
Modified:
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
===================================================================
---
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -14,6 +14,7 @@
import org.cytoscape.task.analyze.AnalyzeNetworkCollectionTaskFactory;
import org.cytoscape.task.read.LoadNetworkURLTaskFactory;
import org.cytoscape.task.read.OpenSessionTaskFactory;
+import org.cytoscape.task.visualize.ApplyPreferredLayoutTaskFactory;
import org.cytoscape.util.swing.OpenBrowser;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.work.TaskFactory;
@@ -49,6 +50,7 @@
private final CyServiceRegistrar registrar;
private final VisualStyleBuilder vsBuilder;
private final VisualMappingManager vmm;
+ private final ApplyPreferredLayoutTaskFactory
applyPreferredLayoutTaskFactory;
private boolean hide = false;
@@ -58,7 +60,7 @@
final LoadNetworkURLTaskFactory
importNetworksTaskFactory, final CyApplicationConfiguration config,
final DataSourceManager dsManager, final
CyProperty<Properties> cyProps,
final AnalyzeNetworkCollectionTaskFactory
analyzeNetworkCollectionTaskFactory,
- final CyServiceRegistrar registrar, final
VisualStyleBuilder vsBuilder, final VisualMappingManager vmm) {
+ final CyServiceRegistrar registrar, final
VisualStyleBuilder vsBuilder, final VisualMappingManager vmm, final
ApplyPreferredLayoutTaskFactory applyPreferredLayoutTaskFactory) {
super(MENU_NAME);
setPreferredMenu(PARENT_NAME);
@@ -79,6 +81,7 @@
this.registrar = registrar;
this.vsBuilder = vsBuilder;
this.vmm = vmm;
+ this.applyPreferredLayoutTaskFactory =
applyPreferredLayoutTaskFactory;
// Show it if necessary
SwingUtilities.invokeLater(new Runnable() {
@@ -92,7 +95,7 @@
public void actionPerformed(ActionEvent ae) {
final WelcomeScreenDialog welcomeScreen = new
WelcomeScreenDialog(bc, openBrowser, fileTracker,
openSessionTaskFactory, guiTaskManager, config,
importNetworkFileTF, importNetworksTaskFactory,
- dsManager, cyProps,
analyzeNetworkCollectionTaskFactory, registrar, vsBuilder, vmm, hide);
+ dsManager, cyProps,
analyzeNetworkCollectionTaskFactory, registrar, vsBuilder, vmm,
applyPreferredLayoutTaskFactory, hide);
welcomeScreen.setLocationRelativeTo(app.getJFrame());
welcomeScreen.setVisible(true);
this.hide = welcomeScreen.getHideStatus();
Modified:
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenDialog.java
===================================================================
---
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenDialog.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenDialog.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -29,6 +29,7 @@
import org.cytoscape.task.analyze.AnalyzeNetworkCollectionTaskFactory;
import org.cytoscape.task.read.LoadNetworkURLTaskFactory;
import org.cytoscape.task.read.OpenSessionTaskFactory;
+import org.cytoscape.task.visualize.ApplyPreferredLayoutTaskFactory;
import org.cytoscape.util.swing.OpenBrowser;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.work.TaskFactory;
@@ -78,6 +79,8 @@
private final VisualStyleBuilder vsBuilder;
private final VisualMappingManager vmm;
+ private final ApplyPreferredLayoutTaskFactory
applyPreferredLayoutTaskFactory;
+
public WelcomeScreenDialog(final BundleContext bc, OpenBrowser
openBrowserServiceRef,
RecentlyOpenedTracker fileTracker, final
OpenSessionTaskFactory openSessionTaskFactory,
DialogTaskManager guiTaskManager, final
CyApplicationConfiguration config,
@@ -85,7 +88,7 @@
final DataSourceManager dsManager, final
CyProperty<Properties> cyProps,
final AnalyzeNetworkCollectionTaskFactory
analyzeNetworkCollectionTaskFactory,
final CyServiceRegistrar registrar, final
VisualStyleBuilder vsBuilder, final VisualMappingManager vmm,
- final boolean hide) {
+ final ApplyPreferredLayoutTaskFactory
applyPreferredLayoutTaskFactory, final boolean hide) {
this.openBrowserServiceRef = openBrowserServiceRef;
this.fileTracker = fileTracker;
this.config = config;
@@ -98,6 +101,7 @@
this.registrar = registrar;
this.vsBuilder = vsBuilder;
this.vmm = vmm;
+ this.applyPreferredLayoutTaskFactory =
applyPreferredLayoutTaskFactory;
this.guiTaskManager = guiTaskManager;
this.cyProps = cyProps;
@@ -136,7 +140,7 @@
mainPanel = new JPanel();
mainPanel.setSize(DEF_SIZE);
- mainPanel.setLayout(new GridLayout(2, 2));
+ mainPanel.setLayout(new GridLayout(1, 2));
mainPanel.setOpaque(false);
basePanel.add(mainPanel, BorderLayout.CENTER);
@@ -198,21 +202,30 @@
final CreateNewNetworkPanel importPanel = new
CreateNewNetworkPanel(this, bc, guiTaskManager,
importNetworkFileTF, loadNetworkTF, config,
dsManager, cyProps, analyzeNetworkCollectionTaskFactory,
- vsBuilder, vmm);
+ vsBuilder, vmm,
applyPreferredLayoutTaskFactory);
registrar.registerAllServices(importPanel, new Properties());
buildHelpPanel(panel1, new OpenPanel(this, fileTracker,
guiTaskManager, openSessionTaskFactory),
"Open a Recent Session");
buildHelpPanel(panel2, importPanel, "Import Network");
buildHelpPanel(panel3, new HelpPanel(openBrowserServiceRef,
cyProps), "Help");
- buildHelpPanel(panel4, new LogoPanel(), "Latest News");
+ final JPanel leftPanel = new JPanel();
+ final JPanel rightPanel = new JPanel();
+ leftPanel.setOpaque(false);
+ leftPanel.setLayout(new GridLayout(2, 1));
+ rightPanel.setOpaque(false);
+ rightPanel.setLayout(new GridLayout(1, 1));
+
mainPanel.setBorder(border);
- mainPanel.add(panel1);
- mainPanel.add(panel2);
- mainPanel.add(panel3);
- mainPanel.add(panel4);
+ leftPanel.add(panel1);
+ leftPanel.add(panel3);
+
+ rightPanel.add(panel2);
+
+ mainPanel.add(leftPanel);
+ mainPanel.add(rightPanel);
}
private void buildHelpPanel(JPanel panel, JPanel contentPanel, final
String label) {
Modified:
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/task/AnalyzeAndVisualizeNetworkTask.java
===================================================================
---
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/task/AnalyzeAndVisualizeNetworkTask.java
2012-07-18 22:42:16 UTC (rev 29926)
+++
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/task/AnalyzeAndVisualizeNetworkTask.java
2012-07-18 23:46:02 UTC (rev 29927)
@@ -7,7 +7,6 @@
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.view.vizmap.VisualStyle;
-import org.cytoscape.view.vizmap.VisualStyleFactory;
import org.cytoscape.welcome.internal.VisualStyleBuilder;
import org.cytoscape.work.TaskMonitor;
--
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.