Packageflare.vis.data
Classpublic class NodeSprite
InheritanceNodeSprite Inheritance DataSprite Inheritance DirtySprite Inheritance flash.display.Sprite

Visually represents a data element, such as a data tuple or graph node. By default, NodeSprites are drawn using a . NodeSprites are typically managed by a Data object.

NodeSprites can separately maintain adjacency lists for both a general graph structure (managing lists for inlinks and outlinks) and a tree structure (managing a list for child links and a parent pointer). The graph and tree lists are maintained completely separately to maximize flexibility. While the the tree lists are often used to record a spanning tree of the general network structure, they can also be used to represent a hierarchy completely distinct from a co-existing graph structure. Take this into account when iterating over the edges incident on this node.



Public Properties
 PropertyDefined by
  angle : Number
[write-only]
NodeSprite
  childDegree : uint
[read-only] The number of child links.
NodeSprite
 Inheriteddata : Object
Object storing backing data values.
DataSprite
  degree : uint
[read-only] The number of inlinks and outlinks.
NodeSprite
  depth : uint
[read-only] The depth of this node in the tree structure.
NodeSprite
  expanded : Boolean
Flag indicating if this node is currently expanded.
NodeSprite
 InheritedfillAlpha : Number
The alpha channel (a value between 0 and 1) for the fill color.
DataSprite
 InheritedfillColor : uint
The fill color for this data sprite.
DataSprite
 InheritedfillHue : Number
The hue component of the fill color in HSV color space.
DataSprite
 InheritedfillSaturation : Number
The saturation component of the fill color in HSV color space.
DataSprite
 InheritedfillValue : Number
The value (brightness) component of the fill color in HSV color space.
DataSprite
  firstChildNode : NodeSprite
[read-only] The first child of this node in the tree structure.
NodeSprite
 Inheritedfixed : Boolean
Fixed flag to prevent this sprite from being re-positioned.
DataSprite
 Inheritedh : Number
Auxiliary property often used as a height parameter.
DataSprite
 Inheritedheight : Number
If dirty, this sprite is re-rendered before returning the height.
DirtySprite
  inDegree : uint
[read-only] The number of inlinks.
NodeSprite
  lastChildNode : NodeSprite
[read-only] The last child of this node in the tree structure.
NodeSprite
 InheritedlineAlpha : Number
The alpha channel (a value between 0 and 1) for the line color.
DataSprite
 InheritedlineColor : uint
The line color for this data sprite.
DataSprite
 InheritedlineHue : Number
The hue component of the line color in HSV color space.
DataSprite
 InheritedlineSaturation : Number
The saturation component of the line color in HSV color space.
DataSprite
 InheritedlineValue : Number
The value (brightness) component of the line color in HSV color space.
DataSprite
 InheritedlineWidth : Number
The line width for this data sprite.
DataSprite
  nextNode : NodeSprite
[read-only] The next sibling of this node in the tree structure.
NodeSprite
 Inheritedorigin : Point
The origin point for polar coordinates.
DirtySprite
  outDegree : uint
[read-only] The number of outlinks.
NodeSprite
  parentEdge : EdgeSprite
The edge connecting this node to its parent in a tree structure.
NodeSprite
  parentIndex : int
The index of this node in its tree parent's child links list.
NodeSprite
  parentNode : NodeSprite
[read-only] The parent of this node in the tree structure.
NodeSprite
 Inheritedpoints : Array
Optional array of x,y values for specifying arbitrary shapes.
DataSprite
  prevNode : NodeSprite
[read-only] The previous sibling of this node in the tree structure.
NodeSprite
 Inheritedprops : Object
Object for attaching additional properties to this sprite.
DataSprite
  radius : Number
[write-only]
NodeSprite
 Inheritedrenderer : IRenderer
The renderer for drawing this DataSprite.
DataSprite
 Inheritedshape : String
Name of the shape value of this data sprite.
DataSprite
 Inheritedsize : Number
The size value of this data sprite (1 by default).
DataSprite
 Inheritedu : Number
Auxiliary property often used as a shape parameter.
DataSprite
 Inheritedv : Number
Auxiliary property often used as a shape parameter.
DataSprite
 Inheritedw : Number
Auxiliary property often used as a width parameter.
DataSprite
 Inheritedwidth : Number
If dirty, this sprite is re-rendered before returning the width.
DirtySprite
  x : Number
[write-only]
NodeSprite
  y : Number
[write-only]
NodeSprite
Protected Properties
 PropertyDefined by
 Inherited_angle : Number
The angle value of this sprite's position in polar co-ordinates.
DirtySprite
 Inherited_data : Object
Object storing backing data values.
DataSprite
 Inherited_fillColor : uint = 0xffcccccc
The fill color for this data sprite.
DataSprite
 Inherited_fixed : int = 0
Fixed flag to prevent this sprite from being re-positioned.
DataSprite
 Inherited_h : Number = 0
Auxiliary property often used as a height parameter.
DataSprite
 Inherited_lineColor : uint = 0xff000000
The line color for this data sprite.
DataSprite
 Inherited_lineWidth : Number = 0
The line width for this data sprite.
DataSprite
 Inherited_origin : Point
The origin point for polar coordinates.
DirtySprite
 Inherited_points : Array
Optional array of x,y values for specifying arbitrary shapes.
DataSprite
 Inherited_prop : Object
Object for attaching additional properties to this sprite.
DataSprite
 Inherited_radius : Number
The radius value of this sprite's position in polar co-ordinates.
DirtySprite
 Inherited_renderer : IRenderer
The renderer for drawing this DataSprite.
DataSprite
 Inherited_shape : String = "circle"
Code indicating the shape value of this data sprite.
DataSprite
 Inherited_size : Number = 1
The size value of this data sprite (1 by default).
DataSprite
 Inherited_u : Number = 0
Auxiliary property often used as a shape parameter.
DataSprite
 Inherited_v : Number = 0
Auxiliary property often used as a shape parameter.
DataSprite
 Inherited_w : Number = 0
Auxiliary property often used as a width parameter.
DataSprite
Public Methods
 MethodDefined by
  
Adds a child edge to this node.
NodeSprite
  
Adds an inlink edge to this node.
NodeSprite
  
Adds an outlink edge to this node.
NodeSprite
 Inherited
dirty():void
Marks this sprite as "dirty" and in need of re-rendering.
DirtySprite
 Inherited
fix(num:uint = 1):void
Increments the fixed counter.
DataSprite
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
If dirty, this sprite is re-rendered returning the bounds.
DirtySprite
  
Gets the child edge at the specified position
NodeSprite
  
Gets the child node at the specified position
NodeSprite
  
Gets the inlink edge at the specified position
NodeSprite
  
Gets the inlink node at the specified position
NodeSprite
  
Gets the outlink edge at the specified position
NodeSprite
  
Gets the outlink node at the specified position
NodeSprite
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
If dirty, this sprite is re-rendered before returning the rect.
DirtySprite
 Inherited
hitTestObject(obj:DisplayObject):Boolean
If dirty, either sprite is re-rendered before hit-testing.
DirtySprite
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
If dirty, this sprite is re-rendered before hit-testing.
DirtySprite
  
isConnected(n:NodeSprite, opt:uint):Boolean
Indicates if the input node is connected to this node by an edge.
NodeSprite
  
Removes all edges incident on this node.
NodeSprite
  
Removes an edge from the child links list.
NodeSprite
  
removeEdges(type:int):void
Removes all edges of the indicated edge type.
NodeSprite
  
Removes an edge from the inlinks list.
NodeSprite
  
Removes an edge from the outlinks list.
NodeSprite
 Inherited
render():void
Draw this sprite's graphical content.
DataSprite
 Inherited
renderDirty(evt:Event = null):void
[static] Frame render callback that renders all sprites on the dirty list.
DirtySprite
  
setEdgeProperties(vals:Object, opt:uint, trans:* = null, filter:* = null):Transitioner
Sets property values on edge sprites connected to this node.
NodeSprite
  
setNodeProperties(vals:Object, opt:uint, trans:* = null, filter:* = null):Transitioner
Sets property values on node sprites connected to this node.
NodeSprite
  
sortEdgesBy(opt:uint, ... sort):void
Sorts the order of connected edges according to their properties.
NodeSprite
 Inherited
toString():String
DirtySprite
 Inherited
unfix(num:uint = 1):void
Decrements the fixed counter.
DataSprite
  
visitEdges(f:Function, opt:uint, filter:* = null):Boolean
Visits this node's edges, invoking a function on each visited edge.
NodeSprite
  
visitNodes(f:Function, opt:uint, filter:* = null):Boolean
Visits the nodes connected to this node by edges, invoking a function on each visited node.
NodeSprite
  
visitTreeBreadthFirst(f:Function):Boolean
Visits the subtree rooted at this node using a breadth first search, invoking the input function on each visited node.
NodeSprite
  
visitTreeDepthFirst(f:Function, preorder:Boolean = false):Boolean
Visits the subtree rooted at this node using a depth first search, invoking the input function on each visited node.
NodeSprite
Public Constants
 ConstantDefined by
  ALL_LINKS : uint = 15
[static] Flag indicating all links, including graph and tree links.
NodeSprite
  CHILD_LINKS : uint = 4
[static] Flag indicating child links in a tree structure.
NodeSprite
  GRAPH_LINKS : uint = 3
[static] Flag indicating both inlinks and outlinks.
NodeSprite
  IN_LINKS : uint = 1
[static] Flag indicating inlinks, edges that point to this node.
NodeSprite
  OUT_LINKS : uint = 2
[static] Flag indicating outlinks, edges that point away from node.
NodeSprite
  PARENT_LINK : uint = 8
[static] Flag indicating the link to a parent in a tree structure.
NodeSprite
  REVERSE : uint = 16
[static] Flag indicating that a traversal should be performed in reverse.
NodeSprite
  TREE_LINKS : uint = 12
[static] Flag indicating both child and parent links.
NodeSprite
 InheritedZERO : Point
[static] A constant for the point (0,0).
DirtySprite
Property detail
angleproperty
angle:Number  [write-only]

Implementation
    public function set angle(value:Number):void
childDegreeproperty 
childDegree:uint  [read-only]

The number of child links.

Implementation
    public function get childDegree():uint
degreeproperty 
degree:uint  [read-only]

The number of inlinks and outlinks.

Implementation
    public function get degree():uint
depthproperty 
depth:uint  [read-only]

The depth of this node in the tree structure. A value of zero indicates that this is a root node or that there is no tree.

Implementation
    public function get depth():uint
expandedproperty 
expanded:Boolean  [read-write]

Flag indicating if this node is currently expanded. This flag can be used by layout routines to expand/collapse connections.

Implementation
    public function get expanded():Boolean
    public function set expanded(value:Boolean):void
firstChildNodeproperty 
firstChildNode:NodeSprite  [read-only]

The first child of this node in the tree structure.

Implementation
    public function get firstChildNode():NodeSprite
inDegreeproperty 
inDegree:uint  [read-only]

The number of inlinks.

Implementation
    public function get inDegree():uint
lastChildNodeproperty 
lastChildNode:NodeSprite  [read-only]

The last child of this node in the tree structure.

Implementation
    public function get lastChildNode():NodeSprite
nextNodeproperty 
nextNode:NodeSprite  [read-only]

The next sibling of this node in the tree structure.

Implementation
    public function get nextNode():NodeSprite
outDegreeproperty 
outDegree:uint  [read-only]

The number of outlinks.

Implementation
    public function get outDegree():uint
parentEdgeproperty 
parentEdge:EdgeSprite  [read-write]

The edge connecting this node to its parent in a tree structure.

Implementation
    public function get parentEdge():EdgeSprite
    public function set parentEdge(value:EdgeSprite):void
parentIndexproperty 
parentIndex:int  [read-write]

The index of this node in its tree parent's child links list.

Implementation
    public function get parentIndex():int
    public function set parentIndex(value:int):void
parentNodeproperty 
parentNode:NodeSprite  [read-only]

The parent of this node in the tree structure.

Implementation
    public function get parentNode():NodeSprite
prevNodeproperty 
prevNode:NodeSprite  [read-only]

The previous sibling of this node in the tree structure.

Implementation
    public function get prevNode():NodeSprite
radiusproperty 
radius:Number  [write-only]

Implementation
    public function set radius(value:Number):void
xproperty 
x:Number  [write-only]

Implementation
    public function set x(value:Number):void
yproperty 
y:Number  [write-only]

Implementation
    public function set y(value:Number):void
Method detail
addChildEdge()method
public function addChildEdge(e:EdgeSprite):uint

Adds a child edge to this node.

Parameters
e:EdgeSprite — the edge to add to the child links list

Returns
uint — the index of the added edge in the list
addInEdge()method 
public function addInEdge(e:EdgeSprite):uint

Adds an inlink edge to this node.

Parameters
e:EdgeSprite — the edge to add to the inlinks list

Returns
uint — the index of the added edge in the list
addOutEdge()method 
public function addOutEdge(e:EdgeSprite):uint

Adds an outlink edge to this node.

Parameters
e:EdgeSprite — the edge to add to the outlinks list

Returns
uint — the index of the added edge in the list
getChildEdge()method 
public function getChildEdge(i:uint):EdgeSprite

Gets the child edge at the specified position

Parameters
i:uint — the position of the child edge

Returns
EdgeSprite — the child edge
getChildNode()method 
public function getChildNode(i:uint):NodeSprite

Gets the child node at the specified position

Parameters
i:uint — the position of the child node

Returns
NodeSprite — the child node
getInEdge()method 
public function getInEdge(i:uint):EdgeSprite

Gets the inlink edge at the specified position

Parameters
i:uint — the position of the inlink edge

Returns
EdgeSprite — the inlink edge
getInNode()method 
public function getInNode(i:uint):NodeSprite

Gets the inlink node at the specified position

Parameters
i:uint — the position of the inlink node

Returns
NodeSprite — the inlink node
getOutEdge()method 
public function getOutEdge(i:uint):EdgeSprite

Gets the outlink edge at the specified position

Parameters
i:uint — the position of the outlink edge

Returns
EdgeSprite — the outlink edge
getOutNode()method 
public function getOutNode(i:uint):NodeSprite

Gets the outlink node at the specified position

Parameters
i:uint — the position of the outlink node

Returns
NodeSprite — the outlink node
isConnected()method 
public function isConnected(n:NodeSprite, opt:uint):Boolean

Indicates if the input node is connected to this node by an edge.

Parameters
n:NodeSprite — the node to check for connection
 
opt:uint — flag indicating which links to check

Returns
Boolean — true if connected, false otherwise
removeAllEdges()method 
public function removeAllEdges():void

Removes all edges incident on this node. Note that this method does not update the edges themselves or the other nodes.

removeChildEdge()method 
public function removeChildEdge(e:EdgeSprite):void

Removes an edge from the child links list. Note that this method does not update the edge itself or the other node.

Parameters
e:EdgeSprite — the edge to remove
removeEdges()method 
public function removeEdges(type:int):void

Removes all edges of the indicated edge type. Note that this method does not update the edges themselves or the other nodes.

Parameters
type:int — the type of edges to remove. For example, IN_LINKS, OUT_LINKS, TREE_LINKS, etc.
removeInEdge()method 
public function removeInEdge(e:EdgeSprite):void

Removes an edge from the inlinks list. Note that this method does not update the edge itself or the other node.

Parameters
e:EdgeSprite — the edge to remove
removeOutEdge()method 
public function removeOutEdge(e:EdgeSprite):void

Removes an edge from the outlinks list. Note that this method does not update the edge itself or the other node.

Parameters
e:EdgeSprite — the edge to remove
setEdgeProperties()method 
public function setEdgeProperties(vals:Object, opt:uint, trans:* = null, filter:* = null):Transitioner

Sets property values on edge sprites connected to this node.

Parameters
vals:Object — an object containing the properties and values to set.
 
opt:uint — flag indicating which sets of edges should be traversed
 
trans:* (default = null) — a transitioner or time span for updating object values. If the input is a transitioner, it will be used to store the updated values. If the input is a number, a new Transitioner with duration set to the input value will be used. The input is null by default, in which case object values are updated immediately.
 
filter:* (default = null) — an optional Boolean-valued filter function for limiting which items are visited

Returns
Transitioner — the transitioner used to update the values
setNodeProperties()method 
public function setNodeProperties(vals:Object, opt:uint, trans:* = null, filter:* = null):Transitioner

Sets property values on node sprites connected to this node.

Parameters
vals:Object — an object containing the properties and values to set.
 
opt:uint — flag indicating which sets of nodes should be traversed
 
trans:* (default = null) — a transitioner or time span for updating object values. If the input is a transitioner, it will be used to store the updated values. If the input is a number, a new Transitioner with duration set to the input value will be used. The input is null by default, in which case object values are updated immediately.
 
filter:* (default = null) — an optional Boolean-valued filter function for limiting which items are visited

Returns
Transitioner — the transitioner used to update the values
sortEdgesBy()method 
public function sortEdgesBy(opt:uint, ... sort):void

Sorts the order of connected edges according to their properties. Each type of edge (in, out, or child) is sorted separately.

Parameters
opt:uint — flag indicating which set(s) of edges should be sorted
 
... sort — the sort arguments. If a String is provided, the data will be sorted in ascending order according to the data field named by the string. If an Array is provided, the data will be sorted according to the fields in the array. In addition, field names can optionally be followed by a boolean value. If true, the data is sorted in ascending order (the default). If false, the data is sorted in descending order.
visitEdges()method 
public function visitEdges(f:Function, opt:uint, filter:* = null):Boolean

Visits this node's edges, invoking a function on each visited edge.

Parameters
f:Function — the function to invoke on the edges. If the function returns true, the visitation is ended with an early exit.
 
opt:uint — flag indicating which sets of edges should be visited
 
filter:* (default = null)

Returns
Boolean — true if the visitation was interrupted with an early exit
visitNodes()method 
public function visitNodes(f:Function, opt:uint, filter:* = null):Boolean

Visits the nodes connected to this node by edges, invoking a function on each visited node.

Parameters
f:Function — the function to invoke on the nodes. If the function returns true, the visitation is ended with an early exit.
 
opt:uint — flag indicating which sets of edges should be traversed
 
filter:* (default = null)

Returns
Boolean — true if the visitation was interrupted with an early exit
visitTreeBreadthFirst()method 
public function visitTreeBreadthFirst(f:Function):Boolean

Visits the subtree rooted at this node using a breadth first search, invoking the input function on each visited node.

Parameters
f:Function — the function to invoke on the nodes. If the function returns true, the visitation is ended with an early exit.

Returns
Boolean — true if the visitation was interrupted with an early exit
visitTreeDepthFirst()method 
public function visitTreeDepthFirst(f:Function, preorder:Boolean = false):Boolean

Visits the subtree rooted at this node using a depth first search, invoking the input function on each visited node.

Parameters
f:Function — the function to invoke on the nodes. If the function returns true, the visitation is ended with an early exit.
 
preorder:Boolean (default = false) — if true, nodes are visited in a pre-order traversal; if false, they are visited in a post-order traversal

Returns
Boolean — true if the visitation was interrupted with an early exit
Constant detail
ALL_LINKSconstant
public static const ALL_LINKS:uint = 15

Flag indicating all links, including graph and tree links.

CHILD_LINKSconstant 
public static const CHILD_LINKS:uint = 4

Flag indicating child links in a tree structure.

GRAPH_LINKSconstant 
public static const GRAPH_LINKS:uint = 3

Flag indicating both inlinks and outlinks.

IN_LINKSconstant 
public static const IN_LINKS:uint = 1

Flag indicating inlinks, edges that point to this node.

OUT_LINKSconstant 
public static const OUT_LINKS:uint = 2

Flag indicating outlinks, edges that point away from node.

PARENT_LINKconstant 
public static const PARENT_LINK:uint = 8

Flag indicating the link to a parent in a tree structure.

REVERSEconstant 
public static const REVERSE:uint = 16

Flag indicating that a traversal should be performed in reverse.

TREE_LINKSconstant 
public static const TREE_LINKS:uint = 12

Flag indicating both child and parent links.