Package | com.yworks.canvas.input |
Class | public class ConcurrencyController |
Inheritance | ConcurrencyController flash.events.EventDispatcher |
IConcurrentInputMode
implementations.
Modes can request an InputMutex
to disable other modes registered with this controller.
Releasing the mutex will reenable the other modes.
Property | Defined 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 |
Method | Defined By | ||
---|---|---|---|
canRequestMutex():Boolean
Determines if a mutex can be successfully requested currently. | ConcurrencyController | ||
register(mode:IConcurrentInputMode):void
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 | ||
unregister(mode:IConcurrentInputMode):void
Unregisters the given mode from this controller. | ConcurrencyController |
Method | Defined 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 | ||
onMutexReleased(oldOwner:IConcurrentInputMode):void
Callback method that will be triggered if a mode released the input mutex. | ConcurrencyController | ||
onMutexRequested(newOwner:IConcurrentInputMode):void
Callback method that will be triggered if a mode requests the input mutex. | ConcurrencyController |
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 |
currentOwner | property |
currentOwner:IConcurrentInputMode
[read-only]
Gets the current owner of the input mutex or null
if no mode
currently owns the mutex.
public function get currentOwner():IConcurrentInputMode
enabled | property |
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.
public function get enabled():Boolean
public function set enabled(value:Boolean):void
canRequestMutex | () | method |
public function canRequestMutex():Boolean
Determines if a mutex can be successfully requested currently.
ReturnsBoolean — 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.
|
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.
|
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
|
InputMutex — The acquired mutex.
|
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 |
mutexReleased | Event |
com.yworks.canvas.input.MutexEvent
com.yworks.canvas.input.MutexEvent.MUTEX_RELEASED
Event that will be triggered if the mutex has been released.
mutexRequested | Event |
com.yworks.canvas.input.MutexEvent
com.yworks.canvas.input.MutexEvent.MUTEX_REQUESTED
Event that will be triggered if the mutex has been successfully requested.