Packagecom.yworks.canvas.input
Classpublic class ConcurrencyController
InheritanceConcurrencyController Inheritance flash.events.EventDispatcher

A controller class that manages a number of IConcurrentInputMode implementations.

Modes can request an InputMutex to disable other modes registered with this controller. Releasing the mutex will reenable the other modes.



Public Properties
 PropertyDefined By
  currentOwner : IConcurrentInputMode
[read-only] Gets the current owner of the input mutex or null if no mode currently owns the mutex.
ConcurrencyController
  enabled : Boolean
Enables or disables this controller.
ConcurrencyController
Public Methods
 MethodDefined By
  
canRequestMutex():Boolean
Determines if a mutex can be successfully requested currently.
ConcurrencyController
  
Registers the given mode with this controller.
ConcurrencyController
  
release(mutex:InputMutex):void
Releases the given mutex.
ConcurrencyController
  
Can be called to request an InputMutex for the given mode.
ConcurrencyController
  
Unregisters the given mode from this controller.
ConcurrencyController
Protected Methods
 MethodDefined By
  
onDisabled():void
Callback that is called if enabled has been successfully changed accordingly.
ConcurrencyController
  
onEnabled():void
Callback that is called if enabled has been successfully changed accordingly.
ConcurrencyController
  
Callback method that will be triggered if a mode released the input mutex.
ConcurrencyController
  
Callback method that will be triggered if a mode requests the input mutex.
ConcurrencyController
Events
 Event Summary Defined By
  Event that will be triggered if the mutex has been released.ConcurrencyController
  Event that will be triggered if the mutex has been successfully requested.ConcurrencyController
Property Detail
currentOwnerproperty
currentOwner:IConcurrentInputMode  [read-only]

Gets the current owner of the input mutex or null if no mode currently owns the mutex.


Implementation
    public function get currentOwner():IConcurrentInputMode
enabledproperty 
enabled:Boolean

Enables or disables this controller.

The default state is enabled. If disabled, this controller will not allow for requesting new mutex instances and will indicate so in the canRequestMutex() call. If the controller is disabled while a mutex is currently given to a CurrentOwner, the owner will be requested to IInputMode.stop or IInputMode.cancel. This method will ultimately call onEnabled or onDisabled. If it fails to reobtain the mutex from the current owner, even though the owner has been canceled, this method will throw an exception.


Implementation
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void
Method Detail
canRequestMutex()method
public function canRequestMutex():Boolean

Determines if a mutex can be successfully requested currently.

Returns
Boolean — Whether requestMutex would currently succeed.
onDisabled()method 
protected function onDisabled():void

Callback that is called if enabled has been successfully changed accordingly.

onEnabled()method 
protected function onEnabled():void

Callback that is called if enabled has been successfully changed accordingly.

onMutexReleased()method 
protected function onMutexReleased(oldOwner:IConcurrentInputMode):void

Callback method that will be triggered if a mode released the input mutex.

This will trigger the mutexReleased event.

Parameters

oldOwner:IConcurrentInputMode — The old owner of the mutex.

onMutexRequested()method 
protected function onMutexRequested(newOwner:IConcurrentInputMode):void

Callback method that will be triggered if a mode requests the input mutex.

This method will cancel and disable all other modes that have been registered with this instance. Finally, it triggers the mutexRequested event.

Parameters

newOwner:IConcurrentInputMode — The new owner of the mutex.

register()method 
public function register(mode:IConcurrentInputMode):void

Registers the given mode with this controller.

This mode can now request the input mutex and will be disabled once another mode acquires the mutex. If another mode currently owns the mutex, this mode will be immediately disabled. This will automatically inject this instance into the mode using the controller property.

Parameters

mode:IConcurrentInputMode — The mode to register with this controller.


Throws
ArgumentError — If the mode is null or the mode is already registered.
release()method 
public function release(mutex:InputMutex):void

Releases the given mutex.

Modes should call this method when they have finished editing the contents exclusively. This will reenable those modes that had been disabled at the time the mutex was requested.

Parameters

mutex:InputMutex — The mutex to release.


Throws
ArgumentError — If the given mutex is not the current mutex.
requestMutex()method 
public function requestMutex(mode:IConcurrentInputMode):InputMutex

Can be called to request an InputMutex for the given mode.

Modes should call this method to request exclusive editing for a canvas control.

Parameters

mode:IConcurrentInputMode — The mode that should be given the mutex

Returns
InputMutex — The acquired mutex.

Throws
IllegalOperationError — If the mutex could not be obtained.
 
ArgumentError
unregister()method 
public function unregister(mode:IConcurrentInputMode):void

Unregisters the given mode from this controller.

This will reset the controller property of the given mode to null.

Parameters

mode:IConcurrentInputMode

Event Detail
mutexReleased Event
Event Object Type: com.yworks.canvas.input.MutexEvent
MutexEvent.type property = com.yworks.canvas.input.MutexEvent.MUTEX_RELEASED

Event that will be triggered if the mutex has been released.

mutexRequested Event  
Event Object Type: com.yworks.canvas.input.MutexEvent
MutexEvent.type property = com.yworks.canvas.input.MutexEvent.MUTEX_REQUESTED

Event that will be triggered if the mutex has been successfully requested.