public class WaitInputMode extends Object implements IInputMode
IInputMode implementation that can be used to block user interaction.
Setting the Waiting property will try to cancel ongoing edits of the mutex owner
and set the Editable state to false and set the preferred cursor to
WaitCursor. This mode will try to add itself to the
Lookup of the CanvasControl, so that other clients can make use of its
functionality.
This mode uses an Exclusive controller by default.
isWaiting()| Constructor and Description |
|---|
WaitInputMode()
Creates a new instance of this mode.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addWaitingEndedListener(IEventHandler<InputModeEventArgs> waitingEndedEvent)
Adds the given listener for the
WaitingEnded event that occurs when the waiting ended. |
void |
addWaitingStartedListener(IEventHandler<InputModeEventArgs> waitingStartedEvent)
Adds the given listener for the
WaitingStarted event that occurs when the waiting started. |
void |
cancel()
Called by the client to unconditionally cancel all editing.
|
boolean |
canStartWaiting()
Returns if this mode can request the mutex when
Waiting is set to true. |
protected void |
endWaiting()
Called when waiting is finished.
|
protected ConcurrencyController |
getController()
Returns the installed
Controller. |
IInputModeContext |
getInputModeContext()
Returns the context instance this mode is currently installed in or
null if this instance is not installed. |
int |
getPriority()
The priority of this input mode.
|
Cursor |
getWaitCursor()
Gets the WaitCursor property.
|
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the given context that is provided by the canvas.
|
boolean |
isEnabled()
Gets the enabled state of this input mode.
|
boolean |
isWaiting()
Gets the Waiting property.
|
protected void |
onCanceled()
Called after
cancel() has been called. |
protected void |
onConcurrencyControllerActivated()
|
protected void |
onConcurrencyControllerDeactivated()
|
protected void |
onStopped()
Called after
stop() has been called. |
protected void |
onWaitingEnded(InputModeEventArgs inputModeEventArgs)
Raises the
WaitingEnded event. |
protected void |
onWaitingStarted(InputModeEventArgs inputModeEventArgs)
Raises the
WaitingStarted event. |
void |
removeWaitingEndedListener(IEventHandler<InputModeEventArgs> waitingEndedEvent)
Removes the given listener for the
WaitingEnded event that occurs when the waiting ended. |
void |
removeWaitingStartedListener(IEventHandler<InputModeEventArgs> waitingStartedEvent)
Removes the given listener for the
WaitingStarted event that occurs when the waiting started. |
void |
setEnabled(boolean value)
Sets the enabled state of this input mode.
|
void |
setPriority(int value)
The priority of this input mode.
|
void |
setWaitCursor(Cursor value)
Sets the WaitCursor property.
|
void |
setWaiting(boolean value)
Sets the Waiting property.
|
protected void |
startWaiting()
This will initiate the waiting process by trying to
ConcurrencyController.requestMutex()request the input mutex. |
boolean |
stop()
Called by the client in order to stop a current editing progress.
|
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
public final void addWaitingEndedListener(IEventHandler<InputModeEventArgs> waitingEndedEvent)
WaitingEnded event that occurs when the waiting ended.waitingEndedEvent - The listener to add.removeWaitingEndedListener(IEventHandler)public final void addWaitingStartedListener(IEventHandler<InputModeEventArgs> waitingStartedEvent)
WaitingStarted event that occurs when the waiting started.waitingStartedEvent - The listener to add.removeWaitingStartedListener(IEventHandler)public void cancel()
IInputModeThis will be called prior to the uninstalling of this instance.
In order to stop an active input mode manually, client code should use the following idiom:
cancel in interface IInputModepublic boolean canStartWaiting()
Waiting is set to true.Waiting is set to true.protected void endWaiting()
This will reset the PreferredCursor and
the mutex is released.
protected final ConcurrencyController getController()
Controller.public final IInputModeContext getInputModeContext()
IInputModenull if this instance is not installed.
Note that this instance should not be passed down to subordinate modes or instances. Instead a corresponding context
that has this instance set as the ParentInputMode should be used.
getInputModeContext in interface IInputModepublic final int getPriority()
IInputMode
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
getPriority in interface IInputModepublic final Cursor getWaitCursor()
setWaitCursor(Cursor)public void install(IInputModeContext context, ConcurrencyController controller)
In general a mode can only be installed into a single canvas at all times.
This method is called to initialize this instance. Subclasses should override this method to register the corresponding event handler delegates for the various input events they need to register with.
Overriding implementations should call the base implementation, first.
install in interface IInputModecontext - The context that this instance shall be installed into. The same instance will be passed to this instance during
IInputMode.uninstall(IInputModeContext). A reference to the context may be kept and queried during the time
the mode is installed.controller - The Controller for this mode.IInputMode.uninstall(IInputModeContext)public boolean isEnabled()
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller so a disabled instance should never try to acquire the
input mutex.
setEnabled(boolean)public final boolean isWaiting()
Setting this property to true will start the waiting process. Setting it to false
will end the waiting.
setWaiting(boolean)protected void onCanceled()
cancel() has been called.
Can be overridden in subclasses to perform additional actions after the mode has been canceled.
This implementation does nothing.
protected void onConcurrencyControllerActivated()
Active property of the installed ConcurrencyController
has been set to true.
Can be overridden in subclasses to perform additional actions after the mode has been activated.
Overriding implementations should call the base implementation.
protected void onConcurrencyControllerDeactivated()
Active property of the installed ConcurrencyController
has been set to false.
Can be overridden in subclasses to perform additional actions after the mode has been deactivated.
Overriding implementations should call the base implementation.
protected void onStopped()
stop() has been called.
Can be overridden in subclasses to perform additional actions after the mode has been stopped.
This implementation does nothing.
protected void onWaitingEnded(InputModeEventArgs inputModeEventArgs)
WaitingEnded event.inputModeEventArgs - The InputModeEventArgs instance containing the event data.protected void onWaitingStarted(InputModeEventArgs inputModeEventArgs)
WaitingStarted event.inputModeEventArgs - The InputModeEventArgs instance containing the event data.public final void removeWaitingEndedListener(IEventHandler<InputModeEventArgs> waitingEndedEvent)
WaitingEnded event that occurs when the waiting ended.waitingEndedEvent - The listener to remove.addWaitingEndedListener(IEventHandler)public final void removeWaitingStartedListener(IEventHandler<InputModeEventArgs> waitingStartedEvent)
WaitingStarted event that occurs when the waiting started.waitingStartedEvent - The listener to remove.addWaitingStartedListener(IEventHandler)public void setEnabled(boolean value)
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller so a disabled instance should never try to acquire the
input mutex.
value - The Enabled to set.isEnabled()public final void setPriority(int value)
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
value - The Priority to set.getPriority()public final void setWaitCursor(Cursor value)
value - The WaitCursor to set.getWaitCursor()public final void setWaiting(boolean value)
Setting this property to true will start the waiting process. Setting it to false
will end the waiting.
value - The Waiting to set.isWaiting()protected void startWaiting()
ConcurrencyController.requestMutex()request the input mutex.
This will set the PreferredCursor to WaitCursor
and set the Editable property of the canvas to false.
public boolean stop()
IInputMode
This should stop the current edit, if one is in progress and possibly commit all of the changes. If stopping is not
possible, this method can return false
stop in interface IInputModetrue if and only if the editing has been stopped or there was no edit in progressIInputMode.cancel()public void uninstall(IInputModeContext context)
This code should clean up all changes made to the canvas in the IInputMode.install(IInputModeContext, ConcurrencyController)
method. After a mode has been uninstalled it can be installed again into the same or another canvas.
Overriding implementations should call the base implementation after their own code.
uninstall in interface IInputModecontext - The context to deregister from. This is the same instance that had been passed to IInputMode.install(IInputModeContext, ConcurrencyController)
during installation.