public interface UiDispatcher
UiContext.getDispatcher()| 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. |
void |
invokeAsynchron(Runnable task)
This method
invokes the given task asynchronous in the dispatcher
thread of the UI. |
<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. |
void |
invokeTimer(Callable<Boolean> task,
int delayMilliseconds)
This method
invokes the given task periodically. |
void |
invokeTimer(Runnable task,
int delayMilliseconds)
This method
invokes the given task asynchronous after the given
dalay. |
boolean |
isDispatchThread()
This method checks if the
"current thread" is the dispatcher thread of the
underlying UI toolkit. |
boolean |
sleep()
This method puts the UI thread to sleep until a event to
dispatch is
received or it is awakened. |
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. sleep(). true if there is more work to do, false if it is safe to
sleep for a short while.boolean sleep()
dispatch is
received or it is awakened.true if an event to dispatch was received, false
otherwise.boolean isDispatchThread()
"current thread" is the dispatcher thread of the
underlying UI toolkit.true if this method was invoked within the dispatcher thread, false
otherwise.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.task - is the job to invoke.void invokeAsynchron(Runnable task)
invokes the given task asynchronous in the dispatcher
thread of the UI. The term "asynchronous" means that this method may return before the task
is invoked. If there is NO dispatcher thread in the underlying UI implementation, the task
may simply be invoked directly in the implementation of this method.task - is the job to invoke.void invokeTimer(Runnable task, int delayMilliseconds)
invokes the given task asynchronous after the given
dalay.task - is the job to invoke.delayMilliseconds - is the delay in milliseconds when the task shall be executed.void invokeTimer(Callable<Boolean> task, int delayMilliseconds)
invokes the given task periodically. The first
invocation is performed after the given delay. Every time the task
returns true, another invocation is performed after the same
delay until false is returned.task - is the job to invoke.delayMilliseconds - is the periodically delay in milliseconds when the task shall be
executed.<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.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.