Author: clopes
Date: 2012-05-24 14:21:57 -0700 (Thu, 24 May 2012)
New Revision: 29346

Modified:
   
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/ApplyToNetworkHandler.java
Log:
Missing file for fix to bug #1017 (Discrete mapping does not apply the 
"Ellipse" node shape).
Note: the problem was that if the default value of the visual property was the 
same as the mapped value, it would be replaced by the style's default value.

Modified: 
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/ApplyToNetworkHandler.java
===================================================================
--- 
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/ApplyToNetworkHandler.java
       2012-05-24 21:13:30 UTC (rev 29345)
+++ 
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/ApplyToNetworkHandler.java
       2012-05-24 21:21:57 UTC (rev 29346)
@@ -53,30 +53,21 @@
 
        private void applyImpl(final CyNetworkView networkView, final 
Collection<? extends View<?>> views,
                        final Collection<VisualProperty<?>> visualProperties) {
-
                for (VisualProperty<?> vp : visualProperties)
                        applyToView(networkView, views, vp);
        }
 
        private void applyToView(final CyNetworkView networkView, final 
Collection<? extends View<?>> views,
                        final VisualProperty<?> vp) {
-
                final VisualMappingFunction<?, ?> mapping = 
style.getVisualMappingFunction(vp);
-               if (mapping == null)
-                       return;
-
-               // Default of this style
-               final Object styleDefaultValue = style.getDefaultValue(vp);
-               // Default of this Visual Property
-               final Object vpDefault = vp.getDefault();
-               final CyNetwork net = networkView.getModel();
-
-               for (View<?> v : views) {
-                       View<? extends CyIdentifiable> view = (View<? extends 
CyIdentifiable>) v;
-                       mapping.apply(net.getRow(view.getModel()), view);
-
-                       if (view.getVisualProperty(vp) == vpDefault)
-                               view.setVisualProperty(vp, styleDefaultValue);
+               
+               if (mapping != null) {
+                       final CyNetwork net = networkView.getModel();
+       
+                       for (View<?> v : views) {
+                               View<? extends CyIdentifiable> view = (View<? 
extends CyIdentifiable>) v;
+                               mapping.apply(net.getRow(view.getModel()), 
view);
+                       }
                }
        }
 
@@ -88,7 +79,7 @@
                        final VisualLexiconNode node = 
lex.getVisualLexiconNode(vp);
                        final Collection<VisualLexiconNode> children = 
node.getChildren();
                        
-                       if(children.size() != 0)
+                       if (children.size() != 0)
                                continue;
 
                        Object defaultValue = style.getDefaultValue(vp);
@@ -102,8 +93,8 @@
                }
                
                // Override dependency
-               for(final VisualPropertyDependency<?> dep: dependencies) {
-                       if(dep.isDependencyEnabled()) {
+               for (final VisualPropertyDependency<?> dep: dependencies) {
+                       if (dep.isDependencyEnabled()) {
                                final Set<?> vpSet = dep.getVisualProperties();
                                // Pick parent
                                VisualProperty<?> visualProperty = 
(VisualProperty<?>) vpSet.iterator().next();
@@ -115,7 +106,8 @@
                                        
((VisualStyleImpl)style).getStyleDefaults().put(visualProperty, 
visualProperty.getDefault());
                                        defaultValue = 
style.getDefaultValue(visualProperty);
                                }
-                               for(Object vp: vpSet)
+                               
+                               for (Object vp: vpSet)
                                        
view.setViewDefault((VisualProperty<?>)vp, defaultValue);
                        }
                }

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