Packagetwaver.network.layout
Classpublic class AutoLayouter
InheritanceAutoLayouter Inheritance Object

This class wrapps information to layout network topology by TWaver Flex predefined auto-layout algorithms. This layouter work with a network component. Give the algorithm and options then call method doLayout to perform auto-layout.

An example to use auto layouter:

	 var box:ElementBox = new ElementBox();
	 var network:Network = new Network(box);
	 var autoLayouter:AutoLayouter = new AutoLayouter(network);
	 autoLayouter.animate = true;
	 autoLayouter.doLayout(Consts.LAYOUT_ROUND);
	 



Public Properties
 PropertyDefined By
  accountAttachments : Boolean
Whether consider element attachments when perform auto-layout.
AutoLayouter
  animate : Boolean
Whether use animated effect when moving elements to the layouted locations.
AutoLayouter
  elements : ICollection
[read-only] Get all layout elements in this layouter with a collection.
AutoLayouter
  expandGroup : Boolean
Whether all group elements will be expanded before the auto-layout calculation.
AutoLayouter
  explicitXOffset : Number
Get explicit x offset value of this auto-layouter.
AutoLayouter
  explicitYOffset : Number
Get explicit y offset value of this auto-layouter.
AutoLayouter
  network : Network
[read-only] Get the connected network component of auto-layouter.
AutoLayouter
  repulsion : Number
Get the repulsion factor of auto-layout algorithm.
AutoLayouter
  type : String
[read-only] Layout algorithm type name.
AutoLayouter
  _xOffset : Number = 0
AutoLayouter
  _yOffset : Number = 0
AutoLayouter
Public Methods
 MethodDefined By
  
Constructor.
AutoLayouter
  
createMatrix(type:String):Matrix
[static]
AutoLayouter
  
doLayout(type:String, finishFunction:Function = null):Boolean
Perform layout.
AutoLayouter
  
Get specified node dimension in this layouter.
AutoLayouter
  
getLayoutResult(type:String):Dictionary
Get auto-layout results with a dictionary.
AutoLayouter
  
getOffset(node:*):Size
AutoLayouter
Property Detail
_xOffsetproperty
public var _xOffset:Number = 0

_yOffsetproperty 
public var _yOffset:Number = 0

accountAttachmentsproperty 
accountAttachments:Boolean

Whether consider element attachments when perform auto-layout. If true, the attachments area will considered as a part of that element body. False otherwise.


Implementation
    public function get accountAttachments():Boolean
    public function set accountAttachments(value:Boolean):void
animateproperty 
animate:Boolean

Whether use animated effect when moving elements to the layouted locations.


Implementation
    public function get animate():Boolean
    public function set animate(value:Boolean):void
elementsproperty 
elements:ICollection  [read-only]

Get all layout elements in this layouter with a collection.


Implementation
    public function get elements():ICollection
expandGroupproperty 
expandGroup:Boolean

Whether all group elements will be expanded before the auto-layout calculation. Default value is false.


Implementation
    public function get expandGroup():Boolean
    public function set expandGroup(value:Boolean):void
explicitXOffsetproperty 
explicitXOffset:Number

Get explicit x offset value of this auto-layouter.


Implementation
    public function get explicitXOffset():Number
    public function set explicitXOffset(value:Number):void
explicitYOffsetproperty 
explicitYOffset:Number

Get explicit y offset value of this auto-layouter.


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

Get the connected network component of auto-layouter.


Implementation
    public function get network():Network
repulsionproperty 
repulsion:Number

Get the repulsion factor of auto-layout algorithm. Default value is 1.


Implementation
    public function get repulsion():Number
    public function set repulsion(value:Number):void
typeproperty 
type:String  [read-only]

Layout algorithm type name. The value can be:


Implementation
    public function get type():String
Constructor Detail
AutoLayouter()Constructor
public function AutoLayouter(network:Network)

Constructor. Create a network graph auto-layouter for specified network.

Parameters
network:Network — the network component auto-layouter layout for.
Method Detail
createMatrix()method
public static function createMatrix(type:String):Matrix

Parameters

type:String

Returns
Matrix
doLayout()method 
public function doLayout(type:String, finishFunction:Function = null):Boolean

Perform layout.

Parameters

type:String — layout algorithm name. It can be:
  • Consts.LAYOUT_ROUND
  • Consts.LAYOUT_SYMMETRY
  • Consts.LAYOUT_TOPBOTTOM
  • Consts.LAYOUT_BOTTOMTOP
  • Consts.LAYOUT_LEFTRIGHT
  • Consts.LAYOUT_RIGHTLEFT
 
finishFunction:Function (default = null) — this function will be called when layout finished.

Returns
Boolean — true if success, false otherwise.
getDimension()method 
public function getDimension(node:Node):Size

Get specified node dimension in this layouter.

Parameters

node:Node — a node element.

Returns
Size — the dimension of this node.
getLayoutResult()method 
public function getLayoutResult(type:String):Dictionary

Get auto-layout results with a dictionary. The dictionary contains layouted location of each node.

Parameters

type:String — layout algorithm. It can be:
  • Consts.LAYOUT_ROUND
  • Consts.LAYOUT_SYMMETRY
  • Consts.LAYOUT_TOPBOTTOM
  • Consts.LAYOUT_BOTTOMTOP
  • Consts.LAYOUT_LEFTRIGHT
  • Consts.LAYOUT_RIGHTLEFT

Returns
Dictionary — a dictionary contains layouted location of each node.
getOffset()method 
public function getOffset(node:*):Size

Parameters

node:*

Returns
Size