Author: clopes
Date: 2012-03-27 12:22:01 -0700 (Tue, 27 Mar 2012)
New Revision: 28670
Added:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/SizePolicies.as
Modified:
cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.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/CompoundNodes.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/util/VisualProperties.as
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/components/GraphVis.as
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/layout/CompoundSpringEmbedder.as
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/CompoundNodeRenderer.as
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/Labeler.as
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
Log:
Fixed bug #2697: Compound node image not updated correctly when adding a child
node.
The nodes.compoundSize visual property now accepts "auto" and "ignoreLabels" as
values.
Modified: cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js
2012-03-27 18:03:25 UTC (rev 28669)
+++ cytoscapeweb/trunk/cytoscapeweb/html-template/js/cytoscapeweb.js
2012-03-27 19:22:01 UTC (rev 28670)
@@ -2738,7 +2738,12 @@
* <li><code>size</code> {Number}: Node size, in pixels.
* It has the same effect of setting
the same value (or mapper) to both <code>width</code> and <code>height</code>.
* The default value is 24.
- * The size of compound nodes is
automatically calculated, so setting <code>compoundSize</code> has no
effect.</li>
+ * You can also set
<code>"auto"</code> if you want to let Cytoscape Web calculate the size of the
node automatically so it encloses its label.</li>
+ * <li><code>compoundSize</code> {String}: The size of compound nodes
is always automatically calculated, so the actual size cannot be set.
+ * This property accepts two
values:
+ * <ul><li><code>auto</code>
(default): compound nodes are sized to fit their child labels inside.</li>
+ *
<li><code>ignoreLabels</code>: child labels are ignored when calculating the
compound node size.</li>
+ * </ul></li>
* <li><code>width</code> {Number}: Node width, in pixels. It is not
set by default.
* If set, it overrides the value
returned by <code>size</code>.
* Because the size of compound nodes
is automatically calculated, setting <code>compoundWidth</code> has no
effect.</li>
@@ -2824,9 +2829,7 @@
* <li><code>tooltipFontSize</code> {Number}: The point size of node
tool tips. The default value is 11.</li>
* <li><code>tooltipFontColor</code> {String}: Font color of node tool
tips. The default value is "#000000".</li>
* <li><code>tooltipBackgroundColor</code> {String}: Background color
of node tool tips. The default value is "#f5f5cc".</li>
- * <li><code>tooltipBorderColor</code> {String}: Border color of node
tool tips. The default value is "#000000".</li>
- * <li><code>compoundChildLabelEnclosure</code> {Boolean}: Whether or
not compound nodes should enclose child node/edge labels.
- * The default
value is <code>true</code>, meaning compound nodes are sized to fit their child
labels inside.</li></ul>
+ * <li><code>tooltipBorderColor</code> {String}: Border color of node
tool tips. The default value is "#000000".</li></ul>
* @property
* @name nodes
* @type Object
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/data/VisualStyleVO.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -97,7 +97,7 @@
compoundPaddingTop: 10,
compoundPaddingBottom: 10,
compoundShape: NodeShapes.RECTANGLE,
- compoundSize: 48,
+ compoundSize: "auto",
compoundColor: "#f5f5f5",
compoundOpacity: 0.8,
compoundBorderColor: "#666666",
@@ -128,8 +128,7 @@
compoundHoverGlowColor: "#aae6ff",
compoundHoverGlowOpacity: 0,
compoundHoverGlowBlur: 8,
- compoundHoverGlowStrength: 6,
- compoundChildLabelEnclosure: true
+ compoundHoverGlowStrength: 6
},
edges: {
color: "#999999",
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/CompoundNodes.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/CompoundNodes.as
2012-03-27 18:03:25 UTC (rev 28669)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/CompoundNodes.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -48,6 +48,9 @@
public static const SELECTED:String = "selected";
public static const NON_SELECTED:String = "non-selected";
+ public static const AUTO_SIZE:Number = -1;
+ public static const AUTO_IGNORE_LABELS_SIZE:Number = -2;
+
private static var _properties:Object;
private static var _configProxy:ConfigProxy;
private static var _graphProxy:GraphProxy;
@@ -90,9 +93,6 @@
if (CompoundNodes._properties == null) {
CompoundNodes._properties = {
shape: CompoundNodes.shape,
- //"props.compoundWidth": Nodes.width,
- //"props.compoundHeight": Nodes.height,
- //"props.compoundAutoSize": Nodes.autoSize,
size: CompoundNodes.size,
paddingLeft: CompoundNodes.paddingLeft,
paddingRight: CompoundNodes.paddingRight,
@@ -135,6 +135,8 @@
// set size as double size of a simple node
var size:Number = style.getValue(
VisualProperties.NODE_SIZE, n.data) * 2;
+
+ if (size < 1) size = 48;
return size / _properties.renderer.defaultSize;
}
Modified: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as
2012-03-27 18:03:25 UTC (rev 28669)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Labels.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -107,7 +107,7 @@
}
public static function labelHAnchor(d:DataSprite):int {
- if (d is NodeSprite && d.props.autoSize) {
+ if (d is NodeSprite && d.size == SizePolicies.AUTO) {
if (! (d is CompoundNodeSprite && (d as
CompoundNodeSprite).nodesCount > 0))
return TextSprite.CENTER;
}
@@ -115,7 +115,7 @@
}
public static function labelVAnchor(d:DataSprite):int {
- if (d is NodeSprite && d.props.autoSize) {
+ if (d is NodeSprite && d.size == SizePolicies.AUTO) {
if (! (d is CompoundNodeSprite && (d as
CompoundNodeSprite).nodesCount > 0))
return TextSprite.MIDDLE;
}
Modified: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
2012-03-27 18:03:25 UTC (rev 28669)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -37,7 +37,6 @@
import org.cytoscapeweb.model.data.VisualStyleBypassVO;
import org.cytoscapeweb.model.data.VisualStyleVO;
import org.cytoscapeweb.view.render.NodeRenderer;
- import org.cytoscapeweb.vis.data.CompoundNodeSprite;
public class Nodes {
@@ -80,7 +79,6 @@
shape: shape,
"props.width": width,
"props.height": height,
- "props.autoSize": autoSize,
size: size,
fillColor: fillColor,
lineColor: lineColor,
@@ -107,7 +105,7 @@
public static function size(n:NodeSprite):Number {
var size:* = style.getValue(VisualProperties.NODE_SIZE, n.data);
// Flare size is a relative value:
- return size < 0 ? -1 : size/_properties.renderer.defaultSize;
+ return size < 0 ? SizePolicies.AUTO :
size/_properties.renderer.defaultSize;
}
public static function width(n:NodeSprite):Number {
@@ -120,13 +118,6 @@
return h;
}
- public static function autoSize(n:NodeSprite):Boolean {
- var size:Number = style.getValue(VisualProperties.NODE_SIZE,
n.data);
- var wrap:Boolean = size === -1;
-
- return wrap;
- }
-
public static function fillColor(n:NodeSprite):uint {
var propName:String = VisualProperties.NODE_COLOR;
Added: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/SizePolicies.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/SizePolicies.as
(rev 0)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/SizePolicies.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -0,0 +1,54 @@
+/*
+ This file is part of Cytoscape Web.
+ Copyright (c) 2009, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Agilent Technologies
+ - Institut Pasteur
+ - Institute for Systems Biology
+ - Memorial Sloan-Kettering Cancer Center
+ - National Center for Integrative Biomedical Informatics
+ - Unilever
+ - University of California San Diego
+ - University of California San Francisco
+ - University of Toronto
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+package org.cytoscapeweb.util {
+
+
+ public class SizePolicies {
+
+ // ========[ CONSTANTS
]====================================================================
+
+ public static const AUTO:Number = -1;
+ public static const AUTO_IGNORE_LABELS:Number = -2;
+
+ // ========[ CONSTRUCTOR
]==================================================================
+
+ /**
+ * This constructor will throw an error, as this is an abstract class.
+ */
+ public function SizePolicies() {
+ throw new Error("This is an abstract class.");
+ }
+
+ // ========[ PUBLIC METHODS
]===============================================================
+
+ // ========[ PRIVATE METHODS
]==============================================================
+
+ }
+}
\ No newline at end of file
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/VisualProperties.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/VisualProperties.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/VisualProperties.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -184,8 +184,6 @@
public static const C_NODE_HOVER_GLOW_BLUR:String =
"nodes.compoundHoverGlowBlur";
public static const C_NODE_HOVER_GLOW_STRENGTH:String =
"nodes.compoundHoverGlowStrength";
- public static const C_NODE_CHILD_LABEL_ENCLOSURE:String =
"nodes.compoundChildLabelEnclosure";
-
// TODO rename and create colors, etc:
public static const EDGE_TOOLTIP_TEXT_MERGE:String =
"edges.mergeTooltipText";
@@ -249,9 +247,13 @@
val = 0xffffff;
}
} else if (isNumber(name)) {
- if (name === NODE_SIZE && (val is String) &&
- String(val).toLowerCase() === "auto") {
- val = -1;
+ if (name === NODE_SIZE && (val is String) &&
String(val).toLowerCase() === "auto") {
+ val = SizePolicies.AUTO;
+ } else if (name === C_NODE_SIZE) {
+ if ((val is String) && String(val).toLowerCase() ===
"ignorelabels")
+ val = SizePolicies.AUTO_IGNORE_LABELS;
+ else
+ val = SizePolicies.AUTO;
} else {
val = Number(value);
@@ -286,8 +288,14 @@
} else if (isNumber(name)) {
value = Number(value);
- if (name === NODE_SIZE && value < 0)
+ if (name === NODE_SIZE && value < 0) {
value = "auto";
+ } else if (name === C_NODE_SIZE && value < 0) {
+ if (value === SizePolicies.AUTO_IGNORE_LABELS)
+ value = "ignoreLabels";
+ else
+ value = "auto";
+ }
} else if (isString(name)) {
if (value == null) value = "";
else value = value.toString();
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
2012-03-27 18:03:25 UTC (rev 28669)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -252,10 +252,8 @@
graphView.updateLabels(Groups.NODES);
graphView.updateLabels(Groups.COMPOUND_NODES);
graphView.updateLabels(Groups.EDGES);
+ vis.updateAllCompoundBounds();
- if
(configProxy.visualStyle.getValue(VisualProperties.C_NODE_CHILD_LABEL_ENCLOSURE))
- vis.updateAllCompoundBounds();
-
separateDisconnected();
}
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/components/GraphVis.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/components/GraphVis.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/components/GraphVis.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -64,6 +64,7 @@
import org.cytoscapeweb.util.Labels;
import org.cytoscapeweb.util.Layouts;
import org.cytoscapeweb.util.Nodes;
+ import org.cytoscapeweb.util.SizePolicies;
import org.cytoscapeweb.util.Utils;
import org.cytoscapeweb.util.VisualProperties;
import org.cytoscapeweb.util.methods.$each;
@@ -411,7 +412,7 @@
data.visit(function(ds:DataSprite):Boolean {
var lb:TextSprite = labels.getValue(ds);
if (lb != null) lb.visible = visible && ds.visible;
- if (ds is NodeSprite && ds.props.autoSize) {
+ if (ds is NodeSprite && ds.size == SizePolicies.AUTO) {
if (! (ds is CompoundNodeSprite && (ds as
CompoundNodeSprite).nodesCount > 0)) {
ds.dirty();
}
@@ -520,7 +521,7 @@
}
// calculate&update bounds of the compound node
- if
(_style.getValue(VisualProperties.C_NODE_CHILD_LABEL_ENCLOSURE)) {
+ if
(_style.getValue(VisualProperties.C_NODE_SIZE, cns.data) == SizePolicies.AUTO) {
bounds = this.getRealBounds(children);
} else {
bounds =
GraphUtils.getBounds(children.nodes, null, true, true);
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/layout/CompoundSpringEmbedder.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/layout/CompoundSpringEmbedder.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/layout/CompoundSpringEmbedder.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -41,6 +41,7 @@
import org.cytoscapeweb.model.data.VisualStyleVO;
import org.cytoscapeweb.util.GraphUtils;
import org.cytoscapeweb.util.Groups;
+ import org.cytoscapeweb.util.SizePolicies;
import org.cytoscapeweb.util.VisualProperties;
import org.cytoscapeweb.view.components.GraphVis;
import org.cytoscapeweb.view.layout.ivis.layout.CoSEOptions;
@@ -308,7 +309,7 @@
retrieveProxy(ConfigProxy.NAME) as
ConfigProxy;
var style:VisualStyleVO =
configProxy.config.visualStyle;
- var encloseLabels:Boolean =
style.getValue(VisualProperties.C_NODE_CHILD_LABEL_ENCLOSURE);
+ var encloseLabels:Boolean =
style.getValue(VisualProperties.C_NODE_SIZE, node.data) == SizePolicies.AUTO;
if(encloseLabels)
{
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/CompoundNodeRenderer.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/CompoundNodeRenderer.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/CompoundNodeRenderer.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -93,6 +93,7 @@
// Even if "transparent", we still need to draw a shape,
// or the node will not receive mouse events
if (d.props.transparent) fillAlpha = 0;
+
// draw the background color:
// Using a bit mask to avoid transparent mdes
when fillcolor=0xffffffff.
// See
https://sourceforge.net/forum/message.php?msg_id=7393265
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/Labeler.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/Labeler.as
2012-03-27 18:03:25 UTC (rev 28669)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/Labeler.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -47,6 +47,7 @@
import org.cytoscapeweb.util.Groups;
import org.cytoscapeweb.util.NodeShapes;
+ import org.cytoscapeweb.util.SizePolicies;
import org.cytoscapeweb.util.Utils;
import org.cytoscapeweb.util.methods.$each;
import org.cytoscapeweb.vis.data.CompoundNodeSprite;
@@ -241,7 +242,7 @@
if (label.verticalAnchor === TextSprite.TOP)
myYOffset += d.height/2;
else if (label.verticalAnchor === TextSprite.BOTTOM)
myYOffset -= d.height/2;
- if (d.props.autoSize) {
+ if (d.size == SizePolicies.AUTO) {
if (! (d is CompoundNodeSprite && (d as
CompoundNodeSprite).nodesCount > 0)) {
d.render();
if (d.shape == NodeShapes.TRIANGLE) myYOffset +=
d.height/4;
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -40,6 +40,7 @@
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.geom.Rectangle;
+ import flash.utils.clearTimeout;
import flash.utils.setTimeout;
import mx.utils.StringUtil;
@@ -57,6 +58,8 @@
private static const WRAP_PAD:Number = 5;
+ private var drawTimerId:uint = 0;
+
private static var _instance:NodeRenderer = new NodeRenderer();
public static function get instance():NodeRenderer { return _instance;
}
@@ -93,7 +96,7 @@
// See https://sourceforge.net/forum/message.php?msg_id=7393265
var fillColor:uint = 0xffffff & d.fillColor;
var fillAlpha:Number = d.fillAlpha;
- var size:Number = d.size * defaultSize;
+ var size:Number = d.size;
var lineColor:uint = d.lineColor;
var lineAlpha:Number = d.lineAlpha;
@@ -102,7 +105,7 @@
var w:Number = d.props.width;
var h:Number = d.props.height;
- if (d.props.autoSize) {
+ if (size < 0) {
var lbl:TextSprite = d.props.label;
var hf:Number = 1, wf:Number = 1;
@@ -130,6 +133,7 @@
w += 2 * WRAP_PAD;
h += 2 * WRAP_PAD;
} else {
+ size *= defaultSize
if (isNaN(w) || w < 0) w = size;
if (isNaN(h) || h < 0) h = size;
}
@@ -220,9 +224,16 @@
}
function drawWhenLoaded():void {
- setTimeout(function():void {trace(" .TIMEOUT: Checking
again...");
- if (_imgCache.isLoaded(url)) draw();
- else if (!_imgCache.isBroken(url)) drawWhenLoaded();
+ if (drawTimerId != 0)
+ clearTimeout(drawTimerId);
+
+ drawTimerId = setTimeout(function():void {trace("
.TIMEOUT: Checking again...");
+ if (_imgCache.isLoaded(url)) {
+ drawTimerId = 0;
+ draw();
+ } else if (!_imgCache.isBroken(url)) {
+ drawWhenLoaded();
+ }
}, 50);
}
@@ -247,7 +258,7 @@
var m:Matrix = new Matrix();
m.scale(scale, scale);
- m.translate(-(bd.width*scale)/2, -(bd.height*scale)/2);
+ m.translate(-(iw*scale)/2, -(ih*scale)/2);
// Draw the image as background
d.graphics.beginBitmapFill(bd, m, false, true);
Modified:
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
2012-03-27 18:03:25 UTC (rev 28669)
+++
cytoscapeweb/trunk/cytoscapeweb/src-test/org/cytoscapeweb/model/data/VisualStyleVOTest.as
2012-03-27 19:22:01 UTC (rev 28670)
@@ -33,6 +33,7 @@
import org.cytoscapeweb.util.ArrowShapes;
import org.cytoscapeweb.util.NodeShapes;
+ import org.cytoscapeweb.util.SizePolicies;
import org.cytoscapeweb.util.Utils;
import org.cytoscapeweb.util.VisualProperties;
@@ -230,6 +231,7 @@
assertEquals( "Missing default value should be replaced by value
from default visual style",
_defStyle.getValue(VisualProperties.EDGE_WIDTH),
o.edges.width.defaultValue );
+ assertEquals("auto", o.nodes.compoundSize);
// Number of properties.
var arr:Array = vs.getPropertiesAsArray();
@@ -265,6 +267,7 @@
assertEquals(_defStyle.getValue(VisualProperties.NODE_SIZE),
style.getValue(VisualProperties.NODE_SIZE));
assertEquals(_defStyle.getValue(VisualProperties.EDGE_ALPHA) ,
style.getValue(VisualProperties.EDGE_ALPHA));
assertEquals(_defStyle.getValue(VisualProperties.EDGE_WIDTH),
style.getValue(VisualProperties.EDGE_WIDTH));
+ assertEquals(_defStyle.getValue(VisualProperties.C_NODE_SIZE),
style.getValue(VisualProperties.C_NODE_SIZE));
// 2. Simple Object:
style = VisualStyleVO.fromObject(_simpleStyle);
@@ -312,6 +315,20 @@
for each (var data:Object in _dataList)
assertEquals(style1.getValue(pName, data),
style2.getValue(pName, data));
}
+
+ // 4. AUTO sizes:
+ style = VisualStyleVO.fromObject({ nodes: { size: "auto",
compoundSize: "auto" } });
+ assertEquals(SizePolicies.AUTO,
style.getValue(VisualProperties.NODE_SIZE));
+ assertEquals(SizePolicies.AUTO,
style.getValue(VisualProperties.C_NODE_SIZE));
+
+ style = VisualStyleVO.fromObject({ nodes: { compoundSize: 10 } });
+ assertEquals(SizePolicies.AUTO,
style.getValue(VisualProperties.C_NODE_SIZE));
+
+ style = VisualStyleVO.fromObject({ nodes: { compoundSize: -10 }
});
+ assertEquals(SizePolicies.AUTO,
style.getValue(VisualProperties.C_NODE_SIZE));
+
+ style = VisualStyleVO.fromObject({ nodes: { compoundSize:
"ignoreLabels" } });
+ assertEquals(SizePolicies.AUTO_IGNORE_LABELS,
style.getValue(VisualProperties.C_NODE_SIZE));
}
public function testDefaultVisualStyle():void {
--
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.