T
- the type of result this ProgressWorker
produces.public abstract class ProgressWorker<T>
extends javax.swing.SwingWorker<T,java.lang.Void>
SwingWorker.setProgress(int)
in performBackgroundWork()
to indicate work progress.Modifier and Type | Class and Description |
---|---|
static interface |
ProgressWorker.DialogOwnerProvider
Provides a dialog owner Window.
|
Constructor and Description |
---|
ProgressWorker(ProgressWorker.DialogOwnerProvider dialogOwnerProvider,
java.lang.String progressMessage)
Instantiates a 'indeterminate'
ProgressWorker . |
ProgressWorker(ProgressWorker.DialogOwnerProvider dialogOwnerProvider,
java.lang.String progressMessage,
boolean indeterminate)
Instantiates a
ProgressWorker . |
ProgressWorker(ProgressWorker.DialogOwnerProvider dialogOwnerProvider,
java.lang.String progressMessage,
boolean indeterminate,
javax.swing.JPanel dialogNorthPanel,
ControlSet buttonControls)
Instantiates a
ProgressWorker . |
Modifier and Type | Method and Description |
---|---|
ProgressWorker<T> |
addOnSuccessListener(EventDataListener<T> successListener) |
protected T |
doInBackground()
Displays the progress dialog and performs the background task.
|
protected void |
handleException(java.lang.Throwable throwable)
Displays exception information in a dialog if the exception is not a
CancelException . |
protected void |
handleInterruptedException(java.lang.InterruptedException exception)
Handles an InterruptedException.
|
protected abstract T |
performBackgroundWork()
Performs the background task.
|
public ProgressWorker(ProgressWorker.DialogOwnerProvider dialogOwnerProvider, java.lang.String progressMessage)
ProgressWorker
.dialogOwnerProvider
- provides the dialog ownerprogressMessage
- the message to display while work is in progresspublic ProgressWorker(ProgressWorker.DialogOwnerProvider dialogOwnerProvider, java.lang.String progressMessage, boolean indeterminate)
ProgressWorker
.dialogOwnerProvider
- provides the dialog ownerprogressMessage
- the message to display while work is in progressindeterminate
- if true the progress bar is of type 'indeterminate', otherwise the
progress bar goes from 0 - 100.public ProgressWorker(ProgressWorker.DialogOwnerProvider dialogOwnerProvider, java.lang.String progressMessage, boolean indeterminate, javax.swing.JPanel dialogNorthPanel, ControlSet buttonControls)
ProgressWorker
.dialogOwnerProvider
- provides the dialog ownerprogressMessage
- the message to display while work is in progressindeterminate
- if true the progress bar is of type 'indeterminate', otherwise the
progress bar goes from 0 - 100.dialogNorthPanel
- if specified this panel will be added at the BorderLayout.NORTH
location of the progress dialogbuttonControls
- if specified buttons based on the controls in this control set are added
at the BorderLayout.SOUTH
location of the progress dialogpublic final ProgressWorker<T> addOnSuccessListener(EventDataListener<T> successListener)
successListener
- a listener notified after a successful runProgressWorker
instanceprotected void handleException(java.lang.Throwable throwable)
CancelException
.
Override for customized error handling.throwable
- the exception to handleprotected void handleInterruptedException(java.lang.InterruptedException exception)
exception
- the exceptionprotected final T doInBackground() throws java.lang.Exception
doInBackground
in class javax.swing.SwingWorker<T,java.lang.Void>
java.lang.Exception
- exception resulting from background taskprotected abstract T performBackgroundWork() throws java.lang.Exception
SwingWorker.setProgress(int)
to indicate progress in
case of a determinate progress bar.java.lang.Exception
- exception resulting from background taskSwingWorker.setProgress(int)