T
- the result type returned by this SwingWorker's
doInBackground
and get
methodsV
- the type used for carrying out intermediate results by this
SwingWorker's
publish
and process
methodspublic abstract class Worker<T,V> extends SwingWorker<T,V>
reportProgress(int)
SwingWorker.StateValue
Modifier and Type | Field and Description |
---|---|
static String |
JOB_PHASE
The job phase property name
|
static String |
PHASE_LENGTH
The phase length property name
|
static String |
PROGRESS_PROPERTY_NAME
The progress property name of the SwingWorker (Should have been defined in SwingWorker by Oracle ?)
|
static String |
STATE_PROPERTY_NAME
The state property name of the SwingWorker (Should have been defined in SwingWorker by Oracle ?)
|
Constructor and Description |
---|
Worker()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected T |
doInBackground()
Overrides the SwingWorker doInBackground method to force the worker
to notify all threads waiting on this object (by invoking this.wait()) when the
processing is finished.
|
protected abstract T |
doProcessing()
Performs the task processing and gets its result.
|
String |
getPhase()
Gets the current phase's title.
|
int |
getPhaseLength()
Gets the current phase's length.
|
boolean |
isFinished()
Tests whether the doProcessing method has ended.
|
void |
reportProgress(int progress)
Sets the progress of the current phase.
|
protected void |
setPhase(String phase,
int phaseLength)
Sets the phase.
|
protected void |
setPhaseLength(int phaseLength)
Sets the phase length.
|
addPropertyChangeListener, cancel, done, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
public static final String STATE_PROPERTY_NAME
public static final String PROGRESS_PROPERTY_NAME
public static final String JOB_PHASE
public static final String PHASE_LENGTH
public Worker()
protected void setPhase(String phase, int phaseLength)
phase
- The phase titlephaseLength
- The phase length (a negative number means the length is indeterminate).protected void setPhaseLength(int phaseLength)
phaseLength
- The phase length (a negative number means the length is indeterminate)public String getPhase()
public int getPhaseLength()
public void reportProgress(int progress)
progress
- The current progresssetPhaseLength(int)
protected final T doInBackground() throws Exception
doInBackground
in class SwingWorker<T,V>
Exception
protected abstract T doProcessing() throws Exception
Exception
- if a error occurs.public boolean isFinished()
Copyright © 2022. All rights reserved.