Packagecom.yworks.graph.input
Classpublic class CreateBendInputMode
InheritanceCreateBendInputMode Inheritance EdgeDragInputModeBase Inheritance StateMachineInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher

An IInputMode used for recognizing the gesture of creating IBends in an IGraph. This mode is used by GraphEditorInputMode but can be used stand-alone, too. Client code should register with the BendCreated event to perform additional actions after the bend has been created.

See also

IInputMode
IBend
GraphEditorInputMode


Public Properties
 PropertyDefined By
 InheritedbeginHitTestable : IHitTestable
Gets or sets the IHitTestable that determines where bends may be created.
EdgeDragInputModeBase
 InheritedcanceledState : State
[read-only] Returns the canceled state of the state machine.
StateMachineInputMode
 InheritedcancelRecognizer : Function
Gets or sets the "cancel" recognizer.
EdgeDragInputModeBase
 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
 InheriteddraggedRecognizer : Function
Gets or sets the "dragged" recognizer.
EdgeDragInputModeBase
 Inheritedenabled : Boolean
Gets or sets the enabled state of this input mode.
AbstractConcurrentInputMode
 Inheritedgraph : IGraph
Gets the Graph this mode is acting upon.
EdgeDragInputModeBase
  graphCanvas : GraphCanvasComponent
[read-only] Gets the GraphCanvasComponent this mode is working on or null.
CreateBendInputMode
 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
 Inheritedlocation : IPoint
[read-only] Gets the location where the bend creation gesture was initialized.
EdgeDragInputModeBase
 InheritedpreferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent.
AbstractConcurrentInputMode
 InheritedpressedRecognizer : Function
Gets or sets the "pressed" state recognizer.
EdgeDragInputModeBase
 InheritedreleasedRecognizer : Function
Gets or sets the "released" recognizer.
EdgeDragInputModeBase
  returnExistingBend : Boolean
Gets or sets a property that determines whether this mode should return an existing bend in createBend if there is one found at the given location.
CreateBendInputMode
  splitOrthogonalSegment : Boolean
[read-only] Gets a value indicating whether an orthogonal segment should be split by the last bend creation.
CreateBendInputMode
  splitOrthogonalSegmentRecognizer : Function
Gets or sets the event recognizer that determines whether during the call to dragSegment the bend creation should be treated as a split segment operation for orthogonal segments.
CreateBendInputMode
 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
Protected Properties
 PropertyDefined By
 Inherited_beginHitTestable : IHitTestable
EdgeDragInputModeBase
 Inherited_cancelRecognizer : Function
EdgeDragInputModeBase
 Inherited_draggedRecognizer : Function
EdgeDragInputModeBase
 Inherited_firstPoint : YPoint
EdgeDragInputModeBase
 Inherited_graph : IGraph
EdgeDragInputModeBase
 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
 Inherited_pressedRecognizer : Function
EdgeDragInputModeBase
 Inherited_releasedRecognizer : Function
EdgeDragInputModeBase
  _splitOrthogonalSegment : Boolean
CreateBendInputMode
 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
  
Creates a new instance using the given graph to create the bends in.
CreateBendInputMode
 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
getEdge(x:Number, y:Number):IEdge
Finds the edge at the given coordinate.
EdgeDragInputModeBase
 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
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
  
createBend(hitEdge:IEdge, x:Number, y:Number):IBend
Creates the bend.
CreateBendInputMode
 Inherited
Factory method that creates a canceled State for the given machine.
StateMachineInputMode
 Inherited
Creates an IInputModeContext for use in CreateBendInputMode#createBend.
EdgeDragInputModeBase
 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
  
dragEdgeSegment(edge:IEdge, dragLocation:IPoint):void
[override] Updates the splitOrthogonalSegment property and then delegates to createBend.
CreateBendInputMode
 Inherited
Callback that is triggered when a drag on an edge segment has been recognized.
EdgeDragInputModeBase
 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
 Inherited
initializeStateMachine(machine:StateMachine, startState:State, canceledState:State, stoppedState:State, finishedState:State):void
[override] Called to initialize the state machine.
EdgeDragInputModeBase
  
[override] Installs this mode into the given canvas.
CreateBendInputMode
 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
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
 Inherited
isValidBegin(evt:Event):Boolean
Determines whether the current location and event is valid to begin a bend creation gesture.
EdgeDragInputModeBase
  
onBendCreated(bend:IBend):void
Triggers the bendCreated event.
CreateBendInputMode
  
[override]
CreateBendInputMode
 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
onEnable():void
Runs the state machine using a enable event.
StateMachineInputMode
 Inherited
onEnabled():void
Called when the enabled property changes to true.
AbstractConcurrentInputMode
 Inherited
onGraphChanged(oldGraph:IGraph, newGraph:IGraph):void
Called when the graph property changes.
EdgeDragInputModeBase
 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
  
[override]
CreateBendInputMode
 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
 Inherited
setGraph(newGraph:IGraph):void
Sets a new graph for this mode.
EdgeDragInputModeBase
  
Sets the GraphCanvasComponent that is associated with this instance.
CreateBendInputMode
 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
  
[override] Uninstalls this mode.
CreateBendInputMode
 Inherited
Uninstalls all listeners, this instance has installed on calling intallListeners()
StateMachineInputMode
Events
 Event Summary Defined By
  Dispatched when a new bend creation gesture has been recognized.CreateBendInputMode
 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
_splitOrthogonalSegmentproperty
protected var _splitOrthogonalSegment:Boolean

graphCanvasproperty 
graphCanvas:GraphCanvasComponent  [read-only]

Gets the GraphCanvasComponent this mode is working on or null.

This property is set by setGraphControl which is triggered if this mode is installed in a GraphCanvasComponent.


Implementation
    public function get graphCanvas():GraphCanvasComponent
returnExistingBendproperty 
returnExistingBend:Boolean

Gets or sets a property that determines whether this mode should return an existing bend in createBend if there is one found at the given location.

The default value is true.


Implementation
    public function get returnExistingBend():Boolean
    public function set returnExistingBend(value:Boolean):void
splitOrthogonalSegmentproperty 
splitOrthogonalSegment:Boolean  [read-only]

Gets a value indicating whether an orthogonal segment should be split by the last bend creation. This property can be read by implementations of IBendCreator if they retrieve this instance from their IInputModeContext.parentInputMode. If this property is true, implementation are advised to treat the bend creation as a gesture that splits the segment into two.


Implementation
    public function get splitOrthogonalSegment():Boolean

See also

IBendCreator
IInputModeContext.parentInputMode
splitOrthogonalSegmentRecognizer
splitOrthogonalSegmentRecognizerproperty 
splitOrthogonalSegmentRecognizer:Function

Gets or sets the event recognizer that determines whether during the call to dragSegment the bend creation should be treated as a split segment operation for orthogonal segments.

The default value is EventRecognizers#MODIFIER_SHIFT.


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

See also

Constructor Detail
CreateBendInputMode()Constructor
public function CreateBendInputMode(graph:IGraph)

Creates a new instance using the given graph to create the bends in. It is recommended to omit the graph parameter in which case the instance retrieves the graph instance from the context.

Parameters
graph:IGraph — The graph to create the bends in and query the edges from.

See also

Method Detail
createBend()method
protected function createBend(hitEdge:IEdge, x:Number, y:Number):IBend

Creates the bend.

The bend is created using the hit edge's IBendCreator implementation, as obtained from the edge's ILookup.Lookup.

Parameters

hitEdge:IEdge — The hit edge.
 
x:Number — The x coordinate of the hit.
 
y:Number — The y coordinate of the hit.

Returns
IBend — The created bend or null.

See also

dragEdgeSegment()method 
override protected function dragEdgeSegment(edge:IEdge, dragLocation:IPoint):void

Updates the splitOrthogonalSegment property and then delegates to createBend. This method triggers the bendCreated event if a bend is created.

Parameters

edge:IEdge — The edge to create a bend for.
 
dragLocation:IPoint — The location at which the user initiated the gesture.

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

Installs this mode into the given canvas.

Subclasses should override this method and call super.install(canvas), first. One-time initialization should be performed in the initialize method. The install method will call the initialize method the first time this mode gets installed.

This implementation calls installListeners.

Parameters

context:IInputModeContext — The canvas to install this mode into

onBendCreated()method 
protected function onBendCreated(bend:IBend):void

Triggers the bendCreated event.

Parameters

bend:IBend — The bend, which was created.

onCancel()method 
override protected function onCancel(te:TransitionEvent):void

Parameters

te:TransitionEvent

onReleased()method 
override protected function onReleased(te:TransitionEvent):void

Parameters

te:TransitionEvent

setGraphCanvas()method 
protected function setGraphCanvas(graphCanvas:GraphCanvasComponent):void

Sets the GraphCanvasComponent that is associated with this instance.

This will register a listener for the graphChanged event to upgrade the graph property accordingly.

Parameters

graphCanvas:GraphCanvasComponent — the control to set.

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

Uninstalls this mode.

Deregisters event listeners from the graph canvas and sets the graph canvas for this input mode to null.

Parameters

context:IInputModeContext — The input mode context that this instance has been installed into.

Event Detail
bendCreated Event
Event Object Type: com.yworks.graph.input.BendCreatedEvent
BendCreatedEvent.type property = com.yworks.graph.input.BendCreatedEvent.BEND_CREATED

Dispatched when a new bend creation gesture has been recognized.

Dispatched when a new bend has been created.