org.tbee.swing
Class SwingWorker<T,V>

java.lang.Object
  extended by org.tbee.swing.SwingWorker<T,V>
Type Parameters:
T - the result type returned by this SwingWorker's doInBackground and get methods
V - the type used for carrying out intermediate results by this SwingWorker's publish and process methods
Direct Known Subclasses:
SwingWorker

public abstract class SwingWorker<T,V>
extends Object

Extended SwingWorker; with progress monitor, exception handling, etc. Use "execute()" to start. Usage: new SwingWorker(c, "Title", 1) // this constructor also creates a progress monitor {


Constructor Summary
SwingWorker()
          just a worker
SwingWorker(Component parentComponent, String message, int number)
          with progress monitor
 
Method Summary
protected abstract  T doInBackground()
          Computes a result, or throws an exception if unable to do so.
protected  T doInBackgroundWrapped()
          This method is use to wrap the call to doInBackground()
protected  void done()
          Executed on the Event Dispatch Thread after the doInBackground method is finished.
protected  boolean exceptionThrown(Throwable t)
          an exception occurred
 void execute()
          Schedules this SwingWorker for execution on a worker thread.
 T get()
          Same as get() but catches the exceptions and wraps them into RuntimeException
 nl.knowledgeplaza.util.ProgressListener getProgressListener(int idx)
          ProgressListener
 ProgressMonitorMulti getProgressMonitorMulti()
          ProgressMonitorMulti
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingWorker

public SwingWorker()
just a worker


SwingWorker

public SwingWorker(Component parentComponent,
                   String message,
                   int number)
with progress monitor

Method Detail

getProgressMonitorMulti

public ProgressMonitorMulti getProgressMonitorMulti()
ProgressMonitorMulti


getProgressListener

public nl.knowledgeplaza.util.ProgressListener getProgressListener(int idx)
ProgressListener


exceptionThrown

protected boolean exceptionThrown(Throwable t)
an exception occurred

Returns:
show error dialog

doInBackground

protected abstract T doInBackground()
                             throws Exception
Computes a result, or throws an exception if unable to do so. The exception will popup an error dialog and then be rethrown.

Throws:
Exception

doInBackgroundWrapped

protected T doInBackgroundWrapped()
                           throws Exception
This method is use to wrap the call to doInBackground()

Returns:
Throws:
Exception

execute

public void execute()
Schedules this SwingWorker for execution on a worker thread.


done

protected void done()
Executed on the Event Dispatch Thread after the doInBackground method is finished.


get

public T get()
Same as get() but catches the exceptions and wraps them into RuntimeException

Returns:


Copyright © 2012 KnowledgePlaza. All Rights Reserved.