Packagecom.yworks.canvas.input
Classpublic class MoveLabelInputMode
InheritanceMoveLabelInputMode Inheritance MoveInputMode Inheritance StateMachineInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher

An IInputMode that can be used to drag a ILabel.

This implementation shows the possible candidate positions for a given label and allows the user to drag the label to one of these positions.

Pressing the Ctrl key while dragging allows to move the label independently from the candidates.



Public Properties
 PropertyDefined By
 InheritedbridgeUpdateMode : BridgeUpdateMode
Determines how bridges shall be rendered during the move.
MoveInputMode
 InheritedcanceledState : State
[read-only] Returns the canceled state of the state machine.
StateMachineInputMode
 InheritedcancelRecognizer : Function
Gets or sets the "cancel" recognizer.
MoveInputMode
 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
 InheriteddisableSnappingRecognizer : Function
Gets or sets event recognizer that recognizes when the user temporarily disables snapping.
MoveInputMode
 InheriteddraggedRecognizer : Function
Gets or sets the "dragged" state recognizer.
MoveInputMode
 Inheritedenabled : Boolean
Gets or sets the enabled state of this input mode.
AbstractConcurrentInputMode
 InheritedenableSnappingRecognizer : Function
Gets or sets event recognizer that recognizes when the user reenables temporarily disabled snapping.
MoveInputMode
  graph : IGraph
Gets the Graph this mode is acting upon.
MoveLabelInputMode
  graphSelection : IGraphSelection
The selection this mode is acting upon.
MoveLabelInputMode
 InheritedhitTestable : IHitTestable
Gets or sets the IHitTestable that will be used by this mode to determine where the user may start dragging.
MoveInputMode
 InheritedhoverRecognizer : Function
A function which returns true if the mouse is hovering over a movable item.
MoveInputMode
 InheritedinitialX : Number
[read-only] Returns the initial x position where the dragging was initiated.
MoveInputMode
 InheritedinitialY : Number
[read-only] Returns the initial y position where the dragging was initiated.
MoveInputMode
 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
 InheritedlastMouseEvent : CanvasMouseEvent
[read-only] Returns the last mouse event.
StateMachineInputMode
 Inheritedmovable : IMovable
Gets or sets the IMovable that will be used during dragging to perform the actual movement.
MoveInputMode
 InheritedmoveCursor : Cursor
Gets or sets the cursor to use during the move.
MoveInputMode
 InheritedpositionHandler : IPositionHandler
Gets or sets the IPositionHandler that will be used to handle that actual movement of the elements during the drag.
MoveInputMode
 InheritedpreferredCursor : Cursor
[override]
MoveInputMode
 InheritedpressedRecognizer : Function
Gets or sets the "pressed" state recognizer.
MoveInputMode
 InheritedreleasedRecognizer : Function
Gets or sets the "released" recognizer.
MoveInputMode
 InheritedsnapContext : SnapContext
The SnapContext which manages snapping model items to certain coordinates (e.g.
MoveInputMode
 InheritedstartState : State
[read-only] Returns the start state of the state machine.
StateMachineInputMode
 InheritedstateMachine : StateMachine
[read-only] Gets the state machine.
StateMachineInputMode
 InheritedstoppedState : State
[read-only] Returns the stopped state of the state machine.
StateMachineInputMode
  useLabelModelParameterFinder : Boolean
Gets or sets a property that determines whether to allow the use of the ILabelModelParameterFinder to assign new label model parameters.
MoveLabelInputMode
Protected Properties
 PropertyDefined By
 Inherited_lastEvent : Event
The last Event that has been delivered to this instance.
StateMachineInputMode
 Inherited_lastMouseEvent : CanvasMouseEvent
The last MouseEvent that has been delivered to this instance.
StateMachineInputMode
 InheritedstopEventRecognizer : Function
[read-only] An event recognizer for the state machine that is triggered if this mode has been stoppped.
StateMachineInputMode
Public Methods
 MethodDefined By
  
MoveLabelInputMode(graph:IGraph = null, selection:IGraphSelection = null)
Creates a new instance using the given graph to move the labels in.
MoveLabelInputMode
 Inherited
cancel():void
[override] Runs the machine using the cancel and reset events, releases the input mutex and returns.
StateMachineInputMode
 Inherited
dispose():void
Disposes this input mode.
AbstractInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
 Inherited
Runs the machine using a special reset event.
StateMachineInputMode
 Inherited
run(evt:Event):void
Tries to run the virtual machine using the pair of source and event argument to determine which transition to take.
StateMachineInputMode
 Inherited
stop():Boolean
[override] Runs the machine using a special stop event.
StateMachineInputMode
 Inherited
Uninstalls this mode from the canvas.
AbstractInputMode
Protected Methods
 MethodDefined By
 Inherited
Callback used by the state machine to arm this mode.
MoveInputMode
 Inherited
Callback used by the state machine to initialize the dragging.
MoveInputMode
 Inherited
Called when the users cancels the dragging of the handle.
MoveInputMode
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
 Inherited
Factory method that creates a canceled State for the given machine.
StateMachineInputMode
  
Creates the hit testable that will be used to determine whether this mode may be activated.
MoveLabelInputMode
  
Creates the label position handler for the given graph and label.
MoveLabelInputMode
 Inherited
Creates an IInputModeContext for use with the IPositionHandler interface for the upcoming move operation.
MoveInputMode
 Inherited
Factory method that creates a start State for the given machine.
StateMachineInputMode
 Inherited
Factory method that creates the state machine.
StateMachineInputMode
 Inherited
Factory method that creates a stopped State for the given machine.
StateMachineInputMode
 Inherited
Callback used by the state machine to disarm this mode.
MoveInputMode
 Inherited
Called by the state machine to end the dragging.
MoveInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
hasMutex():Boolean
Determines whether this instance owns the input mutex.
AbstractConcurrentInputMode
  
initialize():void
[override] Performs one-time initialization of this instance.
MoveLabelInputMode
 Inherited
initializeStateMachine(machine:StateMachine, startState:State, canceledState:State, stoppedState:State, finishedState:State):void
[override] Called to initialize the state machine.
MoveInputMode
 Inherited
[override] Installs this mode into the given canvas.
StateMachineInputMode
 Inherited
Installs all necessary listeners to trigger the run method.
StateMachineInputMode
 Inherited
invalidate():void
Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
AbstractInputMode
 Inherited
isCancelEvent(evt:Event):Boolean
Method that identifies an event as a cancel event.
StateMachineInputMode
 Inherited
isDisabledEvent(evt:Event):Boolean
Method that identifies an event as a disabled event.
StateMachineInputMode
 Inherited
isEnabledEvent(evt:Event):Boolean
Method that identifies an event as an enabled event.
StateMachineInputMode
 Inherited
isHovering(evt:Event):Boolean
Returns true if the mouse is hovering over a movable item.
MoveInputMode
 Inherited
isMutexAquiredEvent(evt:Event):Boolean
Method that identifies an event as a mutexAquired event.
StateMachineInputMode
 Inherited
isMutexLostEvent(evt:Event):Boolean
Method that identifies an event as a mutexLost event.
StateMachineInputMode
 Inherited
isStopEvent(evt:Event):Boolean
Method that identifies an event as a stop event.
StateMachineInputMode
  
isValidLabelHit(x:Number, y:Number, context:ICanvasContext):Boolean
Determines whether a valid label has been hit at the specified position.
MoveLabelInputMode
 Inherited
Called when the cancel state has been entered.
StateMachineInputMode
 Inherited
onDisable():void
Runs the state machine using a disable event.
StateMachineInputMode
 Inherited
onDisabled():void
Called when the enabled property changes to false.
AbstractConcurrentInputMode
 Inherited
Called by the state machine during the dragging.
MoveInputMode
  
[override] Clears the MoveInputMode.positionHandler property.
MoveLabelInputMode
  
[override] Clears the MoveInputMode.positionHandler property.
MoveLabelInputMode
 Inherited
onDragging():void
Callback triggered for each drag.
MoveInputMode
 Inherited
Triggers the dragStarted event.
MoveInputMode
  
[override] Registers the MoveInputMode.positionHandler created during the last createLabelPositionHandler call.
MoveLabelInputMode
 Inherited
onEnable():void
Runs the state machine using a enable event.
StateMachineInputMode
 Inherited
onEnabled():void
Called when the enabled property changes to true.
AbstractConcurrentInputMode
  
onGraphChanged(oldGraph:IGraph, newGraph:IGraph):void
Called when the graph property changes.
MoveLabelInputMode
  
onGraphSelectionChanged(oldGraphSelection:IGraphSelection, newGraphSelection:IGraphSelection):void
Called when the graphSelection property changes.
MoveLabelInputMode
 Inherited
StateMachineInputMode
 Inherited
[override] Runs the state machine using a mutex obtained event.
StateMachineInputMode
 Inherited
[override] Runs the state machine using a mutex lost event.
StateMachineInputMode
 Inherited
onPreferredCursorChanged(oldValue:Cursor, newValue:Cursor):void
Called when the preferredCursor property changes.
AbstractConcurrentInputMode
 Inherited
onRun(evt:Event):void
Callback method that will be called after the state machine has been run using the arguments provided.
StateMachineInputMode
 Inherited
Called when the cancel state has been entered.
StateMachineInputMode
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
Requests the InputMutex from the current controller.
AbstractConcurrentInputMode
  
setGraph(newGraph:IGraph):void
Set a new Graph for this mode.
MoveLabelInputMode
  
setGraphSelection(newGraphSelection:IGraphSelection):void
Set a new Graph Selection for this mode.
MoveLabelInputMode
 Inherited
StateMachineInputMode
 Inherited
setPreferredCursorTransition(cursorClass:Class):Function
Factory method that can be used to obtain an listener implementation that sets the given preferredCursor.
StateMachineInputMode
 Inherited
Factory method that can be used to obtain a listener implementation that resets the preferredCursor.
StateMachineInputMode
 Inherited
[override] Uninstalls this mode from the canvas.
StateMachineInputMode
 Inherited
Uninstalls all listeners, this instance has installed on calling intallListeners()
StateMachineInputMode
Events
 Event Summary Defined By
 InheritedDispatched when the drag has been canceled.MoveInputMode
 InheritedDispatched when the drag has been finished.MoveInputMode
 InheritedDispatched for every drag.MoveInputMode
 InheritedDispatched when the drag is initialized and has started.MoveInputMode
 InheritedDispatched when the drag has started.MoveInputMode
 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
graphproperty
graph:IGraph

Gets the Graph this mode is acting upon.


Implementation
    public function get graph():IGraph
    public function set graph(value:IGraph):void
graphSelectionproperty 
graphSelection:IGraphSelection

The selection this mode is acting upon.


Implementation
    public function get graphSelection():IGraphSelection
    public function set graphSelection(value:IGraphSelection):void
useLabelModelParameterFinderproperty 
useLabelModelParameterFinder:Boolean

Gets or sets a property that determines whether to allow the use of the ILabelModelParameterFinder to assign new label model parameters.

The default value is true.


Implementation
    public function get useLabelModelParameterFinder():Boolean
    public function set useLabelModelParameterFinder(value:Boolean):void
Constructor Detail
MoveLabelInputMode()Constructor
public function MoveLabelInputMode(graph:IGraph = null, selection:IGraphSelection = null)

Creates a new instance using the given graph to move the labels in.

It is recommended to use this constructor without parameters and let the instance retrieve the graph instance and selection from the context

Parameters
graph:IGraph (default = null) — The graph to create the edge in and query the labels from.
 
selection:IGraphSelection (default = null) — The selection to use for determining which label is selected.
Method Detail
createLabelHitTestable()method
protected function createLabelHitTestable():IHitTestable

Creates the hit testable that will be used to determine whether this mode may be activated.

This implementation returns an instance that delegates to isValidLabelHit.

Returns
IHitTestable
createLabelPositionHandler()method 
protected function createLabelPositionHandler(graph:IGraph, label:ILabel):IPositionHandler

Creates the label position handler for the given graph and label.

Parameters

graph:IGraph — The graph.
 
label:ILabel — The label to create a positionhandler for.

Returns
IPositionHandler — An instance of LabelPositionHandler

See also

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

Performs one-time initialization of this instance. This method should not be invoked by subclasses. This will be done automatically upon first installment of this mode.

This code will be executed only once. The Canvas property will yield null when this code is executed. This method should not be used to install this mode into a specific canvas. Subclasses should always call super.initialize() first.

isValidLabelHit()method 
protected function isValidLabelHit(x:Number, y:Number, context:ICanvasContext):Boolean

Determines whether a valid label has been hit at the specified position.

This implementation checks the graphSelection to see if there is exactly one label selected and whether the mouse hits the given label.

Parameters

x:Number — The x coordinate for the hit test.
 
y:Number — The y coordinate for the hit test.
 
context:ICanvasContext — The context for hit testing purposes.

Returns
Booleantrue if a valid label is hit and the label moving should be started here; otherwise, false.
onDragCanceled()method 
override protected function onDragCanceled():void

Clears the MoveInputMode.positionHandler property.

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

Clears the MoveInputMode.positionHandler property.

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

Registers the MoveInputMode.positionHandler created during the last createLabelPositionHandler call.

See also

onGraphChanged()method 
protected function onGraphChanged(oldGraph:IGraph, newGraph:IGraph):void

Called when the graph property changes.

Parameters

oldGraph:IGraph — The old graph instance.
 
newGraph:IGraph — The new graph instance.

onGraphSelectionChanged()method 
protected function onGraphSelectionChanged(oldGraphSelection:IGraphSelection, newGraphSelection:IGraphSelection):void

Called when the graphSelection property changes.

Parameters

oldGraphSelection:IGraphSelection — The old instance.
 
newGraphSelection:IGraphSelection — The new instance.

setGraph()method 
protected function setGraph(newGraph:IGraph):void

Set a new Graph for this mode.

Normally the graph is retrieved from this isntance's AbstractInputMode.inputModeContext. If the instance needs to be overridden, this method can be used. Triggers onGraphChanged.

Parameters

newGraph:IGraph — The new graph.

See also

setGraphSelection()method 
protected function setGraphSelection(newGraphSelection:IGraphSelection):void

Set a new Graph Selection for this mode.

Normally the graph selection is retrieved from this instance's "AbstractInputMode.inputModeContext. If the instance needs to be overridden, this method can be used. Triggers onGraphChanged.

Parameters

newGraphSelection:IGraphSelection — The new graph selection.

See also