|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectEDU.oswego.cs.dl.util.concurrent.FutureResult
org.springframework.richclient.util.SwingWorker
public abstract class SwingWorker
An abstract class that you subclass to perform GUI-related work in a dedicated thread.
This class was adapted from the SwingWorker class presented in "Using a Swing Worker Thread" in the Swing Connection archives http://java.sun.com/products/jfc/tsc/archive/archive.html
This version of SwingWorker extends FutureResult and implements Runnable. Timeouts are supported.
Field Summary | |
---|---|
protected Thread |
thread
Worker thread. |
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.FutureResult |
---|
exception_, ready_, value_ |
Constructor Summary | |
---|---|
SwingWorker()
|
Method Summary | |
---|---|
void |
clear()
Clears the worker thread variable and the FutureResult state, allowing this SwingWorker to be reused. |
protected abstract Object |
construct()
Computes the value to be returned by the get method. |
protected void |
finished()
Called on the event dispatching thread (not on the worker thread) after the construct method has returned. |
protected Object |
getFinishedResult()
|
protected Throwable |
getTargetException()
|
long |
getTimeout()
Override to return a timeout period, in milliseconds. |
void |
interrupt()
Stops the worker and sets the exception to InterruptedException. |
void |
run()
Calls the construct method to compute the result, and then
invokes the finished method on the event dispatch thread. |
void |
start()
Starts the worker thread. |
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.FutureResult |
---|
doGet, get, getException, isReady, peek, set, setException, setter, timedGet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Thread thread
Constructor Detail |
---|
public SwingWorker()
Method Detail |
---|
protected abstract Object construct() throws Exception
get
method.
Exception
protected void finished()
construct
method has returned.
protected Object getFinishedResult()
protected Throwable getTargetException()
public long getTimeout()
0
(default).
public void run()
construct
method to compute the result, and then
invokes the finished
method on the event dispatch thread.
run
in interface Runnable
public void start()
public void interrupt()
public void clear()
clear
in class EDU.oswego.cs.dl.util.concurrent.FutureResult
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |