Author: onursumer
Date: 2011-03-29 09:48:47 -0700 (Tue, 29 Mar 2011)
New Revision: 24607
Modified:
cytoscapeweb/branches/compound/html-template/js/compound.js
cytoscapeweb/branches/compound/src/org/cytoscapeweb/model/data/VisualStyleVO.as
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/CompoundNodes.as
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/Labels.as
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/VisualProperties.as
cytoscapeweb/branches/compound/src/org/cytoscapeweb/vis/data/CompoundNodeSprite.as
Log:
Grouping and naming for the visual properties of compound nodes have been
changed. Instead of adding a new JavaScript group compoundNodes and setting the
visual properties as compoundNodes.color, compoundNodes.shape, etc, now the
properties should be set under the group nodes as nodes.compoundShape,
nodes.compoundColor, etc.
Property names leftMargin, rightMargin, topMargin, and bottomMargin are renamed
to compoundPaddingLeft, compoundPaddingRight, compoundPaddingTop and
compoundPaddingBottom, respectively. Also, required class variables and methods
of the CompoundNodeSprite and CompoundNodes classes are renamed according to
this naming convention.
Modified: cytoscapeweb/branches/compound/html-template/js/compound.js
===================================================================
--- cytoscapeweb/branches/compound/html-template/js/compound.js 2011-03-29
04:15:35 UTC (rev 24606)
+++ cytoscapeweb/branches/compound/html-template/js/compound.js 2011-03-29
16:48:47 UTC (rev 24607)
@@ -4,6 +4,7 @@
*/
var vis;
+var autoLabel = 1;
//options used for Cytoscape Web
var options = {
@@ -48,13 +49,25 @@
*/
nodes: {
+ // regular nodes
size: 30,
- color: "#8a1b0b"
+ color: "#8a1b0b",
+
+ // compound nodes
+ compoundPaddingLeft: 20,
+ compoundPaddingRight: 8,
+ compoundPaddingTop: 12,
+ compoundPaddingBottom: 22,
+ compoundColor: "#9ed1dc",
+ compoundShape: "RECTANGLE",
+ compoundLabelFontSize: 15,
+ compoundLabelVerticalAnchor: "bottom"
},
edges: {
},
+ /*
compoundNodes: {
color: "#9ed1dc",
shape: "RECTANGLE",
@@ -66,6 +79,7 @@
labelFontSize: 15,
labelVerticalAnchor: "bottom"
}
+ */
}
};
@@ -196,10 +210,13 @@
function initContextMenu()
{
vis.addContextMenuItem("Add new node", function(evt) {
+ var label = "node " + autoLabel;
+ autoLabel++;
+
var n = vis.addNode(evt.mouseX,
evt.mouseY,
{ weight: Math.random(),
- label: "node"},
+ label: label},
true,
evt.target);
});
Modified:
cytoscapeweb/branches/compound/src/org/cytoscapeweb/model/data/VisualStyleVO.as
===================================================================
---
cytoscapeweb/branches/compound/src/org/cytoscapeweb/model/data/VisualStyleVO.as
2011-03-29 04:15:35 UTC (rev 24606)
+++
cytoscapeweb/branches/compound/src/org/cytoscapeweb/model/data/VisualStyleVO.as
2011-03-29 16:48:47 UTC (rev 24607)
@@ -54,6 +54,7 @@
selectionFillOpacity: 0.1
},
nodes: {
+ // regular nodes
shape: NodeShapes.ELLIPSE,
size: 24,
color: "#f5f5f5",
@@ -86,7 +87,46 @@
hoverGlowColor: "#aae6ff",
hoverGlowOpacity: 0,
hoverGlowBlur: 8,
- hoverGlowStrength: 6
+ hoverGlowStrength: 6,
+
+ // compound nodes
+ compoundLeftPadding: 10,
+ compoundRightPadding: 10,
+ compoundTopPadding: 10,
+ compoundBottomPadding: 10,
+ compoundShape: NodeShapes.RECTANGLE,
+ compoundSize: 48,
+ compoundColor: "#f5f5f5",
+ compoundOpacity: 0.8,
+ compoundBorderColor: "#666666",
+ compoundBorderWidth: 1,
+ compoundLabel: { passthroughMapper: {
attrName: "label" } },
+ compoundLabelHorizontalAnchor: "center",
+ compoundLabelVerticalAnchor: "bottom",
+ compoundLabelXOffset: 0,
+ compoundLabelYOffset: 0,
+ compoundLabelFontName: "Arial",
+ compoundLabelFontSize: 11,
+ compoundLabelFontColor: "#000000",
+ compoundLabelFontWeight: "normal",
+ compoundLabelFontStyle: "normal",
+ compoundLabelGlowColor: "#ffffff",
+ compoundLabelGlowOpacity: 0,
+ compoundLabelGlowBlur: 2,
+ compoundLabelGlowStrength: 20,
+ compoundTooltipFont: "Arial",
+ compoundTooltipFontSize: 11,
+ compoundTooltipFontColor: "#000000",
+ compoundTooltipBackgroundColor:
"#f5f5cc",
+ compoundTooltipBorderColor: "#000000",
+ compoundSelectionGlowColor: "#ffff33",
+ compoundSelectionGlowOpacity: 0.6,
+ compoundSelectionGlowBlur: 8,
+ compoundSelectionGlowStrength: 6,
+ compoundHoverGlowColor: "#aae6ff",
+ compoundHoverGlowOpacity: 0,
+ compoundHoverGlowBlur: 8,
+ compoundHoverGlowStrength: 6
},
edges: {
color: "#999999",
@@ -129,47 +169,7 @@
selectionGlowBlur: 4,
selectionGlowStrength: 10,
curvature: 18
- },
- compoundNodes: {
- shape: NodeShapes.RECTANGLE,
- size: 48,
- color: "#f5f5f5",
- opacity: 0.8,
- borderColor: "#666666",
- borderWidth: 1,
- leftMargin: 10,
- rightMargin: 10,
- topMargin: 10,
- bottomMargin: 10,
- label: { passthroughMapper: { attrName:
"label" } },
- labelHorizontalAnchor: "center",
- labelVerticalAnchor: "bottom",
- labelXOffset: 0,
- labelYOffset: 0,
- labelFontName: "Arial",
- labelFontSize: 11,
- labelFontColor: "#000000",
- labelFontWeight: "normal",
- labelFontStyle: "normal",
- labelGlowColor: "#ffffff",
- labelGlowOpacity: 0,
- labelGlowBlur: 2,
- labelGlowStrength: 20,
- tooltipFont: "Arial",
- tooltipFontSize: 11,
- tooltipFontColor: "#000000",
- tooltipBackgroundColor: "#f5f5cc",
- tooltipBorderColor: "#000000",
- selectionGlowColor: "#ffff33",
- selectionGlowOpacity: 0.6,
- selectionGlowBlur: 8,
- selectionGlowStrength: 6,
- hoverGlowColor: "#aae6ff",
- hoverGlowOpacity: 0,
- hoverGlowBlur: 8,
- hoverGlowStrength: 6
- }
-
+ }
};
// ========[ PUBLIC PROPERTIES
]============================================================
Modified:
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/CompoundNodes.as
===================================================================
--- cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/CompoundNodes.as
2011-03-29 04:15:35 UTC (rev 24606)
+++ cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/CompoundNodes.as
2011-03-29 16:48:47 UTC (rev 24607)
@@ -59,10 +59,10 @@
{
shape: CompoundNodes.shape,
size: CompoundNodes.size,
- leftMargin: CompoundNodes.leftMargin,
- rightMargin: CompoundNodes.rightMargin,
- topMargin: CompoundNodes.topMargin,
- bottomMargin:
CompoundNodes.bottomMargin,
+ paddingLeft: CompoundNodes.paddingLeft,
+ paddingRight:
CompoundNodes.paddingRight,
+ paddingTop: CompoundNodes.paddingTop,
+ paddingBottom:
CompoundNodes.paddingBottom,
fillColor: CompoundNodes.fillColor,
lineColor: CompoundNodes.lineColor,
lineWidth: CompoundNodes.lineWidth,
@@ -270,34 +270,34 @@
return filter;
}
- public static function leftMargin(n:NodeSprite) : Number
+ public static function paddingLeft(n:NodeSprite) : Number
{
var margin:Number = style.getValue(
- VisualProperties.C_NODE_LEFT_MARGIN, n.data);
+ VisualProperties.C_NODE_PADDING_LEFT, n.data);
return margin;
}
- public static function rightMargin(n:NodeSprite) : Number
+ public static function paddingRight(n:NodeSprite) : Number
{
var margin:Number = style.getValue(
- VisualProperties.C_NODE_RIGHT_MARGIN, n.data);
+ VisualProperties.C_NODE_PADDING_RIGHT, n.data);
return margin;
}
- public static function topMargin(n:NodeSprite) : Number
+ public static function paddingTop(n:NodeSprite) : Number
{
var margin:Number = style.getValue(
- VisualProperties.C_NODE_TOP_MARGIN, n.data);
+ VisualProperties.C_NODE_PADDING_TOP, n.data);
return margin;
}
- public static function bottomMargin(n:NodeSprite) : Number
+ public static function paddingBottom(n:NodeSprite) : Number
{
var margin:Number = style.getValue(
- VisualProperties.C_NODE_BOTTOM_MARGIN, n.data);
+ VisualProperties.C_NODE_PADDING_BOTTOM, n.data);
return margin;
}
Modified: cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/Labels.as
===================================================================
--- cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/Labels.as
2011-03-29 04:15:35 UTC (rev 24606)
+++ cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/Labels.as
2011-03-29 16:48:47 UTC (rev 24607)
@@ -135,7 +135,7 @@
/**
* @param propName A node property name.
* @param d A node or edge sprite.
- * @return The analogue edge property name name if the DataSprite is
an edge
+ * @return The analogue property name if the DataSprite is an edge or
a compound node
*/
private static function _$(propName:String, d:DataSprite):String
{
@@ -147,7 +147,13 @@
{
if ((d as CompoundNodeSprite).isInitialized())
{
- propName = propName.replace("node",
"compoundNode");
+ var idx:int = propName.indexOf(".");
+
+ // convert from node.property to
node.compoundProperty
+
+ propName = propName.substring(0,idx+1)
+ "compound" +
+
propName.charAt(idx+1).toUpperCase() +
+ propName.substring(idx+2);
}
}
Modified:
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/VisualProperties.as
===================================================================
---
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/VisualProperties.as
2011-03-29 04:15:35 UTC (rev 24606)
+++
cytoscapeweb/branches/compound/src/org/cytoscapeweb/util/VisualProperties.as
2011-03-29 16:48:47 UTC (rev 24607)
@@ -127,39 +127,39 @@
// Compound Nodes properties:
//--------------------------------
- public static const C_NODE_SHAPE:String = "compoundNodes.shape";
- public static const C_NODE_SIZE:String = "compoundNodes.size";
- public static const C_NODE_COLOR:String = "compoundNodes.color";
- public static const C_NODE_ALPHA:String =
"compoundNodes.opacity";
- public static const C_NODE_LINE_COLOR:String =
"compoundNodes.borderColor";
- public static const C_NODE_LINE_WIDTH:String =
"compoundNodes.borderWidth";
- public static const C_NODE_IMAGE:String = "compoundNodes.image";
+ public static const C_NODE_PADDING_LEFT:String =
"nodes.compoundPaddingLeft";
+ public static const C_NODE_PADDING_RIGHT:String =
"nodes.compoundPaddingRight";
+ public static const C_NODE_PADDING_TOP:String =
"nodes.compoundPaddingTop";
+ public static const C_NODE_PADDING_BOTTOM:String =
"nodes.compoundPaddingBottom";
- public static const C_NODE_LEFT_MARGIN:String =
"compoundNodes.leftMargin";
- public static const C_NODE_RIGHT_MARGIN:String =
"compoundNodes.rightMargin";
- public static const C_NODE_TOP_MARGIN:String =
"compoundNodes.topMargin";
- public static const C_NODE_BOTTOM_MARGIN:String =
"compoundNodes.bottomMargin";
+ public static const C_NODE_SHAPE:String = "nodes.compoundShape";
+ public static const C_NODE_SIZE:String = "nodes.compoundSize";
+ public static const C_NODE_COLOR:String = "nodes.compoundColor";
+ public static const C_NODE_ALPHA:String =
"nodes.compoundOpacity";
+ public static const C_NODE_LINE_COLOR:String =
"nodes.compoundBorderColor";
+ public static const C_NODE_LINE_WIDTH:String =
"nodes.compoundBorderWidth";
+ public static const C_NODE_IMAGE:String =
"nodes.compoundImage";
- public static const C_NODE_SELECTION_COLOR:String =
"compoundNodes.selectionColor";
- public static const C_NODE_SELECTION_ALPHA:String =
"compoundNodes.selectionOpacity";
- public static const C_NODE_SELECTION_LINE_COLOR:String =
"compoundNodes.selectionBorderColor";
- public static const C_NODE_SELECTION_LINE_WIDTH:String =
"compoundNodes.selectionBorderWidth";
- public static const C_NODE_SELECTION_GLOW_COLOR:String =
"compoundNodes.selectionGlowColor";
- public static const C_NODE_SELECTION_GLOW_ALPHA:String =
"compoundNodes.selectionGlowOpacity";
- public static const C_NODE_SELECTION_GLOW_BLUR:String =
"compoundNodes.selectionGlowBlur";
- public static const C_NODE_SELECTION_GLOW_STRENGTH:String =
"compoundNodes.selectionGlowStrength";
+ public static const C_NODE_SELECTION_COLOR:String =
"nodes.compoundSelectionColor";
+ public static const C_NODE_SELECTION_ALPHA:String =
"nodes.compoundSelectionOpacity";
+ public static const C_NODE_SELECTION_LINE_COLOR:String =
"nodes.compoundSelectionBorderColor";
+ public static const C_NODE_SELECTION_LINE_WIDTH:String =
"nodes.compoundSelectionBorderWidth";
+ public static const C_NODE_SELECTION_GLOW_COLOR:String =
"nodes.compoundSelectionGlowColor";
+ public static const C_NODE_SELECTION_GLOW_ALPHA:String =
"nodes.compoundSelectionGlowOpacity";
+ public static const C_NODE_SELECTION_GLOW_BLUR:String =
"nodes.compoundSelectionGlowBlur";
+ public static const C_NODE_SELECTION_GLOW_STRENGTH:String =
"nodes.compoundSelectionGlowStrength";
- public static const C_NODE_HOVER_ALPHA:String =
"compoundNodes.hoverOpacity";
- public static const C_NODE_HOVER_LINE_COLOR:String =
"compoundNodes.hoverBorderColor";
- public static const C_NODE_HOVER_LINE_WIDTH:String =
"compoundNodes.hoverBorderWidth";
- public static const C_NODE_HOVER_GLOW_COLOR:String =
"compoundNodes.hoverGlowColor";
- public static const C_NODE_HOVER_GLOW_ALPHA:String =
"compoundNodes.hoverGlowOpacity";
- public static const C_NODE_HOVER_GLOW_BLUR:String =
"compoundNodes.hoverGlowBlur";
- public static const C_NODE_HOVER_GLOW_STRENGTH:String =
"compoundNodes.hoverGlowStrength";
+ public static const C_NODE_HOVER_ALPHA:String =
"nodes.compoundHoverOpacity";
+ public static const C_NODE_HOVER_LINE_COLOR:String =
"nodes.compoundHoverBorderColor";
+ public static const C_NODE_HOVER_LINE_WIDTH:String =
"nodes.compoundHoverBorderWidth";
+ public static const C_NODE_HOVER_GLOW_COLOR:String =
"nodes.compoundHoverGlowColor";
+ public static const C_NODE_HOVER_GLOW_ALPHA:String =
"nodes.compoundHoverGlowOpacity";
+ 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_LABEL_FONT_SIZE:String =
"compoundNodes.labelFontSize";
- public static const C_NODE_LABEL_HANCHOR:String =
"compoundNodes.labelHorizontalAnchor";
- public static const C_NODE_LABEL_VANCHOR:String =
"compoundNodes.labelVerticalAnchor";
+ public static const C_NODE_LABEL_FONT_SIZE:String =
"nodes.compoundLabelFontSize";
+ public static const C_NODE_LABEL_HANCHOR:String =
"nodes.compoundLabelHorizontalAnchor";
+ public static const C_NODE_LABEL_VANCHOR:String =
"nodes.compoundLabelVerticalAnchor";
// TODO rename and create colors, etc:
public static const EDGE_TOOLTIP_TEXT_MERGE:String =
"edges.mergeTooltipText";
Modified:
cytoscapeweb/branches/compound/src/org/cytoscapeweb/vis/data/CompoundNodeSprite.as
===================================================================
---
cytoscapeweb/branches/compound/src/org/cytoscapeweb/vis/data/CompoundNodeSprite.as
2011-03-29 04:15:35 UTC (rev 24606)
+++
cytoscapeweb/branches/compound/src/org/cytoscapeweb/vis/data/CompoundNodeSprite.as
2011-03-29 16:48:47 UTC (rev 24607)
@@ -9,7 +9,7 @@
/**
* This class represents a Compound Node with its child nodes, bounds
and
- * margin values. A compound node can contain any other node (both
simple
+ * padding values. A compound node can contain any other node (both
simple
* node and compound node) as its child.
*
* @author Selcuk Onur Sumer
@@ -26,10 +26,10 @@
private var _parentId:String;
private var _bounds:Rectangle;
- private var _leftMargin:Number;
- private var _rightMargin:Number;
- private var _topMargin:Number;
- private var _bottomMargin:Number;
+ private var _paddingLeft:Number;
+ private var _paddingRight:Number;
+ private var _paddingTop:Number;
+ private var _paddingBottom:Number;
// ===================== [ PUBLIC PROPERTIES ]
=========================
@@ -42,55 +42,55 @@
}
/**
- * Width of the right margin of the compound node
+ * Width of the right padding of the compound node
*/
- public function get rightMargin():Number
+ public function get paddingRight():Number
{
- return _rightMargin;
+ return _paddingRight;
}
- public function set rightMargin(value:Number):void
+ public function set paddingRight(value:Number):void
{
- _rightMargin = value;
+ _paddingRight = value;
}
/**
- * Height of the margin of the compound node
+ * Height of the top padding of the compound node
*/
- public function get topMargin():Number
+ public function get paddingTop():Number
{
- return _topMargin;
+ return _paddingTop;
}
- public function set topMargin(value:Number):void
+ public function set paddingTop(value:Number):void
{
- _topMargin = value;
+ _paddingTop = value;
}
/**
- * Height of the bottom margin of the compound node
+ * Height of the bottom padding of the compound node
*/
- public function get bottomMargin():Number
+ public function get paddingBottom():Number
{
- return _bottomMargin;
+ return _paddingBottom;
}
- public function set bottomMargin(value:Number):void
+ public function set paddingBottom(value:Number):void
{
- _bottomMargin = value;
+ _paddingBottom = value;
}
/**
- * Width of the left margin of the compound node
+ * Width of the left padding of the compound node
*/
- public function get leftMargin():Number
+ public function get paddingLeft():Number
{
- return _leftMargin;
+ return _paddingLeft;
}
- public function set leftMargin(value:Number):void
+ public function set paddingLeft(value:Number):void
{
- _leftMargin = value;
+ _paddingLeft = value;
}
/**
@@ -235,11 +235,11 @@
public function updateBounds(bounds:Rectangle) : void
{
- // extend bounds by adding margin width & height
- bounds.x -= this.leftMargin;
- bounds.y -= this.topMargin;
- bounds.height += this.topMargin + this.bottomMargin;
- bounds.width += this.leftMargin + this.rightMargin;
+ // extend bounds by adding padding width & height
+ bounds.x -= this.paddingLeft;
+ bounds.y -= this.paddingTop;
+ bounds.height += this.paddingTop + this.paddingBottom;
+ bounds.width += this.paddingLeft + this.paddingRight;
// set bounds
_bounds = bounds;
--
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.