Package com.bc.ceres.swing.progress
Class ProgressMonitorSwingWorker<T,V>
- java.lang.Object
-
- javax.swing.SwingWorker<T,V>
-
- com.bc.ceres.swing.progress.ProgressMonitorSwingWorker<T,V>
-
- All Implemented Interfaces:
Runnable
,Future<T>
,RunnableFuture<T>
public abstract class ProgressMonitorSwingWorker<T,V> extends SwingWorker<T,V>
A swing worker which may pop-up a progress monitor dialog.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.SwingWorker
SwingWorker.StateValue
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProgressMonitorSwingWorker(Component parentComponent, String title)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected T
doInBackground()
Overridden in order to call thedoInBackground
method with aProgressMonitor
.protected abstract T
doInBackground(ProgressMonitor pm)
Computes a result, or throws an exception if unable to do so.void
executeWithBlocking()
Similar to theSwingWorker.execute()
method, but blocks the current thread until this worker computed its result.-
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, done, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
-
-
-
-
Method Detail
-
doInBackground
protected final T doInBackground() throws Exception
Overridden in order to call thedoInBackground
method with aProgressMonitor
.- Specified by:
doInBackground
in classSwingWorker<T,V>
- Returns:
- the computed result
- Throws:
Exception
- if unable to compute a result
-
doInBackground
protected abstract T doInBackground(ProgressMonitor pm) throws Exception
Computes a result, or throws an exception if unable to do so.Note that this method is executed only once in a background thread.
- Parameters:
pm
- the progress monitor- Returns:
- the computed result
- Throws:
Exception
- if unable to compute a result
-
executeWithBlocking
public final void executeWithBlocking()
Similar to theSwingWorker.execute()
method, but blocks the current thread until this worker computed its result. However, this method will not block the Event Dispatch Thread.
-
-