Packagetwaver
Classpublic class Link
InheritanceLink Inheritance Element Inheritance Data Inheritance flash.events.EventDispatcher
Subclasses LinkSubNetwork, ShapeLink

Link is an element looks like a link on network canvas. Link can be used to represent link or line based data in telecom network. Such as all phycial or logical cables, connections, channels, circuits, routers, paths, rings etc.

Link works with nodes. A link must has a start/from node an end/to node. If null is used for from node or to node, the link will vanished on network canvas because network does not know how and where to display this link.

Each link has it's path to show the trail of this link. It can be any complex path and it will display on network canvas between from node and to node. Each link has from arrow and to arrow you can turn on or off the switch to display or hide the arrows. Each link has the predefined path style like orthogonal, flexile, straight etc.

From node and to node can be the same node. This called looped link. The looped link will be displayed a rectangle or circle line on the node top-right corner, by default. More links with the same from and to node can be bundled by double-clicking on network canvas. The bundled links will hidden, only one link amone them will be displayed as "link agent". You can write rule to specify which link should be selected as the link bundle agent.

Like other elements, link also can be serialized or deserialized by XML.

	 var link:Link = new Link(server1, server2);
	 link.setStyle(Styles.TREE_LABEL, "link1");
	 link.setStyle(Styles.LINK_WIDTH, 10);
	 link.setStyle(Styles.LINK_PATTERN, [12, 4]);
	 link.setStyle(Styles.LINK_CAPS_STYLE, Consts.CAPS_STYLE_NONE);
	 link.setStyle(Styles.LINK_COLOR, 0x00FF00);
	 link.setStyle(Styles.ICONS_NAMES, ["att1","att2","att3","att4"]);
	 link.setStyle(Styles.ICONS_COLORS, [0xFF0000, 0x00FF00, -1, 0xFFFF00]);
	 link.setStyle(Styles.ICONS_YOFFSET, -10);
	 link.setStyle(Styles.TREE_MESSAGE, "connecting server1 and server2");
	 
	 //....
	 
	 box.add(link);
	 

See also

twaver.Node
twaver.ElementBox


Public Properties
 PropertyDefined By
 InheritedalarmState : AlarmState
[read-only] Get alarm state object of this element.
Element
  bundleCount : int
[read-only]
Link
  bundleIndex : int
[read-only]
Link
  bundleLinks : BundleLinks
[read-only] Get link bundle information.
Link
 Inheritedchildren : ICollection
[read-only] Get all children data objects of this data object.
Data
 InheritedchildrenCount : int
[read-only] Get all children total count for this data.
Data
 InheritedclientProperties : ICollection
[read-only] Get a ICollection that contians all client proerty name.
Data
  elementUIClass : Class
[override] [read-only] Get element ui class name.
Link
  fromAgent : Node
[read-only] Get from/start agent.
Link
  fromNode : Node
Get the start/from node of this link.
Link
 InheritedhasChildren : Boolean
[read-only] Check whether this data has children objects.
Data
 Inheritedicon : String
Get icon value for this data.
Data
 Inheritedid : Object
[read-only] Get the ID value of this data.
Data
 InheritedlayerID : Object
Get layer ID of this element.
Element
 Inheritedname : String
Get name of this data.
Data
 Inheritedparent : IData
Get parent data object.
Data
 InheritedstyleProperties : ICollection
[read-only] Get a ICollection that contians all style proerty name.
Element
  toAgent : Node
[read-only] Get end/to agent.
Link
  toNode : Node
Get end/to node of this link.
Link
 InheritedtoolTip : String
Get the tooltip text of this data.
Data
Public Methods
 MethodDefined By
  
Link(id:Object = null, fromNode:Node = null, toNode:Node = null)
Link constructor.
Link
 Inherited
addChild(child:IData, index:int = -1):Boolean
Add a child data object for this data.
Data
 Inherited
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a property change listener to this data to monitoring property change event.
Data
 Inherited
clearChildren():Boolean
Clear all children from this data.
Data
 Inherited
deserializeXML(serializer:XMLSerializer, xml:XML):void
[override] inheritDoc
Element
 Inherited
dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed listeners.
Data
 Inherited
getChildAt(index:int):IData
Get child as specified index location.
Data
 Inherited
getClient(clientProp:String):*
Get specified client property value.
Data
 Inherited
getPropertyValue(property:String):Object
[override] Get an user defined property on this data.
Element
 Inherited
getStyle(styleProp:String, returnDefaultIfNull:Boolean = true):*
Get the specified style property value.
Element
 Inherited
hasOwnProperty(name:String):Boolean
Whether this data has specified property.
Data
 Inherited
Check whether this element has been adjusted to bottom.
Element
  
isBundleAgent():Boolean
Link
 Inherited
isDescendantOf(data:IData):Boolean
Check whether this data is a descendant of the specified data object.
Data
  
isLooped():Boolean
Chech whether this link is looped.
Link
 Inherited
isParentOf(data:IData):Boolean
Check whether this data is the parent of specified data.
Data
 Inherited
isRelatedTo(data:IData):Boolean
Check whether this data has descendant relationship with the specified data.
Data
 Inherited
removeChild(child:IData):Boolean
Remove the specified child object.
Data
 Inherited
removePropertyChangeListener(listener:Function):void
Remove the specified property change listener.
Data
  
Link
  
Link
  
serializeXML(serializer:XMLSerializer, newInstance:IData):void
[override]
Link
 Inherited
setClient(clientProp:String, newValue:*):IClient
Set client property for this data.
Data
 Inherited
setPropertyValue(property:String, value:Object):void
[override] Set an user defined property on this data.
Element
 Inherited
setStyle(styleProp:String, newValue:*):IStyle
Set a style for this element.
Element
 Inherited
toChildren(matchFunction:Function = null):ICollection
Iterate children collection by given callback function.
Data
 Inherited
toString():String
[override]
Data
Protected Methods
 MethodDefined By
 Inherited
deserializeClient(serializer:XMLSerializer, clientXML:XML, clientProp:String):void
Deserialize client property from given XML data.
Data
 Inherited
deserializeProperty(serializer:XMLSerializer, propertyXML:XML, property:String):void
[override] inheritDoc
Element
 Inherited
deserializeStyle(serializer:XMLSerializer, styleXML:XML, styleProp:String):void
Deserialize style from given XML data.
Element
 Inherited
onChildAdded(child:IData, index:int):void
Called back when a child is added.
Data
 Inherited
onChildRemoved(child:IData, index:int):void
Called back when a child is removed.
Data
 Inherited
onChildrenCleared(children:Array):void
Called back when all children are cleared from this data.
Data
 Inherited
onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed.
Data
 Inherited
onParentChanged(oldParent:IData, newParent:IData):void
Called back when data parent changed.
Data
 Inherited
onPropertyChanged(property:String, oldValue:Object, newValue:Object):void
Called back when a property of this data is changed.
Data
  
onStyleChanged(styleProp:String, oldValue:*, newValue:*):void
[override]
Link
 Inherited
serializeClient(serializer:XMLSerializer, clientPrope:String, newInstance:IData):void
Serialize given client property into the specified XML serializer.
Data
 Inherited
serializeProperty(serializer:XMLSerializer, property:String, newInstance:IData):void
Serialize given property into the specified XML serializer.
Data
 Inherited
serializeStyle(serializer:XMLSerializer, stylePrope:String, newInstance:IData):void
Serialize specified property into XML.
Element
Property Detail
bundleCountproperty
bundleCount:int  [read-only]


Implementation
    public function get bundleCount():int
bundleIndexproperty 
bundleIndex:int  [read-only]


Implementation
    public function get bundleIndex():int
bundleLinksproperty 
bundleLinks:BundleLinks  [read-only]

Get link bundle information. The returned class contains all bundle information for this link, if has.


Implementation
    public function get bundleLinks():BundleLinks
elementUIClassproperty 
elementUIClass:Class  [read-only] [override]

Get element ui class name. UI class is used to paint/draw element on network canvas. TWaver Flex will create UI object for the element instance by this returned class name.


Implementation
    public function get elementUIClass():Class
fromAgentproperty 
fromAgent:Node  [read-only]

Get from/start agent. Link will connect from the start agent node to the end agent node when it is bundled.


Implementation
    public function get fromAgent():Node
fromNodeproperty 
fromNode:Node

Get the start/from node of this link.


Implementation
    public function get fromNode():Node
    public function set fromNode(value:Node):void
toAgentproperty 
toAgent:Node  [read-only]

Get end/to agent. Link will connect from the start agent node to the end agent node when it is bundled.


Implementation
    public function get toAgent():Node
toNodeproperty 
toNode:Node

Get end/to node of this link.


Implementation
    public function get toNode():Node
    public function set toNode(value:Node):void
Constructor Detail
Link()Constructor
public function Link(id:Object = null, fromNode:Node = null, toNode:Node = null)

Link constructor.

Parameters
id:Object (default = null) — the link ID.
 
fromNode:Node (default = null) — link start/from node
 
toNode:Node (default = null) — link end/to node
Method Detail
isBundleAgent()method
public function isBundleAgent():Boolean

Returns
Boolean
isLooped()method 
public function isLooped():Boolean

Chech whether this link is looped. Looped link is a link which from/start node and to/end node are the same node instance.

Returns
Boolean — true if this link is looped, false otherwise.
onStyleChanged()method 
override protected function onStyleChanged(styleProp:String, oldValue:*, newValue:*):void

Parameters

styleProp:String
 
oldValue:*
 
newValue:*

resetBundleLinks()method 
public function resetBundleLinks():void

reverseBundleExpanded()method 
public function reverseBundleExpanded():Boolean

Returns
Boolean
serializeXML()method 
override public function serializeXML(serializer:XMLSerializer, newInstance:IData):void

Parameters

serializer:XMLSerializer
 
newInstance:IData