Packagetwaver.network.layout
Classpublic class SpringLayouter
InheritanceSpringLayouter Inheritance Object

This class is a spring layouter. This layout is initialized with a network, assigns X/Y locations to each TWaver Flex node. When called relax(), the SpringLayout moves nodes forward one step.

This code shows how to use Spring Layouter:

 
	 var springLaouter:SpringLayouter = new SpringLayouter(network);
	 springLaouter.start();
	 



Public Properties
 PropertyDefined By
  linkRepulsionFactor : Number
Get link repulsion factor of this spring layout.
SpringLayouter
  network : Network
[read-only] Get network of this layout.
SpringLayouter
  nodeRepulsionFactor : Number
Get node repulsion factor of this spring layout.
SpringLayouter
  running : Boolean
[read-only] Check whether this spring layout is running now.
SpringLayouter
  stepCount : int
Get step count of this spring layout.
SpringLayouter
  timerDelay : Number
Get internal timer delay value.
SpringLayouter
Public Methods
 MethodDefined By
  
Constructor.
SpringLayouter
  
damp():void
Call this to damp graph
SpringLayouter
  
getRepulsion(node:Node):Number
Get node repulsion.
SpringLayouter
  
isMovable(node:Node):Boolean
Check whether specified node is movable in this layout.
SpringLayouter
  
isVisible(element:IElement):Boolean
Check whether specified element is visible.
SpringLayouter
  
relax():void
Call this will move all nodes one step forward.
SpringLayouter
  
relaxLink(link:SLink):void
Call this to relax specified link.
SpringLayouter
  
relaxNodePair(n1:SNode, n2:SNode):void
Relax a node pair.
SpringLayouter
  
start():void
Call this to start spring layout.
SpringLayouter
  
stop():void
Call this to stop spring layout.
SpringLayouter
Property Detail
linkRepulsionFactorproperty
linkRepulsionFactor:Number

Get link repulsion factor of this spring layout. Default value is 0.6


Implementation
    public function get linkRepulsionFactor():Number
    public function set linkRepulsionFactor(value:Number):void
networkproperty 
network:Network  [read-only]

Get network of this layout.


Implementation
    public function get network():Network
nodeRepulsionFactorproperty 
nodeRepulsionFactor:Number

Get node repulsion factor of this spring layout. Default value is 0.6


Implementation
    public function get nodeRepulsionFactor():Number
    public function set nodeRepulsionFactor(value:Number):void
runningproperty 
running:Boolean  [read-only]

Check whether this spring layout is running now.


Implementation
    public function get running():Boolean
stepCountproperty 
stepCount:int

Get step count of this spring layout. Default value is 10.


Implementation
    public function get stepCount():int
    public function set stepCount(value:int):void
timerDelayproperty 
timerDelay:Number

Get internal timer delay value. Default value is 50.


Implementation
    public function get timerDelay():Number
    public function set timerDelay(value:Number):void
Constructor Detail
SpringLayouter()Constructor
public function SpringLayouter(network:Network)

Constructor. Create spring layout for this network.

Parameters
network:Network — the network to be layouted.
Method Detail
damp()method
public function damp():void

Call this to damp graph

getRepulsion()method 
public function getRepulsion(node:Node):Number

Get node repulsion.

Parameters

node:Node — a node to be checked.

Returns
Number — repulsion value of this node.
isMovable()method 
public function isMovable(node:Node):Boolean

Check whether specified node is movable in this layout.

Parameters

node:Node — a node to be checked.

Returns
Boolean — true if movable, false otherwise.
isVisible()method 
public function isVisible(element:IElement):Boolean

Check whether specified element is visible.

Parameters

element:IElement — element to be checke

Returns
Boolean — true if visible, fales otherwise.
relax()method 
public function relax():void

Call this will move all nodes one step forward.

relaxLink()method 
public function relaxLink(link:SLink):void

Call this to relax specified link.

Parameters

link:SLink — the link to be relaxed.

relaxNodePair()method 
public function relaxNodePair(n1:SNode, n2:SNode):void

Relax a node pair.

Parameters

n1:SNode — one node of the pair
 
n2:SNode — second node of the pair

start()method 
public function start():void

Call this to start spring layout.

stop()method 
public function stop():void

Call this to stop spring layout.