Packagede.tilman.flexgraph
Classpublic class Graph
InheritanceGraph Inheritance mx.containers.Canvas
Implementsmx.managers.IFocusManagerComponent

A directed graph.



Public Properties
 PropertyDefined by
  automaticLayout : Boolean = false
Graph
  edgeContraction : int
[write-only] Set a new value for the contraction of the edges
Graph
  edgeFactory : IEdgeFactory
Graph
  edges : EdgeList
Graph
  engine : PhysicsEngine
Graph
  nodeFactory : INodeFactory
Graph
  nodeRepulsion : int
[write-only] Sets a new value for the repulsion of the nodes.
Graph
  nodes : Object
Graph
  scaling : Number
[write-only] Sets the scaling for all elements of the graph.
Graph
Public Methods
 MethodDefined by
  
Graph
  
getNode(nid:String):Node
Returns the node for the specified ID or null if no node with that ID is part of the graph.
Graph
  
insertNode(nid:String, x:Number, y:Number = 0):Node
Creates a node and inserts it into the graph.
Graph
  
isLinked(fromNode:Node, toNode:Node):Boolean
Graph
  
link(fromNode:Node, toNode:Node, caption:String = null):Edge
Creates an edge that links from one node in the graph to another.
Graph
  
remove(node:Node):void
Removes a node from the graph.
Graph
  
Removes all nodes from the graph.
Graph
  
unlink(fromNode:Node, toNode:Node):Boolean
Removes an edge from the graph.
Graph
Protected Methods
 MethodDefined by
  
arrowMouseUpHandler(event:MouseEvent, label:Object = null):void
Called if the mouse button is released on the arrowhead of an edge.
Graph
  
edgeMouseUpHandler(event:MouseEvent):void
Called if the mouse button is released.
Graph
  
keyDownHandler(event:KeyboardEvent):void
Graph
  
mouseDownHandler(event:MouseEvent):void
Called if the user clicks on the background of the graph area (the drawingPane).
Graph
  
mouseMoveHandler(event:MouseEvent):void
Called if the user moves the mouse with the mouse button held down.
Graph
  
mouseUpHandler(event:MouseEvent):void
Called if the user releases the mouse button.
Graph
  
nodeMouseDownHandler(event:MouseEvent):void
Called if the user clicks on a node.
Graph
  
nodeMouseUpHandler(event:MouseEvent):void
Called if the mouse button is released on a node.
Graph
  
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Override.
Graph
Property detail
automaticLayoutproperty
public var automaticLayout:Boolean = false

This property can be used as the source for data binding.

edgeContractionproperty 
edgeContraction:int  [write-only]

Set a new value for the contraction of the edges

Implementation
    public function set edgeContraction(value:int):void
edgeFactoryproperty 
public var edgeFactory:IEdgeFactory
edgesproperty 
public var edges:EdgeList
engineproperty 
public var engine:PhysicsEngine
nodeFactoryproperty 
public var nodeFactory:INodeFactory
nodeRepulsionproperty 
nodeRepulsion:int  [write-only]

Sets a new value for the repulsion of the nodes.

Implementation
    public function set nodeRepulsion(value:int):void
nodesproperty 
public var nodes:Object
scalingproperty 
scaling:Number  [write-only]

Sets the scaling for all elements of the graph. Note: Use this function carefully, it can be very expensive in terms of CPU usage.

Implementation
    public function set scaling(value:Number):void
Constructor detail
Graph()constructor
public function Graph()
Method detail
arrowMouseUpHandler()method
protected function arrowMouseUpHandler(event:MouseEvent, label:Object = null):void

Called if the mouse button is released on the arrowhead of an edge.

Parameters
event:MouseEvent — the MouseEvent
 
label:Object (default = null)
edgeMouseUpHandler()method 
protected function edgeMouseUpHandler(event:MouseEvent):void

Called if the mouse button is released.

Parameters
event:MouseEvent — the MouseEvent
getNode()method 
public function getNode(nid:String):Node

Returns the node for the specified ID or null if no node with that ID is part of the graph.

Parameters
nid:String — the ID of the node to return

Returns
Node — the node or null if no node with the specified ID is part of the graph
insertNode()method 
public function insertNode(nid:String, x:Number, y:Number = 0):Node

Creates a node and inserts it into the graph.

Parameters
nid:String — the id of the node to insert
 
x:Number
 
y:Number (default = 0)

Returns
Node
isLinked()method 
public function isLinked(fromNode:Node, toNode:Node):Boolean

Parameters
fromNode:Node — the starting point
 
toNode:Node — the ending point

Returns
Boolean — true, if the graph contains a link from fromNode to toNode
keyDownHandler()method 
protected override function keyDownHandler(event:KeyboardEvent):voidParameters
event:KeyboardEvent
link()method 
public function link(fromNode:Node, toNode:Node, caption:String = null):Edge

Creates an edge that links from one node in the graph to another. If the nodes are already linked, the function has no effect.

Parameters
fromNode:Node — the starting point of the edge
 
toNode:Node — the ending point of the edge
 
caption:String (default = null) — the caption for the edge

Returns
Edge — the edge that has been added or null
mouseDownHandler()method 
protected function mouseDownHandler(event:MouseEvent):void

Called if the user clicks on the background of the graph area (the drawingPane).

Parameters
event:MouseEvent — the MouseEvent
mouseMoveHandler()method 
protected function mouseMoveHandler(event:MouseEvent):void

Called if the user moves the mouse with the mouse button held down.

Parameters
event:MouseEvent — the MouseEvent
mouseUpHandler()method 
protected function mouseUpHandler(event:MouseEvent):void

Called if the user releases the mouse button.

Parameters
event:MouseEvent — the MouseEvent
nodeMouseDownHandler()method 
protected function nodeMouseDownHandler(event:MouseEvent):void

Called if the user clicks on a node.

Parameters
event:MouseEvent — the MouseEvent
nodeMouseUpHandler()method 
protected function nodeMouseUpHandler(event:MouseEvent):void

Called if the mouse button is released on a node.

Parameters
event:MouseEvent — the MouseEvent
remove()method 
public function remove(node:Node):void

Removes a node from the graph.

Parameters
node:Node — the node to be removed
removeAllNodes()method 
public function removeAllNodes():void

Removes all nodes from the graph.

unlink()method 
public function unlink(fromNode:Node, toNode:Node):Boolean

Removes an edge from the graph.

Parameters
fromNode:Node — the starting point of the edge
 
toNode:Node — the ending point of the edge

Returns
Boolean — true, if the edge has been removed, false if the given nodes are not connected
updateDisplayList()method 
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

Override. Redraws the edges of the graph after the UI has been updated.

Parameters
unscaledWidth:Number
 
unscaledHeight:Number