Packagecom.yworks.graph.input
Classpublic class ReparentNodeHandler
InheritanceReparentNodeHandler Inheritance Object
Implements IReparentNodeHandler

Simple default implementation of IReparentNodeHandler that treats control key presses as reparent gestures and allows for reparenting all nodes.



Public Properties
 PropertyDefined By
  reparentRecognizer : Function
Gets or sets the event recognizer function that will be queried to determine whether the gesture is a reparent gesture.
ReparentNodeHandler
Public Methods
 MethodDefined By
  
Creates a new instance.
ReparentNodeHandler
  
canReparent(context:IInputModeContext, node:INode):Boolean
Determines whether the user may detach the given node from its current parent in order to reparent it.
ReparentNodeHandler
  
Determines whether the current gesture that can be determined through the context is a reparent gesture.
ReparentNodeHandler
  
isValidParent(context:IInputModeContext, node:INode, newParent:INode):Boolean
Determines whether the provided node may be reparented to a new parent.
ReparentNodeHandler
  
reparent(context:IInputModeContext, node:INode, newParent:INode):void
Performs the actual reparenting after the reparent gesture has been finalized.
ReparentNodeHandler
Property Detail
reparentRecognizerproperty
reparentRecognizer:Function

Gets or sets the event recognizer function that will be queried to determine whether the gesture is a reparent gesture.

An event recognizer function takes an Event as the only parameter and returns a Boolean that indicates whether the given event was recognized.

The default value is EventRecognizers.SHIFT_PRESSED.


Implementation
    public function get reparentRecognizer():Function
    public function set reparentRecognizer(value:Function):void

See also

Constructor Detail
ReparentNodeHandler()Constructor
public function ReparentNodeHandler()

Creates a new instance.

Method Detail
canReparent()method
public function canReparent(context:IInputModeContext, node:INode):Boolean

Determines whether the user may detach the given node from its current parent in order to reparent it.

Parameters

context:IInputModeContext — The context that provides information about the user input.
 
node:INode — The node that is about to be detached from its current parent.

Returns
Boolean — Whether the node may be detached and reparented.
isReparentGesture()method 
public function isReparentGesture(context:IInputModeContext, node:INode):Boolean

Determines whether the current gesture that can be determined through the context is a reparent gesture.

Parameters

context:IInputModeContext — The context that provides information about the user input.
 
node:INode — The node that will possibly be reparented.

Returns
Boolean — Whether this is a reparenting gesture.
isValidParent()method 
public function isValidParent(context:IInputModeContext, node:INode, newParent:INode):Boolean

Determines whether the provided node may be reparented to a new parent.

Parameters

context:IInputModeContext — The context that provides information about the user input.
 
node:INode — The node that will be reparented.
 
newParent:INode — The potential new parent.

Returns
Boolean — Whether newParent is a valid new parent for node.
reparent()method 
public function reparent(context:IInputModeContext, node:INode, newParent:INode):void

Performs the actual reparenting after the reparent gesture has been finalized.

Parameters

context:IInputModeContext — The context that provides information about the user input.
 
node:INode — The node that will be reparented.
 
newParent:INode — The potential new parent.