org.af.commons.threading
Class SafeSwingWorker<T,V>

java.lang.Object
  extended by org.jdesktop.swingworker.SwingWorker<T,V>
      extended by org.af.commons.threading.SafeSwingWorker<T,V>
All Implemented Interfaces:
Runnable, Future<T>

public abstract class SafeSwingWorker<T,V>
extends org.jdesktop.swingworker.SwingWorker<T,V>

This SwingWorker handles exceptions thrown by the doInBackground() method. There is also a mechanism for cancellation and message publishing. It divides the done() method in submethods onSuccess(), onFailure() and onCancel() which could be later overridden. You can also register a SwingWorkerObserver, which is notified when the worker thread is done.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jdesktop.swingworker.SwingWorker
org.jdesktop.swingworker.SwingWorker.StateValue
 
Constructor Summary
SafeSwingWorker()
           
 
Method Summary
 void addMsgBufObserver(Observer obs)
          Add an observer to the SwingWorkerMsgBuffer so we can watch the progress of the thread.
 T getAfterDone()
           
 void setObserver(SwingWorkerObserver observer)
          Sets the observer which is notified when the thread is done.
 
Methods inherited from class org.jdesktop.swingworker.SwingWorker
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, removePropertyChangeListener, run
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafeSwingWorker

public SafeSwingWorker()
Method Detail

addMsgBufObserver

public void addMsgBufObserver(Observer obs)
Add an observer to the SwingWorkerMsgBuffer so we can watch the progress of the thread.

Parameters:
obs - obeserver

setObserver

public void setObserver(SwingWorkerObserver observer)
Sets the observer which is notified when the thread is done.

Parameters:
observer - obeserver

getAfterDone

public T getAfterDone()