public interface EDTUtil
EDTUtil comprises the functionality of:
Modifier and Type | Field and Description |
---|---|
static long |
defaultEDTPollPeriod |
Modifier and Type | Method and Description |
---|---|
long |
getPollPeriod() |
boolean |
invoke(boolean wait,
Runnable task)
Appends task to the EDT task queue if current thread is not EDT,
otherwise execute task immediately.
|
boolean |
invokeStop(boolean wait,
Runnable finalTask)
Append the final task to the EDT task queue,
signals EDT to stop.
|
boolean |
isCurrentThreadEDT()
Returns true if the current thread is the event dispatch thread (EDT).
|
boolean |
isCurrentThreadEDTorNEDT()
|
boolean |
isCurrentThreadNEDT()
Returns true if the current thread is the internal NEWT event dequeue thread (NEDT).
|
boolean |
isRunning() |
void |
setPollPeriod(long ms) |
boolean |
start()
Starts the EDT after it's creation or after
stopping . |
boolean |
waitUntilIdle()
Wait until the EDT task queue is empty.
The last task may still be in execution when this method returns. |
boolean |
waitUntilStopped()
Wait until EDT task is stopped.
No stop action is performed, invokeStop(boolean, java.lang.Runnable) should be used before. |
static final long defaultEDTPollPeriod
long getPollPeriod()
void setPollPeriod(long ms)
ms
- poll period in millisecondsboolean start() throws IllegalStateException
stopping
.
If the EDT is running, it must be stopped
first
and the caller should wait until it's stopped
.
IllegalStateException
- if EDT is running and not subject to be stopped, i.e. isRunning()
returns trueinvokeStop(boolean, java.lang.Runnable)
,
waitUntilStopped()
boolean isCurrentThreadEDT()
The EDT is the platform specific thread dispatching toolkit-events
and executing toolkit-tasks enqueued via invoke(boolean, Runnable)
.
Usually it is the same thread as used to dequeue informal NEWTEvent
s (NEDT), see isCurrentThreadNEDT()
,
however, this may differ, e.g. SWT and AWT implementation.
boolean isCurrentThreadNEDT()
The NEDT is the NEWT thread used to dequeue informal NEWTEvent
s enqueued internally
via DisplayImpl.enqueueEvent(boolean, NEWTEvent)
.
Usually it is the same thread as the EDT, see isCurrentThreadEDT()
,
however, this may differ, e.g. SWT and AWT implementation.
boolean isCurrentThreadEDTorNEDT()
boolean isRunning()
boolean invokeStop(boolean wait, Runnable finalTask)
If wait
is true
methods
blocks until EDT is stopped.
task
maybe null
Due to the nature of this method:
start()
may follow immediately, ie creating a new EDTtask
has been executed or queued for later execution, otherwise falseboolean invoke(boolean wait, Runnable task)
Wait until execution is finished if wait == true
.
task
has been executed or queued for later execution, otherwise falseboolean waitUntilIdle()
boolean waitUntilStopped()
stop
action is performed, invokeStop(boolean, java.lang.Runnable)
should be used before.
If caller thread is EDT or NEDT, this call will not block.
Copyright 2010 JogAmp Community.