Author: paperwing
Date: 2012-02-03 12:16:32 -0800 (Fri, 03 Feb 2012)
New Revision: 28190
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkViewFactory.java
Log:
refs #633 Visual style switches made from the VizMapper combo box now show up
in both the main network window as well as the bird's eye view. Also, changes
to the visual style made in the default values dialog box show up in both the
main and bird's eye windows when the "apply" button is pressed. However, the
small preview for the visual style currently does not update according to the
current visual style.
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
2012-02-03 19:27:01 UTC (rev 28189)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
2012-02-03 20:16:32 UTC (rev 28190)
@@ -10,6 +10,7 @@
import org.cytoscape.view.model.VisualLexicon;
import org.cytoscape.view.presentation.RenderingEngineFactory;
import org.cytoscape.view.presentation.RenderingEngineManager;
+import org.cytoscape.view.vizmap.VisualMappingManager;
import org.osgi.framework.BundleContext;
public class CyActivator extends AbstractCyActivator {
@@ -24,7 +25,9 @@
RenderingEngineManager.class);
CyServiceRegistrar cyServiceRegistrarRef = getService(bc,
CyServiceRegistrar.class);
-
+ VisualMappingManager visualMappingManagerServiceRef =
getService(bc,
+ VisualMappingManager.class);
+
// Wind Visual Lexicon
WindVisualLexicon windVisualLexicon = new WindVisualLexicon();
@@ -36,8 +39,12 @@
// Wind NetworkView factory
WindNetworkViewFactory windNetworkViewFactory =
- new WindNetworkViewFactory(cyServiceRegistrarRef,
windVisualLexicon);
+ new WindNetworkViewFactory(cyServiceRegistrarRef,
windVisualLexicon, visualMappingManagerServiceRef);
+ if (visualMappingManagerServiceRef == null) {
+ System.out.println("failed to find vmm");
+ }
+
Properties windNetworkViewFactoryProps = new Properties();
windNetworkViewFactoryProps.setProperty("serviceType",
"factory");
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
2012-02-03 19:27:01 UTC (rev 28189)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
2012-02-03 20:16:32 UTC (rev 28190)
@@ -27,6 +27,8 @@
import org.cytoscape.view.model.VisualLexicon;
import org.cytoscape.view.model.VisualProperty;
import org.cytoscape.view.presentation.property.RichVisualLexicon;
+import org.cytoscape.view.vizmap.VisualMappingManager;
+import org.cytoscape.view.vizmap.VisualStyle;
public class WindNetworkView extends VisualPropertyKeeper<CyNetwork>
implements CyNetworkView {
@@ -36,16 +38,20 @@
private VisualLexicon visualLexicon;
private DefaultValueVault defaultValues;
+ private VisualMappingManager visualMappingManager;
// Assumes indices of nodes are unique
private Map<Integer, View<CyNode>> nodeViews;
private Map<Integer, View<CyEdge>> edgeViews;
- public WindNetworkView(CyNetwork network, VisualLexicon visualLexicon) {
+ public WindNetworkView(CyNetwork network,
+ VisualLexicon visualLexicon,
+ VisualMappingManager visualMappingManager) {
suid = SUIDFactory.getNextSUID();
this.network = network;
this.visualLexicon = visualLexicon;
+ this.visualMappingManager = visualMappingManager;
defaultValues = new DefaultValueVault(visualLexicon);
nodeViews = new HashMap<Integer, View<CyNode>>();
@@ -161,6 +167,9 @@
matchNodes();
matchEdges();
+
+ // Match the current network view to the currently applied
visual style
+ updateToMatchVisualStyle();
}
// Checks if there is a discrepancy between number of nodes and
nodeViews, attempts
@@ -259,6 +268,44 @@
}
}
+ private void updateToMatchVisualStyle() {
+
+ // TODO: Make the set declared below a private member field,
formalize the set of node or edge specific visual properties
+ // that do not need to be matched with visual style changes,
such as 3D position.
+
+ // These visual properties are object-specific such as x, y, z
coordinates
+ // and do not need to be updated according to the visual style
+ Set<VisualProperty<?>> exemptProperties = new
HashSet<VisualProperty<?>>();
+ exemptProperties.add(RichVisualLexicon.NODE_X_LOCATION);
+ exemptProperties.add(RichVisualLexicon.NODE_Y_LOCATION);
+ exemptProperties.add(RichVisualLexicon.NODE_Z_LOCATION);
+
+ // Update visual properties according to the current visual
style
+ VisualStyle visualStyle =
visualMappingManager.getVisualStyle(this);
+
+ for (View<CyNode> nodeView : getNodeViews()) {
+ for (VisualProperty<?> visualProperty :
visualLexicon.getAllVisualProperties()) {
+ if (visualProperty.getTargetDataType() ==
CyNode.class
+ &&
visualStyle.getDefaultValue(visualProperty) != null
+ &&
visualStyle.getVisualMappingFunction(visualProperty) == null
+ &&
!exemptProperties.contains(visualProperty)) {
+
nodeView.setVisualProperty(visualProperty, (Object)
visualStyle.getDefaultValue(visualProperty));
+ }
+ }
+ }
+
+ for (View<CyEdge> edgeView : getEdgeViews()) {
+ for (VisualProperty<?> visualProperty :
visualLexicon.getAllVisualProperties()) {
+ if (visualProperty.getTargetDataType() ==
CyEdge.class
+ &&
visualStyle.getDefaultValue(visualProperty) != null
+ &&
visualStyle.getVisualMappingFunction(visualProperty) == null
+ &&
!exemptProperties.contains(visualProperty)) {
+
edgeView.setVisualProperty(visualProperty, (Object)
visualStyle.getDefaultValue(visualProperty));
+ }
+ }
+ }
+ }
+
@Override
public <T, V extends T> void setViewDefault(VisualProperty<? extends T>
visualProperty,
V defaultValue) {
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkViewFactory.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkViewFactory.java
2012-02-03 19:27:01 UTC (rev 28189)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkViewFactory.java
2012-02-03 20:16:32 UTC (rev 28190)
@@ -12,17 +12,21 @@
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.CyNetworkViewFactory;
import org.cytoscape.view.model.VisualLexicon;
+import org.cytoscape.view.vizmap.VisualMappingManager;
public class WindNetworkViewFactory implements CyNetworkViewFactory {
private VisualLexicon visualLexicon;
private CyServiceRegistrar serviceRegistrar;
+ private VisualMappingManager visualMappingManager;
public WindNetworkViewFactory(CyServiceRegistrar serviceRegistrar,
- VisualLexicon visualLexicon) {
+ VisualLexicon visualLexicon,
+ VisualMappingManager visualMappingManager) {
this.serviceRegistrar = serviceRegistrar;
this.visualLexicon = visualLexicon;
+ this.visualMappingManager = visualMappingManager;
}
@Override
@@ -30,7 +34,8 @@
Boolean useThreshold) {
// TODO: Implement use of useThreshold parameter
- WindNetworkView networkView = new WindNetworkView(network,
visualLexicon);
+ WindNetworkView networkView = new WindNetworkView(network,
+ visualLexicon, visualMappingManager);
// serviceRegistrar.registerService(networkView,
AddedNodesListener.class,
// new Properties());
--
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.