Author: Christian Lopes
Date: 2011-05-09 14:18:58 -0700 (Mon, 09 May 2011)
New Revision: 24972

Modified:
   cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js
   
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
   
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Edges.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
Log:
Fixed bug #2525: Glow properties cannot be bypassed

Modified: cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js   2011-05-09 
21:17:13 UTC (rev 24971)
+++ cytoscapeweb/trunk/cytoscapeweb/html-template/js/tests.js   2011-05-09 
21:18:58 UTC (rev 24972)
@@ -853,8 +853,8 @@
        n = vis.addNode(30, 45, { id: "NN1", label: "New Node 1", weight: 4 }, 
true);
        same(n.data.id, "NN1", "New node has correct ID");
        same(n.data.label, "New Node 1", "New node has correct label");
-       same(n.x, 30, "New node x");
-       same(n.y, 45, "New node y");
+       same(Math.round(n.x), 30, "New node - x");
+       same(Math.round(n.y), 45, "New node - y");
        ok(n.size > style.nodes.size.continuousMapper.minValue + n.borderWidth, 
"Node size updated");
        same(vis.nodes().length, ++count, "New nodes length");
        
@@ -1333,18 +1333,21 @@
     });
     
     test("SVG", function() {
-       var svg = $(vis.svg());
-       var nodes = vis.nodes();
-       var edges = vis.edges();
-
-       same(svg.find(".cw-background").length, 1, "Background rectangle");
-       same(svg.find(".cw-node").length, nodes.length, "Number of SVG nodes");
-       same(svg.find(".cw-node-shape").length, nodes.length, "Number of SVG 
node shapes");
-       same(svg.find(".cw-edge").length, edges.length, "Number of SVG edges");
-       same(svg.find(".cw-edge-line").length, edges.length, "Number of SVG 
edge lines");
-       
-       // TODO: test node images
-       // TODO: test edge arrows
+       if (!$.browser.msie) {
+               // TODO: make test work on IE
+               var svg = $(vis.svg());
+               var nodes = vis.nodes();
+               var edges = vis.edges();
+       
+               same(svg.find(".cw-background").length, 1, "Background 
rectangle");
+               same(svg.find(".cw-node").length, nodes.length, "Number of SVG 
nodes");
+               same(svg.find(".cw-node-shape").length, nodes.length, "Number 
of SVG node shapes");
+               same(svg.find(".cw-edge").length, edges.length, "Number of SVG 
edges");
+               same(svg.find(".cw-edge-line").length, edges.length, "Number of 
SVG edge lines");
+               
+               // TODO: test node images
+               // TODO: test edge arrows
+       }
     });
     
     // TODO: test selection styles

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
    2011-05-09 21:17:13 UTC (rev 24971)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
    2011-05-09 21:18:58 UTC (rev 24972)
@@ -171,14 +171,6 @@
                        delete properties[visPropName];
                }
                
-               public function getDefaultValue(visPropName:String):* {
-                       var value:* = null;
-                       var vp:VisualPropertyVO = 
getVisualProperty(visPropName);
-                       if (vp != null) value = vp.defaultValue;
-                       
-                       return value;
-               }
-               
                public function getValue(visPropName:String, 
data:Object=null):* {
                        var value:*;
                        

Modified: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Edges.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Edges.as  
2011-05-09 21:17:13 UTC (rev 24971)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Edges.as  
2011-05-09 21:18:58 UTC (rev 24972)
@@ -176,18 +176,18 @@
         }
         
         public static function curvature(e:EdgeSprite):Number {
-            var curvature:Number = 
style.getDefaultValue(VisualProperties.EDGE_CURVATURE) as Number;
+            var curvature:Number = 
style.getValue(VisualProperties.EDGE_CURVATURE, e.data) as Number;
             return e.props.$curvatureFactor * curvature;
         }
         
         public static function selectionGlow(e:EdgeSprite):GlowFilter {
             var filter:GlowFilter = null;
-            var alpha:Number = 
style.getDefaultValue(VisualProperties.EDGE_SELECTION_GLOW_ALPHA) as Number;
-            var blur:Number = 
style.getDefaultValue(VisualProperties.EDGE_SELECTION_GLOW_BLUR) as Number;
-            var strength:Number = 
style.getDefaultValue(VisualProperties.EDGE_SELECTION_GLOW_STRENGTH) as Number;
+            var alpha:Number = 
style.getValue(VisualProperties.EDGE_SELECTION_GLOW_ALPHA, e.data) as Number;
+            var blur:Number = 
style.getValue(VisualProperties.EDGE_SELECTION_GLOW_BLUR, e.data) as Number;
+            var strength:Number = 
style.getValue(VisualProperties.EDGE_SELECTION_GLOW_STRENGTH, e.data) as Number;
             
             if (alpha > 0 && blur > 0 && strength > 0) {
-                var color:uint = 
style.getDefaultValue(VisualProperties.EDGE_SELECTION_GLOW_COLOR) as uint;
+                var color:uint = 
style.getValue(VisualProperties.EDGE_SELECTION_GLOW_COLOR, e.data) as uint;
                 filter = new GlowFilter(color, alpha, blur, blur, strength);
             }
             

Modified: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as 
2011-05-09 21:17:13 UTC (rev 24971)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as 
2011-05-09 21:18:58 UTC (rev 24972)
@@ -28,7 +28,6 @@
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */
 package org.cytoscapeweb.util {
-    import flare.vis.data.Data;
     import flare.vis.data.DataSprite;
     import flare.vis.data.EdgeSprite;
     
@@ -121,10 +120,11 @@
         }
         
         public static function filters(d:DataSprite):Array {
-            var glowColor:uint = 
style.getDefaultValue(_$(VisualProperties.NODE_LABEL_GLOW_COLOR, d));
-            var glowAlpha:Number = 
style.getDefaultValue(_$(VisualProperties.NODE_LABEL_GLOW_ALPHA, d));
-            var glowBlur:Number = 
style.getDefaultValue(_$(VisualProperties.NODE_LABEL_GLOW_BLUR, d));
-            var glowStrength:Number = 
style.getDefaultValue(_$(VisualProperties.NODE_LABEL_GLOW_STRENGTH, d));
+            var data:Object = d.data;
+            var glowColor:uint = 
style.getValue(_$(VisualProperties.NODE_LABEL_GLOW_COLOR, d), data);
+            var glowAlpha:Number = 
style.getValue(_$(VisualProperties.NODE_LABEL_GLOW_ALPHA, d), data);
+            var glowBlur:Number = 
style.getValue(_$(VisualProperties.NODE_LABEL_GLOW_BLUR, d), data);
+            var glowStrength:Number = 
style.getValue(_$(VisualProperties.NODE_LABEL_GLOW_STRENGTH, d), data);
             
             return [new GlowFilter(glowColor, glowAlpha, glowBlur, glowBlur, 
glowStrength)];
         }

Modified: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as  
2011-05-09 21:17:13 UTC (rev 24971)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as  
2011-05-09 21:18:58 UTC (rev 24972)
@@ -193,12 +193,13 @@
         
         public static function selectionGlow(n:NodeSprite):GlowFilter {
             var filter:GlowFilter = null;
-            var alpha:Number = 
style.getDefaultValue(VisualProperties.NODE_SELECTION_GLOW_ALPHA);
-            var blur:Number = 
style.getDefaultValue(VisualProperties.NODE_SELECTION_GLOW_BLUR);
-            var strength:Number = 
style.getDefaultValue(VisualProperties.NODE_SELECTION_GLOW_STRENGTH);
+            var data:Object = n.data;
+            var alpha:Number = 
style.getValue(VisualProperties.NODE_SELECTION_GLOW_ALPHA, data);
+            var blur:Number = 
style.getValue(VisualProperties.NODE_SELECTION_GLOW_BLUR, data);
+            var strength:Number = 
style.getValue(VisualProperties.NODE_SELECTION_GLOW_STRENGTH, data);
             
             if (alpha > 0 && blur > 0 && strength > 0) {
-                var color:uint = 
style.getDefaultValue(VisualProperties.NODE_SELECTION_GLOW_COLOR);           
+                var color:uint = 
style.getValue(VisualProperties.NODE_SELECTION_GLOW_COLOR, data);           
                 filter = new GlowFilter(color, alpha, blur, blur, strength);
             }
             
@@ -207,12 +208,13 @@
         
         public static function hoverGlow(n:NodeSprite):GlowFilter {
             var filter:GlowFilter = null;
-            var alpha:Number = 
style.getDefaultValue(VisualProperties.NODE_HOVER_GLOW_ALPHA);
-            var blur:Number = 
style.getDefaultValue(VisualProperties.NODE_HOVER_GLOW_BLUR);
-            var strength:Number = 
style.getDefaultValue(VisualProperties.NODE_HOVER_GLOW_STRENGTH);
+            var data:Object = n.data;
+            var alpha:Number = 
style.getValue(VisualProperties.NODE_HOVER_GLOW_ALPHA, data);
+            var blur:Number = 
style.getValue(VisualProperties.NODE_HOVER_GLOW_BLUR, data);
+            var strength:Number = 
style.getValue(VisualProperties.NODE_HOVER_GLOW_STRENGTH, data);
             
             if (alpha > 0 && blur > 0 && strength > 0) {
-                var color:uint = 
style.getDefaultValue(VisualProperties.NODE_HOVER_GLOW_COLOR);
+                var color:uint = 
style.getValue(VisualProperties.NODE_HOVER_GLOW_COLOR, data);
                 filter = new GlowFilter(color, alpha, blur, blur, strength);
             }
             

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as  
2011-05-09 21:17:13 UTC (rev 24971)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as  
2011-05-09 21:18:58 UTC (rev 24972)
@@ -787,15 +787,15 @@
             
             // Set visual properties according to current style:
             if (style.hasVisualProperty(VisualProperties.SELECTION_FILL_COLOR))
-                _selectionControl.fillColor = 
style.getDefaultValue(VisualProperties.SELECTION_FILL_COLOR) as uint;
+                _selectionControl.fillColor = 
style.getValue(VisualProperties.SELECTION_FILL_COLOR) as uint;
             if (style.hasVisualProperty(VisualProperties.SELECTION_FILL_ALPHA))
-                _selectionControl.fillAlpha = 
style.getDefaultValue(VisualProperties.SELECTION_FILL_ALPHA) as Number;
+                _selectionControl.fillAlpha = 
style.getValue(VisualProperties.SELECTION_FILL_ALPHA) as Number;
             if (style.hasVisualProperty(VisualProperties.SELECTION_LINE_COLOR))
-                _selectionControl.lineColor = 
style.getDefaultValue(VisualProperties.SELECTION_LINE_COLOR) as uint;
+                _selectionControl.lineColor = 
style.getValue(VisualProperties.SELECTION_LINE_COLOR) as uint;
             if (style.hasVisualProperty(VisualProperties.SELECTION_LINE_ALPHA))
-                _selectionControl.lineAlpha = 
style.getDefaultValue(VisualProperties.SELECTION_LINE_ALPHA) as Number;
+                _selectionControl.lineAlpha = 
style.getValue(VisualProperties.SELECTION_LINE_ALPHA) as Number;
             if (style.hasVisualProperty(VisualProperties.SELECTION_LINE_WIDTH))
-                _selectionControl.lineWidth = 
style.getDefaultValue(VisualProperties.SELECTION_LINE_WIDTH) as Number;
+                _selectionControl.lineWidth = 
style.getValue(VisualProperties.SELECTION_LINE_WIDTH) as Number;
         }
         
         private function disposeDataSprite(ds:DataSprite):void {

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
   2011-05-09 21:17:13 UTC (rev 24971)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
   2011-05-09 21:18:58 UTC (rev 24972)
@@ -172,12 +172,6 @@
             assertEquals(vp, 
style.getVisualProperty(VisualProperties.NODE_SELECTION_COLOR));
         }
         
-        public function testGetDefaultValue():void {
-            for (var p:* in _defValues) {
-                assertEquals(_defValues[p], _style.getDefaultValue(p));
-            }
-        }
-        
         public function testGetValue():void {
             for (var p:* in _defValues) {
                 for each (var data:Object in _dataList) {
@@ -221,7 +215,7 @@
             
             assertEquals("#fbfbfb", o.nodes.color.defaultValue);
             assertEquals("ATTR_1", o.nodes.color.discreteMapper.attrName);
-            
assertEquals(_defStyle.getDefaultValue(VisualProperties.NODE_ALPHA), 
o.nodes.opacity.defaultValue);
+            assertEquals(_defStyle.getValue(VisualProperties.NODE_ALPHA), 
o.nodes.opacity.defaultValue);
             assertEquals("ATTR_2", o.nodes.opacity.continuousMapper.attrName);
             assertEquals("#666666", o.nodes.borderColor);
             assertEquals("#00ff00", o.nodes.tooltipFontColor);
@@ -229,12 +223,12 @@
             assertEquals(0.6, o.nodes.hoverGlowOpacity);
             
             assertEquals( "Missing default value should be replaced by value 
from default visual style",
-                          
Utils.rgbColorAsString(_defStyle.getDefaultValue(VisualProperties.EDGE_COLOR)),
+                          
Utils.rgbColorAsString(_defStyle.getValue(VisualProperties.EDGE_COLOR)),
                           o.edges.color.defaultValue );
             assertEquals("ATTR_2", o.edges.color.discreteMapper.attrName);
             assertEquals(3, o.edges.color.discreteMapper.entries.length);
             assertEquals( "Missing default value should be replaced by value 
from default visual style",
-                           
_defStyle.getDefaultValue(VisualProperties.EDGE_WIDTH),
+                           _defStyle.getValue(VisualProperties.EDGE_WIDTH),
                            o.edges.width.defaultValue );
             
             // Number of 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.

Reply via email to