Packagecom.yworks.canvas.input
Classpublic class DropInputMode
InheritanceDropInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher
Subclasses NodeDropInputMode, StripeDropInputMode

This is an input mode handling drag and drop related events on a CanvasComponent.

An instance of DropInputMode is initialized for an expected data format in the constructor. There are four events raised by an instance of this class.

Clients can query the current mousePosition which is updated while a drag is in progress. Clients get the data from the drag operation by calling dropData from an event handler registered for any of these events.

This input mode supports concurrency. It can be added to a MultiplexingInputMode using MultiplexingInputMode.addConcurrent(IConcurrentInputMode,int).

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

CanvasComponent
MultiplexingInputMode.addConcurrent


Public Properties
 PropertyDefined By
 Inheritedcanvas : CanvasComponent
[read-only] The canvas instance this mode is currently installed in or null
AbstractInputMode
 Inheritedcontroller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance.
AbstractConcurrentInputMode
  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
 Inheritedenabled : Boolean
Gets or sets the enabled state of this input mode.
AbstractConcurrentInputMode
 InheritedinputModeContext : IInputModeContext
[read-only] The context instance this mode is currently installed in or null if this instance is not installed.
AbstractInputMode
 Inheritedinstalled : 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
  mousePosition : IPoint
[read-only] Gets the current mouse position during drag operations.
DropInputMode
 InheritedpreferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent.
AbstractConcurrentInputMode
  validDropHitTestable : IHitTestable
Gets or sets the IHitTestable that determines whether the given location is a valid drop location.
DropInputMode
Protected Properties
 PropertyDefined By
  dragSource : DragSource
[read-only] The DragSource object containing the data being dragged.
DropInputMode
Public Methods
 MethodDefined By
  
DropInputMode(expectedDataFormat:String)
Constructs a new instance of class DropInputMode for the expected data format.
DropInputMode
  
cancel():void
[override] Cleanly cancels this mode.
DropInputMode
 Inherited
dispose():void
Disposes this input mode.
AbstractInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
 Inherited
stop():Boolean
[override] Returns true if this input mode doesn't own the mutex.
AbstractConcurrentInputMode
 Inherited
Uninstalls this mode from the canvas.
AbstractInputMode
Protected Methods
 MethodDefined By
  
acceptDragEnter(e:DragEvent):Boolean
Callback that returns if the current drag may be accepted.
DropInputMode
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
  
Callback that updates the drag location upon view point changes of the CanvasComponent into which this input mode is installed.
DropInputMode
  
This method is called by cancel and after a onDragDrop to cleanup any internal state.
DropInputMode
  
dataForFormat(format:String):Object
Gets the data carried by a drag operation that has been registered with the given format.
DropInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
hasMutex():Boolean
Determines whether this instance owns the input mutex.
AbstractConcurrentInputMode
 Inherited
initialize():void
Performs one-time initialization of this instance.
AbstractInputMode
  
[override] Installs this mode into the given canvas.
DropInputMode
 Inherited
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
Called whenever a drag is over the canvas.
DropInputMode
  
onDragEnter(e:DragEvent):void
Called once a drag has entered the canvas.
DropInputMode
  
onDragExit(e:DragEvent):void
Called whenever a drag is over the canvas.
DropInputMode
  
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
 Inherited
Called when this instance obtains the InputMutex.
AbstractConcurrentInputMode
 Inherited
Called when this instance released the InputMutex.
AbstractConcurrentInputMode
 Inherited
onPreferredCursorChanged(oldValue:Cursor, newValue:Cursor):void
Called when the preferredCursor property changes.
AbstractConcurrentInputMode
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
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
This method updates the mousePosition according to the coordinates passed in.
DropInputMode
  
[override] Uninstalls this mode from the canvas.
DropInputMode
Events
 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
 InheritedDispatched after the input mode was installed.AbstractInputMode
 InheritedDispatched before the input mode will be installed.AbstractInputMode
 InheritedDispatched when the default cursor changed.AbstractConcurrentInputMode
 InheritedDispatched after the input mode was uninstalled.AbstractInputMode
 InheritedDispatched before the input mode will be uninstalled.AbstractInputMode
Public Constants
 ConstantDefined By
 InheritedINSTALLED : String = installed
[static]
AbstractInputMode
 InheritedINSTALLING : String = installing
[static]
AbstractInputMode
 InheritedPREFERRED_CURSOR_CHANGED : String = preferredCursorChanged
[static]
AbstractConcurrentInputMode
 InheritedUNINSTALLED : String = uninstalled
[static]
AbstractInputMode
 InheritedUNINSTALLING : String = uninstalling
[static]
AbstractInputMode
Property Detail
dragSourceproperty
dragSource:DragSource  [read-only]

The DragSource object containing the data being dragged. This is only valid, if a drag entered the CanvasComponent first.


Implementation
    protected function get dragSource():DragSource
dropDataproperty 
dropData:Object  [read-only]

Gets the data carried by a drag operation. This is only valid, if a drag entered the CanvasComponent first.


Implementation
    public function get dropData():Object
dropLocationproperty 
dropLocation:IPoint  [read-only]

Gets the mouse position after dropping an item. The position is returned in world coordinates according to the CanvasComponent into which this input mode is installed.


Implementation
    public function get dropLocation():IPoint
mousePositionproperty 
mousePosition:IPoint  [read-only]

Gets the current mouse position during drag operations. The position is returned in world coordinates according to the CanvasComponent into which this input mode is installed.


Implementation
    public function get mousePosition():IPoint
validDropHitTestableproperty 
validDropHitTestable:IHitTestable

Gets or sets the IHitTestable that determines whether the given location is a valid drop location. The hit testable yields true for valid drop locations.


Implementation
    public function get validDropHitTestable():IHitTestable
    public function set validDropHitTestable(value:IHitTestable):void
Constructor Detail
DropInputMode()Constructor
public function DropInputMode(expectedDataFormat:String)

Constructs a new instance of class DropInputMode for the expected data format. The input mode fires events (see DragEntered and DragDropped) only if a drag operation carries data conforming to the given format.

Parameters
expectedDataFormat:String — This is a string which can be given to DragSource.dataForFormat(String).
Method Detail
acceptDragEnter()method
protected function acceptDragEnter(e:DragEvent):Boolean

Callback that returns if the current drag may be accepted.

Parameters

e:DragEvent — The drag event to adjust the effect.

Returns
Boolean
cancel()method 
override public function cancel():void

Cleanly cancels this mode.

canvasControl_ViewPointChanged()method 
protected function 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.

Parameters

evt:CanvasEvent — The CanvasEvent of type CanvasEvent.VIEW_POINT_CHANGED that triggered this update.

See also

CanvasEvent.VIEW_POINT_CHANGED
cleanupDrag()method 
protected function cleanupDrag():void

This method is called by cancel and after a onDragDrop to cleanup any internal state.

dataForFormat()method 
protected function dataForFormat(format:String):Object

Gets the data carried by a drag operation that has been registered with the given format. This is only valid, if a drag entered the CanvasComponent first.

Parameters

format:String

Returns
Object
installCore()method 
override protected function installCore(context:IInputModeContext):void

Installs this mode into the given canvas. Clients should not call this method as this is handled by the framework.

Parameters

context:IInputModeContext — The context to install this mode into.

onDisabled()method 
override protected function onDisabled():void

Called when the AbstractConcurrentInputMode.enabled property changes to false. This implementation removes the drag and drop listeners from the canvas.

onDragDrop()method 
protected function onDragDrop(e:DragEvent):void

Called whenever a drag is over the canvas.

Parameters

e:DragEvent — The drag event with type DragEvent.DRAG_DROP.

onDragEnter()method 
protected function onDragEnter(e:DragEvent):void

Called once a drag has entered the canvas.

Parameters

e:DragEvent — The drag event with type DragEvent.DRAG_ENTER.

onDragExit()method 
protected function onDragExit(e:DragEvent):void

Called whenever a drag is over the canvas.

Parameters

e:DragEvent — The drag event with type DragEvent.DRAG_EXIT.

onDragOver()method 
protected function onDragOver(e:DragEvent):void

Called whenever a drag is over the canvas.

Parameters

e:DragEvent — The drag event with type DragEvent.DRAG_OVER.

onEnabled()method 
override protected function onEnabled():void

Called when the AbstractConcurrentInputMode.enabled property changes to true. This implementation registers the drag and drop listeners on the canvas.

setAccepting()method 
protected function setAccepting(accept:Boolean):void

Tell the DragManager to accept canvas as drop target or sets the drop target to null.

Parameters

accept:Boolean — If true and canvas wasn't the drop target, DragManager.acceptDragDrop(canvas) is called. If false and canvas was the drop target, DragManager.acceptDragDrop(null) is called.

See also

DragManager.acceptDragDrop
setDragLocation()method 
protected function setDragLocation(coordinates:IPoint):void

This method updates the mousePosition according to the coordinates passed in. It is called prior to the onDragEnter, onDragOver and onDragDrop methods.

Parameters

coordinates:IPoint — The current location of the mouse in world coordinates.

uninstallCore()method 
override protected function uninstallCore(context:IInputModeContext):void

Uninstalls this mode from the canvas. Clients should not call this method as this is handled by the framework.

Parameters

context:IInputModeContext — The context.

Event Detail
dragDrop Event
Event Object Type: mx.events.DragEvent
DragEvent.type property = mx.events.DragEvent.DRAG_DROP

This event is raised, if a drag operation is dropped onto the CanvasComponent into which this instance is installed.

No event is raised

See also

dragEnter Event  
Event Object Type: mx.events.DragEvent
DragEvent.type property = mx.events.DragEvent.DRAG_ENTER

This event is raised, if a drag operation enters the CanvasComponent into which this instance is installed.

No event is raised

See also

dragExit Event  
Event Object Type: mx.events.DragEvent
DragEvent.type property = mx.events.DragEvent.DRAG_EXIT

This event is raised, if a drag operation leaves the CanvasComponent into which this instance is installed.

No event is raised

See also

dragOver Event  
Event Object Type: mx.events.DragEvent
DragEvent.type property = mx.events.DragEvent.DRAG_OVER

This event is raised, if a drag operation drags over the CanvasComponent into which this instance is installed.

No event is raised

See also