| Package | com.yworks.graph.input |
| Class | public class NodeDropInputMode |
| Inheritance | NodeDropInputMode DropInputMode AbstractConcurrentInputMode AbstractInputMode flash.events.EventDispatcher |
DropInputMode specialized to drag 'n' drop INodes.
A dragged INode is visualized during the drag operation.
The input mode does also support snapping of the dragged INode via the SnapContext.
The DropInputMode does not work properly together with the native
drag manager in AIR applications. If problems occur the native drag manager
can be disabled by setting useNativeDragManager to false
in the WindowedApplication (since Flex 4).
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | canvas : CanvasComponent [read-only]
The canvas instance this mode is currently installed in or null
| AbstractInputMode | |
![]() | controller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance. | AbstractConcurrentInputMode | |
| dragNodeCreator : Function
Gets or sets the callback for drag node creation with has the signature:
function (context:IInputModeContext, dragData:Object):INode with
context The context for which the node should be created.
dragData The node which should be dragged and is passed to the nodeDropCreator later.
Can be set to a different value to implement a custom behavior. | NodeDropInputMode | ||
![]() | dropData : Object [read-only]
Gets the data carried by a drag operation. | DropInputMode | |
![]() | dropLocation : IPoint [read-only]
Gets the mouse position after dropping an item. | DropInputMode | |
![]() | enabled : Boolean
Gets or sets the enabled state of this input mode. | AbstractConcurrentInputMode | |
| highlightedNode : INode
Adds a highlight to the given INode
This is used for highlighting a group node when dragging over it. | NodeDropInputMode | ||
![]() | inputModeContext : IInputModeContext [read-only]
The context instance this mode is currently installed in or
null if this instance is not installed. | AbstractInputMode | |
![]() | installed : Boolean [read-only]
Whether this mode is currently installed, i.e
if a call to the canvas property will yield a non-null result. | AbstractInputMode | |
| isGroupNodePredicate : Function
Gets or sets the callback for testing whether a dragged node should be created as a group node.
The function has to have the signature function(template:INode):Boolean
The default implementation returns false always. | NodeDropInputMode | ||
![]() | mousePosition : IPoint [read-only]
Gets the current mouse position during drag operations. | DropInputMode | |
| nodeDropCreator : Function
Gets or sets the callback for node creation with has the signature:
function (context:IInputModeContext, graph:IGraph, draggedNode:INode, newNodeLayout:IRectangle):INode with
context The context for which the node should be created.
graph The IGraph in which to create the node.
draggedNode The node which should be created.
newNodeLayout The layout of the node to be created.
Can be set to a different value to implement a custom behavior. | NodeDropInputMode | ||
![]() | preferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent. | AbstractConcurrentInputMode | |
| showNodePreview : Boolean
Determines whether a preview of the dragged node is displayed during the drag. | NodeDropInputMode | ||
| snapContext : SnapContext
The SnapContext which is used to snap the node during the drag. | NodeDropInputMode | ||
| snappedMousePosition : IPoint [read-only]
Gets the current snapped mouse position during drag operations. | NodeDropInputMode | ||
| snappingEnabled : Boolean
Switches snapping on and off. | NodeDropInputMode | ||
![]() | validDropHitTestable : IHitTestable
Gets or sets the IHitTestable that determines whether the given location is a valid drop location. | DropInputMode | |
| Method | Defined By | ||
|---|---|---|---|
NodeDropInputMode(expectedDataFormat:String = INode, expectedDragImageFormat:String = IFlexDisplayObject)
Constructs a new instance of class DropInputMode for the expected data format. | NodeDropInputMode | ||
cancel():void [override]
Cleanly cancels this mode. | NodeDropInputMode | ||
![]() | dispose():void
Disposes this input mode. | AbstractInputMode | |
![]() | install(context:IInputModeContext):void
Installs this mode into the canvas of the given context. | AbstractInputMode | |
![]() | stop():Boolean [override]
Returns true if this input mode doesn't own
the mutex. | AbstractConcurrentInputMode | |
![]() | uninstall(context:IInputModeContext):void
Uninstalls this mode from the canvas. | AbstractInputMode | |
| Method | Defined By | ||
|---|---|---|---|
![]() | acceptDragEnter(e:DragEvent):Boolean
Callback that returns if the current drag may be accepted. | DropInputMode | |
![]() | canRequestMutex():Boolean
Determines whether this instance can request the InputMutex. | AbstractConcurrentInputMode | |
![]() | canvasControl_ViewPointChanged(evt:CanvasEvent):void
Callback that updates the drag location upon view point changes of the CanvasComponent
into which this input mode is installed. | DropInputMode | |
cleanupDrag():void [override]
This method is called by cancel and after a onDragDrop to cleanup any internal
state. | NodeDropInputMode | ||
collect(evt:CollectSnapResultEvent):void
Callback registered on the SnapContext that collects SnapResults for the
dragged node. | NodeDropInputMode | ||
![]() | dataForFormat(format:String):Object
Gets the data carried by a drag operation that has been registered with the given format. | DropInputMode | |
![]() | fireInstalled():void | AbstractInputMode | |
![]() | fireInstalling():void | AbstractInputMode | |
![]() | fireUninstalled():void | AbstractInputMode | |
![]() | fireUninstalling():void | AbstractInputMode | |
Gets the currently dragged INode instance. | NodeDropInputMode | ||
Looks for a group node in the drop location. | NodeDropInputMode | ||
getNodeLayout(x:Number, y:Number, width:Number, height:Number):IRectangle
Calculates the layout of the new node. | NodeDropInputMode | ||
![]() | hasMutex():Boolean
Determines whether this instance owns the input mutex. | AbstractConcurrentInputMode | |
hideDragImage():void
Hides the drag image. | NodeDropInputMode | ||
![]() | initialize():void
Performs one-time initialization of this instance. | AbstractInputMode | |
![]() | installCore(context:IInputModeContext):void [override]
Installs this mode into the given canvas. | DropInputMode | |
![]() | invalidate():void
Convenience method for subclass implementations that invalidates
the canvasComponent this mode is currently installed in. | AbstractInputMode | |
![]() | onDisabled():void [override]
Called when the AbstractConcurrentInputMode.enabled property changes to false. | DropInputMode | |
onDragDrop(e:DragEvent):void [override]
Called whenever a drag is over the canvas. | NodeDropInputMode | ||
onDragEnter(e:DragEvent):void [override]
Called once a drag has entered the canvas. | NodeDropInputMode | ||
onDragExit(e:DragEvent):void [override]
Called whenever a drag is over the canvas. | NodeDropInputMode | ||
![]() | onDragOver(e:DragEvent):void
Called whenever a drag is over the canvas. | DropInputMode | |
![]() | onEnabled():void [override]
Called when the AbstractConcurrentInputMode.enabled property changes to true. | DropInputMode | |
![]() | onMutexObtained():void
Called when this instance obtains the InputMutex. | AbstractConcurrentInputMode | |
![]() | onMutexReleased():void
Called when this instance released the InputMutex. | AbstractConcurrentInputMode | |
onNodeCreated(evt:NodeDropEvent):void
Called whenever a new node is created
| NodeDropInputMode | ||
![]() |
Called when the preferredCursor property changes. | AbstractConcurrentInputMode | |
![]() | releaseMutex():void
Releases the mutex that is currently owned by this instance. | AbstractConcurrentInputMode | |
![]() | requestMutex():void
Requests the InputMutex from the current controller. | AbstractConcurrentInputMode | |
![]() | setAccepting(accept:Boolean):void
Tell the DragManager to accept canvas as drop target or sets the drop target to null. | DropInputMode | |
setDragLocation(coordinates:IPoint):void [override]
Sets the drag location and updates the layout of the dragged node based on the mouse coordinates and the
results of the SnapContext. | NodeDropInputMode | ||
showDragImage():void
Shows the previously hidden drag image. | NodeDropInputMode | ||
![]() | uninstallCore(context:IInputModeContext):void [override]
Uninstalls this mode from the canvas. | DropInputMode | |
| Event | Summary | Defined By | ||
|---|---|---|---|---|
![]() | This event is raised, if a drag operation is dropped onto the CanvasComponent into which this instance is installed. | DropInputMode | ||
![]() | This event is raised, if a drag operation enters the CanvasComponent into which this instance is installed. | DropInputMode | ||
![]() | This event is raised, if a drag operation leaves the CanvasComponent into which this instance is installed. | DropInputMode | ||
![]() | This event is raised, if a drag operation drags over the CanvasComponent into which this instance is installed. | DropInputMode | ||
![]() | Dispatched after the input mode was installed. | AbstractInputMode | ||
![]() | Dispatched before the input mode will be installed. | AbstractInputMode | ||
| Fired if a new node gets created by this input mode. | NodeDropInputMode | |||
![]() | Dispatched when the default cursor changed. | AbstractConcurrentInputMode | ||
![]() | Dispatched after the input mode was uninstalled. | AbstractInputMode | ||
![]() | Dispatched before the input mode will be uninstalled. | AbstractInputMode | ||
| dragNodeCreator | property |
dragNodeCreator:Function
Gets or sets the callback for drag node creation with has the signature:
function (context:IInputModeContext, dragData:Object):INode with
context The context for which the node should be created.dragData The node which should be dragged and is passed to the nodeDropCreator later.
Can be set to a different value to implement a custom behavior. The default implementation just delegates
to getDraggedNode
public function get dragNodeCreator():Function public function set dragNodeCreator(value:Function):voidSee also
| highlightedNode | property |
highlightedNode:INode
Adds a highlight to the given INode
This is used for highlighting a group node when dragging over it.
public function get highlightedNode():INode public function set highlightedNode(value:INode):void| isGroupNodePredicate | property |
isGroupNodePredicate:Function
Gets or sets the callback for testing whether a dragged node should be created as a group node.
The function has to have the signature function(template:INode):Boolean
The default implementation returns false always.
Can be set to a different value to implement custom group node detection.
public function get isGroupNodePredicate():Function public function set isGroupNodePredicate(value:Function):void| nodeDropCreator | property |
nodeDropCreator:Function
Gets or sets the callback for node creation with has the signature:
function (context:IInputModeContext, graph:IGraph, draggedNode:INode, newNodeLayout:IRectangle):INode with
context The context for which the node should be created.graph The IGraph in which to create the node.draggedNode The node which should be created.newNodeLayout The layout of the node to be created.Can be set to a different value to implement a custom behavior.
public function get nodeDropCreator():Function public function set nodeDropCreator(value:Function):void| showNodePreview | property |
showNodePreview:Boolean
Determines whether a preview of the dragged node is displayed during the drag. If the drag image had been
added to the DragSource, it is hidden while the preview is displayed.
The default value is true.
public function get showNodePreview():Boolean public function set showNodePreview(value:Boolean):void| snapContext | property |
snapContext:SnapContext
The SnapContext which is used to snap the node during the drag.
If set to null (the default) this input mode tries to obtain the SnapContext
from the IInputModeContext. To explicitly disable snapping, a VoidSnapContext
has to be set to this instance.
The default value is null.
public function get snapContext():SnapContext public function set snapContext(value:SnapContext):void| snappedMousePosition | property |
snappedMousePosition:IPoint [read-only]
Gets the current snapped mouse position during drag operations.
The position is returned in world coordinates according to the CanvasComponent into which this
input mode is installed.
public function get snappedMousePosition():IPoint| snappingEnabled | property |
snappingEnabled:BooleanSwitches snapping on and off.
The default value is true.
public function get snappingEnabled():Boolean public function set snappingEnabled(value:Boolean):void| NodeDropInputMode | () | Constructor |
public function NodeDropInputMode(expectedDataFormat:String = INode, expectedDragImageFormat:String = IFlexDisplayObject)
Constructs a new instance of class DropInputMode for the expected data format.
expectedDataFormat:String (default = INode) — The expected data format for the drag operation.
| |
expectedDragImageFormat:String (default = IFlexDisplayObject) — The format the drag image is added to the DragSource. This format
is used to hide the drag image if an preview of the dragged node is displayed.
|
See also
| cancel | () | method |
override public function cancel():voidCleanly cancels this mode.
| cleanupDrag | () | method |
override protected function cleanupDrag():void
This method is called by cancel and after a onDragDrop to cleanup any internal
state.
| collect | () | method |
protected function collect(evt:CollectSnapResultEvent):void
Callback registered on the SnapContext that collects SnapResults for the
dragged node.
This method does use the INodeSnapResultProvider registered in the node's lookup or
NodeSnapResultProvider.instance if no such provider could be found.
Parameters
evt:CollectSnapResultEvent — The event describing the movement SnapResults shall be collected for.
|
| getDraggedNode | () | method |
protected function getDraggedNode():INode
Gets the currently dragged INode instance.
The method is called by the dragNodeCreator.
This implementation simply tries to cast the DropInputMode.dropData to INode.
INode — Ehe currently dragged INode instance.
|
| getDropTargetParentNode | () | method |
protected function getDropTargetParentNode(groupedGraph:IGroupedGraph):INodeLooks for a group node in the drop location. If there are several nested group nodes the innermost is returned.
Parameters
groupedGraph:IGroupedGraph — The IGroupedGraph in which to look for.
|
INode — A group node or null if no group was found at the droop location.
|
| getNodeLayout | () | method |
protected function getNodeLayout(x:Number, y:Number, width:Number, height:Number):IRectangleCalculates the layout of the new node. In this implementation the mouse location is used as center of the node. Can be overridden in child class to implement a different layout.
Parameters
x:Number — The current horizontal mouse position.
| |
y:Number — The current vertical mouse position.
| |
width:Number — The width of the node.
| |
height:Number — The height of the node.
|
IRectangle — A rectangle with the given size and the mouse location as center.
|
| hideDragImage | () | method |
protected function hideDragImage():voidHides the drag image. This method is called when a node preview is displayed.
See also
| onDragDrop | () | method |
override protected function onDragDrop(e:DragEvent):voidCalled whenever a drag is over the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_DROP.
|
| onDragEnter | () | method |
override protected function onDragEnter(e:DragEvent):voidCalled once a drag has entered the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_ENTER.
|
| onDragExit | () | method |
override protected function onDragExit(e:DragEvent):voidCalled whenever a drag is over the canvas.
Parameters
e:DragEvent — The drag event with type DragEvent.DRAG_EXIT.
|
| onNodeCreated | () | method |
protected function onNodeCreated(evt:NodeDropEvent):voidCalled whenever a new node is created
Parameters
evt:NodeDropEvent — The NodeDropEvent that gets dispatched.
|
| setDragLocation | () | method |
override protected function setDragLocation(coordinates:IPoint):void
Sets the drag location and updates the layout of the dragged node based on the mouse coordinates and the
results of the SnapContext.
Parameters
coordinates:IPoint — The mouse coordinates used to set the drag location.
|
See also
| showDragImage | () | method |
protected function showDragImage():voidShows the previously hidden drag image.
See also
| nodeCreated | Event |
com.yworks.graph.input.NodeDropEventcom.yworks.graph.input.NodeDropEvent.NODE_CREATEDFired if a new node gets created by this input mode.
Dispatched when a new node has been created.