Packagecom.yworks.canvas.input
Classpublic class TextEditorInputMode
InheritanceTextEditorInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher

A simple IInputMode that displays an ITextEditor instance in the canvas control to let the user edit a text.



Public Properties
 PropertyDefined By
  anchor : IPoint
Gets or sets the anchor of the text editor.
TextEditorInputMode
  autoCommitOnFocusLost : Boolean
Gets or sets a property that determines whether the text edited should be committed if the focus gets lost or the editing should be canceled.
TextEditorInputMode
  autoStartEditing : Boolean
Determines whether this mode should automatically fire up the editor once it gets installed.
TextEditorInputMode
 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
  editing : Boolean
Gets or sets the current editing state of the editor.
TextEditorInputMode
 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
  location : IPoint
Gets or sets the location of the text box in world coordinates.
TextEditorInputMode
 InheritedpreferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent.
AbstractConcurrentInputMode
  textEditor : ITextEditor
Gets or sets the text box to use for displaying and editing.
TextEditorInputMode
Public Methods
 MethodDefined By
  
TextEditorInputMode(textEditor:ITextEditor = null)
Creates a new instance using the given text editor instance.
TextEditorInputMode
  
cancel():void
[override] Cancels editing of the text box.
TextEditorInputMode
  
clear():void
Resets the contents of the text editor.
TextEditorInputMode
 Inherited
dispose():void
Disposes this input mode.
AbstractInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
  
stop():Boolean
[override] Stops editing and returns true.
TextEditorInputMode
 Inherited
Uninstalls this mode from the canvas.
AbstractInputMode
Protected Methods
 MethodDefined By
  
Adjusts the position of the text box in the canvas control.
TextEditorInputMode
  
adjustSize():void
Adjusts the size of the text editor in the canvas control.
TextEditorInputMode
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
  
Factory method that creates a default text box.
TextEditorInputMode
 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] The implementation of the install() method: installs this mode into the canvas of the given context.
TextEditorInputMode
  
Installs the text editor in the canvas and puts focus into it.
TextEditorInputMode
 Inherited
invalidate():void
Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
AbstractInputMode
  
Called when editing starts.
TextEditorInputMode
  
Called when editing gets canceled.
TextEditorInputMode
 Inherited
onDisabled():void
Called when the enabled property changes to false.
AbstractConcurrentInputMode
 Inherited
onEnabled():void
Called when the enabled property changes to true.
AbstractConcurrentInputMode
 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
  
Called when editing is stopped.
TextEditorInputMode
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
Requests the InputMutex from the current controller.
AbstractConcurrentInputMode
  
te_LostFocus(evt:Event):void
Called when the text editor lost the focus.
TextEditorInputMode
  
[override] Implementation of uninstall: Uninstalls this mode from the canvas.
TextEditorInputMode
  
Removes the text box.
TextEditorInputMode
Events
 Event Summary Defined By
  Dispatched when this input mode has been canceled.TextEditorInputMode
 InheritedDispatched after the input mode was installed.AbstractInputMode
 InheritedDispatched before the input mode will be installed.AbstractInputMode
 InheritedDispatched when the default cursor changed.AbstractConcurrentInputMode
  Dispatched when the text has been edited.TextEditorInputMode
 InheritedDispatched after the input mode was uninstalled.AbstractInputMode
 InheritedDispatched before the input mode will be uninstalled.AbstractInputMode
Public Constants
 ConstantDefined By
  EDITING_CANCELED : String = editingCanceled
[static]
TextEditorInputMode
 InheritedINSTALLED : String = installed
[static]
AbstractInputMode
 InheritedINSTALLING : String = installing
[static]
AbstractInputMode
 InheritedPREFERRED_CURSOR_CHANGED : String = preferredCursorChanged
[static]
AbstractConcurrentInputMode
  TEXT_EDITED : String = textEdited
[static]
TextEditorInputMode
 InheritedUNINSTALLED : String = uninstalled
[static]
AbstractInputMode
 InheritedUNINSTALLING : String = uninstalling
[static]
AbstractInputMode
Property Detail
anchorproperty
anchor:IPoint

Gets or sets the anchor of the text editor.

The anchor is the point inside the coordinate system of the text box that shall coincide with the location in the world coordinate system.


Implementation
    public function get anchor():IPoint
    public function set anchor(value:IPoint):void
autoCommitOnFocusLostproperty 
autoCommitOnFocusLost:Boolean

Gets or sets a property that determines whether the text edited should be committed if the focus gets lost or the editing should be canceled.

The default behavior is to cancel the editing process.

The default value is false.


Implementation
    public function get autoCommitOnFocusLost():Boolean
    public function set autoCommitOnFocusLost(value:Boolean):void
autoStartEditingproperty 
autoStartEditing:Boolean

Determines whether this mode should automatically fire up the editor once it gets installed.

If this mode is permanently installed, set this flag to false and set the editing flag to true in order to start editing.

The default value is false.


Implementation
    public function get autoStartEditing():Boolean
    public function set autoStartEditing(value:Boolean):void
editingproperty 
editing:Boolean

Gets or sets the current editing state of the editor.

Setting a new value will trigger the onBeginEditing and onCancelEditing methods respectively.


Implementation
    public function get editing():Boolean
    public function set editing(value:Boolean):void
locationproperty 
location:IPoint

Gets or sets the location of the text box in world coordinates.


Implementation
    public function get location():IPoint
    public function set location(value:IPoint):void
textEditorproperty 
textEditor:ITextEditor

Gets or sets the text box to use for displaying and editing.

This will trigger the createTextBox factory method, the first time this property is queried.


Implementation
    public function get textEditor():ITextEditor
    public function set textEditor(value:ITextEditor):void
Constructor Detail
TextEditorInputMode()Constructor
public function TextEditorInputMode(textEditor:ITextEditor = null)

Creates a new instance using the given text editor instance.

Parameters
textEditor:ITextEditor (default = null) — The text editor to use.
Method Detail
adjustPosition()method
protected function adjustPosition():void

Adjusts the position of the text box in the canvas control.

adjustSize()method 
protected function adjustSize():void

Adjusts the size of the text editor in the canvas control.

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

Cancels editing of the text box.

clear()method 
public function clear():void

Resets the contents of the text editor.

createTextEditor()method 
protected function createTextEditor():ITextEditor

Factory method that creates a default text box.

Hitting escape or enter will cancel or stop editing.

Returns
ITextEditor — An ITextEditor implementation.
installCore()method 
override protected function installCore(context:IInputModeContext):void

The implementation of the install() method: installs this mode into the canvas of the given context.

Subclasses should override this method and call super.installCore(context), 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.

Parameters

context:IInputModeContext — The context to use for installation.

installTextEditor()method 
protected function installTextEditor():void

Installs the text editor in the canvas and puts focus into it.

onBeginEditing()method 
protected function onBeginEditing():void

Called when editing starts.

Requests the input mutex, and installs the text box.

onCancelEditing()method 
protected function onCancelEditing():void

Called when editing gets canceled.

Removes the text box and releases the input mutex.

onStopEditing()method 
protected function onStopEditing():void

Called when editing is stopped.

Triggers the textEdited event, removes the box and releases the input mutex.

stop()method 
override public function stop():Boolean

Stops editing and returns true.

Returns
Booleansuper.stop()
te_LostFocus()method 
protected function te_LostFocus(evt:Event):void

Called when the text editor lost the focus. Cancels this input mode.

Parameters

evt:Event

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

Implementation of uninstall: Uninstalls this mode from the canvas.

Subclasses should always call super.uninstallCore( context ) as the last statement.

Parameters

context:IInputModeContext — The context to remove this mode from. This is the same instance that has been passed to install( IInputModeContext ).

uninstallTextEditor()method 
protected function uninstallTextEditor():void

Removes the text box.

Event Detail
editingCanceled Event
Event Object Type: flash.events.Event
Event.type property = mx.events.Event

Dispatched when this input mode has been canceled.

This input mode is also canceled after a successful edit. Thus, this event will also be dispatched after a successful edit.

textEdited Event  
Event Object Type: flash.events.Event
Event.type property = mx.events.Event

Dispatched when the text has been edited.

Constant Detail
EDITING_CANCELEDConstant
public static const EDITING_CANCELED:String = editingCanceled

TEXT_EDITEDConstant 
public static const TEXT_EDITED:String = textEdited