Package | twaver |
Class | public class Link |
Inheritance | Link ![]() ![]() ![]() |
Subclasses | LinkSubNetwork, ShapeLink |
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
Property | Defined By | ||
---|---|---|---|
![]() | alarmState : 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 | ||
![]() | children : ICollection [read-only]
Get all children data objects of this data object. | Data | |
![]() | childrenCount : int [read-only]
Get all children total count for this data. | Data | |
![]() | clientProperties : 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 | ||
![]() | hasChildren : Boolean [read-only]
Check whether this data has children objects. | Data | |
![]() | icon : String
Get icon value for this data. | Data | |
![]() | id : Object [read-only]
Get the ID value of this data. | Data | |
![]() | layerID : Object
Get layer ID of this element. | Element | |
![]() | name : String
Get name of this data. | Data | |
![]() | parent : IData
Get parent data object. | Data | |
![]() | styleProperties : 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 | ||
![]() | toolTip : String
Get the tooltip text of this data. | Data |
Method | Defined By | ||
---|---|---|---|
Link constructor. | Link | ||
![]() |
Add a child data object for this data. | Data | |
![]() | addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a property change listener to this data to monitoring property
change event. | Data | |
![]() | clearChildren():Boolean
Clear all children from this data. | Data | |
![]() | deserializeXML(serializer:XMLSerializer, xml:XML):void [override]
inheritDoc
| Element | |
![]() | dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed listeners. | Data | |
![]() | getChildAt(index:int):IData
Get child as specified index location. | Data | |
![]() | getClient(clientProp:String):*
Get specified client property value. | Data | |
![]() | getPropertyValue(property:String):Object [override]
Get an user defined property on this data. | Element | |
![]() | getStyle(styleProp:String, returnDefaultIfNull:Boolean = true):*
Get the specified style property value. | Element | |
![]() | hasOwnProperty(name:String):Boolean
Whether this data has specified property. | Data | |
![]() | isAdjustedToBottom():Boolean
Check whether this element has been adjusted to bottom. | Element | |
isBundleAgent():Boolean | Link | ||
![]() | 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 | ||
![]() | isParentOf(data:IData):Boolean
Check whether this data is the parent of specified data. | Data | |
![]() | isRelatedTo(data:IData):Boolean
Check whether this data has descendant relationship with the specified data. | Data | |
![]() | removeChild(child:IData):Boolean
Remove the specified child object. | Data | |
![]() | removePropertyChangeListener(listener:Function):void
Remove the specified property change listener. | Data | |
resetBundleLinks():void | Link | ||
reverseBundleExpanded():Boolean | Link | ||
[override] | Link | ||
![]() |
Set client property for this data. | Data | |
![]() | setPropertyValue(property:String, value:Object):void [override]
Set an user defined property on this data. | Element | |
![]() |
Set a style for this element. | Element | |
![]() | toChildren(matchFunction:Function = null):ICollection
Iterate children collection by given callback function. | Data | |
![]() | toString():String [override]
| Data |
Method | Defined By | ||
---|---|---|---|
![]() | deserializeClient(serializer:XMLSerializer, clientXML:XML, clientProp:String):void
Deserialize client property from given XML data. | Data | |
![]() | deserializeProperty(serializer:XMLSerializer, propertyXML:XML, property:String):void [override]
inheritDoc
| Element | |
![]() | deserializeStyle(serializer:XMLSerializer, styleXML:XML, styleProp:String):void
Deserialize style from given XML data. | Element | |
![]() | onChildAdded(child:IData, index:int):void
Called back when a child is added. | Data | |
![]() | onChildRemoved(child:IData, index:int):void
Called back when a child is removed. | Data | |
![]() | onChildrenCleared(children:Array):void
Called back when all children are cleared from this data. | Data | |
![]() | onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed. | Data | |
![]() |
Called back when data parent changed. | Data | |
![]() | 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 | ||
![]() |
Serialize given client property into the specified XML serializer. | Data | |
![]() |
Serialize given property into the specified
XML serializer. | Data | |
![]() |
Serialize specified property into XML. | Element |
bundleCount | property |
bundleCount:int
[read-only] public function get bundleCount():int
bundleIndex | property |
bundleIndex:int
[read-only] public function get bundleIndex():int
bundleLinks | property |
bundleLinks:BundleLinks
[read-only] Get link bundle information. The returned class contains all bundle information for this link, if has.
public function get bundleLinks():BundleLinks
elementUIClass | property |
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.
public function get elementUIClass():Class
fromAgent | property |
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.
public function get fromAgent():Node
fromNode | property |
fromNode:Node
Get the start/from node of this link.
public function get fromNode():Node
public function set fromNode(value:Node):void
toAgent | property |
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.
public function get toAgent():Node
toNode | property |
toNode:Node
Get end/to node of this link.
public function get toNode():Node
public function set toNode(value:Node):void
Link | () | Constructor |
public function Link(id:Object = null, fromNode:Node = null, toNode:Node = null)
Link constructor.
Parametersid:Object (default = null ) — the link ID.
| |
fromNode:Node (default = null ) — link start/from node
| |
toNode:Node (default = null ) — link end/to node
|
isBundleAgent | () | method |
public function isBundleAgent():Boolean
ReturnsBoolean |
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.
ReturnsBoolean — 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
ReturnsBoolean |
serializeXML | () | method |
override public function serializeXML(serializer:XMLSerializer, newInstance:IData):void
Parameters
serializer:XMLSerializer | |
newInstance:IData |