Packagecom.yworks.canvas.input
Classpublic class KeyboardInputMode
InheritanceKeyboardInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher
Subclasses NavigationInputMode

An IInputMode that recognizes simple key events and invokes a registered handler.



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
 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
 InheritedpreferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent.
AbstractConcurrentInputMode
Public Methods
 MethodDefined By
  
addHandler(eventRecognizer:Function, handler:Function):void
Adds a given handler to this instance that will be triggered if the given eventRecognizer recognizes a KeyboardEvent that has been triggered by the canvas component.
KeyboardInputMode
 Inherited
cancel():void
[override] Releases the mutex if this input mode currently owns the mutex.
AbstractConcurrentInputMode
  
clearHandlers(eventRecognizer:Function = null):void
Removes all handlers that have been registered under the given recognizer.
KeyboardInputMode
  
dispose():void
[override] Disposes this input mode.
KeyboardInputMode
  
getHandlers(eventRecognizer:Function):Iterator
Returns all handlers registered using the given recognizer.
KeyboardInputMode
  
Returns an enumerator over all distinct registered recognizers.
KeyboardInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
  
removeHandler(eventRecognizer:Function, handler:Function):void
Removes a previously registered handler.
KeyboardInputMode
 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
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
  
handleEvent(evt:Event):void
Traps key events from the canvas control and checks the list of recognizers.
KeyboardInputMode
 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.
KeyboardInputMode
 Inherited
invalidate():void
Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
AbstractInputMode
 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
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
Requests the InputMutex from the current controller.
AbstractConcurrentInputMode
  
[override] Implementation of uninstall: Uninstalls this mode from the canvas.
KeyboardInputMode
Events
 Event Summary Defined By
 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
Method Detail
addHandler()method
public function addHandler(eventRecognizer:Function, handler:Function):void

Adds a given handler to this instance that will be triggered if the given eventRecognizer recognizes a KeyboardEvent that has been triggered by the canvas component.

Parameters

eventRecognizer:Function — A function with the signature function(event:KeyboardEvent):Boolean that returns true if it recognizes the event argument.
 
handler:Function — The handler function to invoke if the recognizer matches an event. The function has the signature function(event:KeyboardEvent):void.

clearHandlers()method 
public function clearHandlers(eventRecognizer:Function = null):void

Removes all handlers that have been registered under the given recognizer. If no recognizer is given, all registered handlers will be removed.

Parameters

eventRecognizer:Function (default = null)

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

Disposes this input mode.

Subclasses should remove all listeners that they have registered.

getHandlers()method 
public function getHandlers(eventRecognizer:Function):Iterator

Returns all handlers registered using the given recognizer.

Parameters

eventRecognizer:Function

Returns
Iterator
getRegisteredRecognizers()method 
public function getRegisteredRecognizers():Iterator

Returns an enumerator over all distinct registered recognizers.

Returns
Iterator
handleEvent()method 
protected function handleEvent(evt:Event):void

Traps key events from the canvas control and checks the list of recognizers.

If this mode is disabled, it will silently return. If one of the recognizers matches the event, this implementation will request and release an input mutex, effectively cancelling other modes.

Parameters

evt:Event

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.

removeHandler()method 
public function removeHandler(eventRecognizer:Function, handler:Function):void

Removes a previously registered handler.

Parameters

eventRecognizer:Function — An event recognizer function that had been registered before.
 
handler:Function — An event handler that had been registered with the event recognizer function before.

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 ).