public abstract class AbstractUiDispatcher extends AbstractLoggableComponent implements UiDispatcher
UiDispatcher
.Constructor and Description |
---|
AbstractUiDispatcher()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
dispatch()
If you want to support SWT in its intended way (this method delegates to
Display.readAndDispatch ), you need to call this method frequently from a main loop of your
application client. |
<T> T |
invokeSynchron(Callable<T> task)
This method
invokes the given task synchronous in the dispatcher
thread of the UI. |
void |
invokeSynchron(Runnable task)
This method
invokes the given task synchronous in the dispatcher
thread of the UI. |
boolean |
isDispatchThread()
This method checks if the
"current thread" is the dispatcher thread of the
underlying UI toolkit. |
String |
toString() |
createLogger, doInitialize, getLogger
doInitialized, getInitializationState, initialize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invokeAsynchron, invokeTimer, invokeTimer, sleep
public boolean dispatch()
Display.readAndDispatch
), you need to call this method frequently from a main loop of your
application client. For other toolkit implementations this method will simply do nothing. UiDispatcher.sleep()
. dispatch
in interface UiDispatcher
true
if there is more work to do, false
if it is safe to
sleep
for a short while.public boolean isDispatchThread()
"current thread"
is the dispatcher thread of the
underlying UI toolkit.isDispatchThread
in interface UiDispatcher
true
if this method was invoked within the dispatcher thread, false
otherwise.public void invokeSynchron(Runnable task)
invokes
the given task
synchronous in the dispatcher
thread of the UI. The term "synchronous" means that the current thread is suspended and this method will
NOT return before the task is completed. If this method is called in the dispatcher thread or there is NO
dispatcher thread in the underlying UI implementation, the task
may simply be invoked
directly in the implementation of this method.invokeSynchron
in interface UiDispatcher
task
- is the job to invoke
.public <T> T invokeSynchron(Callable<T> task) throws Exception
invokes
the given task
synchronous in the dispatcher
thread of the UI. The term "synchronous" means that the current thread is suspended and this method will
NOT return before the task is completed. If this method is called in the dispatcher thread or there is NO
dispatcher thread in the underlying UI implementation, the task
may simply be invoked
directly in the implementation of this method.invokeSynchron
in interface UiDispatcher
T
- is the templated type of the task result.task
- is the piece of code to be executed synchronous.result
of the task.Exception
- if Callable.call()
throws an exception.Copyright © 2001–2016 mmm-Team. All rights reserved.