|
JHotDraw 7.5.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.gui.Worker<T>
public abstract class Worker<T>
This is an abstract class that you can subclass to perform GUI-related work in a dedicated event dispatcher.
This class is similar to SwingWorker but less complex.
Constructor Summary | |
---|---|
Worker()
|
Method Summary | |
---|---|
protected abstract T |
construct()
Compute the value to be returned by the get method. |
protected void |
done(T value)
Called on the event dispatching thread (not on the worker thread) after the construct method has returned without throwing
an error. |
protected void |
failed(java.lang.Throwable error)
Called on the event dispatching thread (not on the worker thread) after the construct method has thrown an error. |
protected void |
finished()
Called on the event dispatching thread (not on the worker thread) after the construct method has finished and after
done() or failed() has been invoked. |
protected java.lang.Throwable |
getError()
Get the error produced by the worker thread, or null if it hasn't thrown one. |
protected T |
getValue()
Get the value produced by the worker thread, or null if it hasn't been constructed yet. |
void |
run()
Calls #construct on the current thread and invokes #done on the AWT event dispatcher thread. |
void |
start()
Starts the Worker on an internal worker thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Worker()
Method Detail |
---|
public final void run()
run
in interface java.lang.Runnable
protected abstract T construct() throws java.lang.Exception
get
method.
java.lang.Exception
protected void done(T value)
construct
method has returned without throwing
an error.
The default implementation does nothing. Subclasses may override this method to perform done actions on the Event Dispatch Thread.
value
- The return value of the construct method.protected void failed(java.lang.Throwable error)
construct
method has thrown an error.
The default implementation prints a stack trace. Subclasses may override this method to perform failure actions on the Event Dispatch Thread.
error
- The error thrown by construct.protected void finished()
construct
method has finished and after
done() or failed() has been invoked.
The default implementation does nothing. Subclasses may override this method to perform completion actions on the Event Dispatch Thread.
protected T getValue()
protected java.lang.Throwable getError()
public void start()
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |