Packagetwaver.network.interaction
Classpublic class CreateLinkInteractionHandler
InheritanceCreateLinkInteractionHandler Inheritance BasicInteractionHandler Inheritance Object
Subclasses CreateOrthogonalLinkInteractionHandler, CreateShapeLinkInteractionHandler

This interaction used to create link on network canvas by dragging mouse from the "from node" to "to node". Install this handler on network to get the ability to create link on canvas.

Here is an example how to install interaction handlers on network canvas

	 network.interactionHandlers = new Collection([
	 	new SelectInteractionHandler(network),
	 	new EditInteractionHandler(network),
	 	new MoveInteractionHandler(network),
	 	new DefaultInteractionHandler(network),
	 	new MapFilterInteractionHandler(network),
	 ]);
	 

See also

twaver.Link


Protected Properties
 PropertyDefined By
  currentNode : Node = null
CreateLinkInteractionHandler
  currentPoint : Point = null
CreateLinkInteractionHandler
  fromNode : Node = null
CreateLinkInteractionHandler
  _linkClass : Class = null
CreateLinkInteractionHandler
  linkClass : Class
[read-only] Get the link class type will be created
CreateLinkInteractionHandler
  mark : UIComponent = null
CreateLinkInteractionHandler
 Inheritednetwork : Network
[read-only] Get network component of this interaction.
BasicInteractionHandler
  toNode : Node = null
CreateLinkInteractionHandler
Public Methods
 MethodDefined By
  
CreateLinkInteractionHandler(network:Network, linkClass:Class = null, callback:Function = null)
Interaction link constructor.
CreateLinkInteractionHandler
  
[override] Install listeners on this interaction.
CreateLinkInteractionHandler
  
[override] Uninstall listeners on this interaction.
CreateLinkInteractionHandler
Protected Methods
 MethodDefined By
  
clear():void
Clear all mouse drag-and-drop information and the trace mark painted on network canvas.
CreateLinkInteractionHandler
  
Create link after "from node" and "to node" are both selected by mouse.
CreateLinkInteractionHandler
 Inherited
dispatchEvent(kind:String, e:MouseEvent, element:IElement = null, resizeDirection:String = null, pointIndex:int = -1):void
Dispatch event to listeners.
BasicInteractionHandler
  
drawPoints(g:Graphics, formRect:Rectangle):void
Draw line on graphics.
CreateLinkInteractionHandler
  
getFromNode(e:MouseEvent):Node
Get "from node" selected by mouse during creating link on canvas.
CreateLinkInteractionHandler
  
getToNode(e:MouseEvent):Node
Get "to node" selected by mouse during creating link on canvas.
CreateLinkInteractionHandler
  
handleMouseDown(e:MouseEvent):void
This method handle the mouse down event.
CreateLinkInteractionHandler
  
handleMouseMove(e:MouseEvent):void
This method handle mouse move event.
CreateLinkInteractionHandler
  
updateMark():void
This method draw and update the trace mark on network canvas to show the link trace between from and mouse cursor location when moving mouse cursor around on network canvas to pick "to node".
CreateLinkInteractionHandler
Property Detail
_linkClassproperty
protected var _linkClass:Class = null

currentNodeproperty 
protected var currentNode:Node = null

currentPointproperty 
protected var currentPoint:Point = null

fromNodeproperty 
protected var fromNode:Node = null

linkClassproperty 
linkClass:Class  [read-only]

Get the link class type will be created


Implementation
    protected function get linkClass():Class
markproperty 
protected var mark:UIComponent = null

toNodeproperty 
protected var toNode:Node = null

Constructor Detail
CreateLinkInteractionHandler()Constructor
public function CreateLinkInteractionHandler(network:Network, linkClass:Class = null, callback:Function = null)

Interaction link constructor. This interaction will create specified link class type.

Parameters
network:Network — the network this interaction work for.
 
linkClass:Class (default = null) — the link class type this interaction will create.
 
callback:Function (default = null) — a function will be called after link has been created.
Method Detail
clear()method
protected function clear():void

Clear all mouse drag-and-drop information and the trace mark painted on network canvas.

createLink()method 
protected function createLink():Link

Create link after "from node" and "to node" are both selected by mouse. A link will be created between this from node and to node.

Returns
Link — the created link instance.
drawPoints()method 
protected function drawPoints(g:Graphics, formRect:Rectangle):void

Draw line on graphics.

Parameters

g:Graphics — the graphics
 
formRect:Rectangle — point location.

getFromNode()method 
protected function getFromNode(e:MouseEvent):Node

Get "from node" selected by mouse during creating link on canvas.

Parameters

e:MouseEvent — combined mouse event

Returns
Node — the "from node" selected by mouse during creating link on canvas.
getToNode()method 
protected function getToNode(e:MouseEvent):Node

Get "to node" selected by mouse during creating link on canvas.

Parameters

e:MouseEvent — combined mouse event

Returns
Node — the "to node" selected by mouse during creating link on canvas.
handleMouseDown()method 
protected function handleMouseDown(e:MouseEvent):void

This method handle the mouse down event.

Parameters

e:MouseEvent — mouse event to be handled.

handleMouseMove()method 
protected function handleMouseMove(e:MouseEvent):void

This method handle mouse move event.

Parameters

e:MouseEvent — mouse event to be handled.

installListeners()method 
override public function installListeners():void

Install listeners on this interaction.

uninstallListeners()method 
override public function uninstallListeners():void

Uninstall listeners on this interaction.

updateMark()method 
protected function updateMark():void

This method draw and update the trace mark on network canvas to show the link trace between from and mouse cursor location when moving mouse cursor around on network canvas to pick "to node".