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
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
  
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
 EventSummaryDefined 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
Method detail
canRequestMutex()method
public function canRequestMutex():Boolean

Determines if a mutex can be successfully requested currently.

Returns
Boolean — Whether requestMutex would currently succeed.
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.
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.
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
— If the mutex could not be obtained.
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
mutexReleasedevent 
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.

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