|
Watchmaker Framework for Evolutionary Computation API (Version 0.7.1) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.uncommons.swing.SwingBackgroundTask<V>
V
- Type of result generated by the task.public abstract class SwingBackgroundTask<V>
A task that is executed on a background thread and then updates a Swing GUI. A task may only be executed once.
Constructor Summary | |
---|---|
protected |
SwingBackgroundTask()
|
Method Summary | |
---|---|
void |
execute()
Asynchronous call that begins execution of the task and returns immediately. |
protected void |
onError(Throwable throwable)
This method is invoked, on the Event Dispatch Thread, if there is an exception or error executing the performTask() method. |
protected abstract V |
performTask()
Performs the processing of the task and returns a result. |
protected void |
postProcessing(V result)
This method is invoked, on the Event Dispatch Thread, after the task has been executed. |
void |
waitForCompletion()
Waits for the execution of this task to complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SwingBackgroundTask()
Method Detail |
---|
public void execute()
performTask()
method will be invoked on a background thread and,
when it has completed, postProcessing(Object)
will be invoked on the
Event Dispatch Thread (or, if there is an exception, onError(Throwable)
will be invoked instead - also on the EDT).
performTask()
,
postProcessing(Object)
,
onError(Throwable)
,
waitForCompletion()
public void waitForCompletion() throws InterruptedException
execute()
method has not yet been invoked, this method will block indefinitely.
InterruptedException
- If the thread executing the task
is interrupted.protected abstract V performTask() throws Exception
Exception
- The task may throw an exception, in which case
the onError(Throwable)
method will be invoked instead of
postProcessing(Object)
.protected void postProcessing(V result)
result
- The result from the performTask()
method.protected void onError(Throwable throwable)
performTask()
method.
This default implementation displays a message dialog with details of the
exception. It may be over-ridden in sub-classes.
throwable
- The exception or error that was thrown while executing
the task.
|
Watchmaker Framework for Evolutionary Computation API (Version 0.7.1) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |