public abstract class AbstractProgressMonitor extends java.lang.Object implements ProgressMonitor
ProgressMonitor.| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractProgressMonitor.Request |
static class |
AbstractProgressMonitor.State
Progress monitor state
|
ProgressMonitor.CancelListener| Modifier and Type | Field and Description |
|---|---|
private CancelHandler |
cancelHandler |
private int |
childTicks |
private AbstractProgressMonitor |
currentChild |
private java.lang.String |
customText |
private java.lang.String |
extraText |
private boolean |
intermediateTask |
private AbstractProgressMonitor.Request |
requestedState |
private java.util.Queue<AbstractProgressMonitor.Request> |
requests |
private java.lang.String |
shownCustomText |
private java.lang.String |
shownTitle |
protected AbstractProgressMonitor.State |
state |
private java.lang.String |
taskTitle |
private int |
ticks |
private int |
ticksCount |
ALL_TICKS, DEFAULT_TICKS| Modifier | Constructor and Description |
|---|---|
protected |
AbstractProgressMonitor(CancelHandler cancelHandler)
Create a new
AbstractProgressMonitor |
| Modifier and Type | Method and Description |
|---|---|
void |
addCancelListener(ProgressMonitor.CancelListener listener)
Add listener for user abort action
|
void |
appendLogMessage(java.lang.String message)
Default implementation is empty.
|
private void |
applyChildRequest(AbstractProgressMonitor.Request request) |
private void |
applyThisRequest(AbstractProgressMonitor.Request request) |
void |
beginTask(java.lang.String title)
Starts this progress monitor.
|
void |
beginTask(java.lang.String title,
int ticks)
Starts this progress monitor.
|
void |
cancel()
Abort current operation, usually called when user somehow requested an abort
|
protected void |
checkState(AbstractProgressMonitor.State... expectedStates) |
protected void |
childFinished(AbstractProgressMonitor child) |
protected void |
childSetCustomText(AbstractProgressMonitor child,
java.lang.String customText) |
protected void |
childSetIntermediate(AbstractProgressMonitor child,
boolean value) |
protected void |
childSetProgress(AbstractProgressMonitor child,
double value) |
protected void |
childSetTitle(AbstractProgressMonitor child,
java.lang.String title) |
ProgressMonitor |
createSubTaskMonitor(int ticks,
boolean internal)
Creates subtasks monitor.
|
protected abstract void |
doBeginTask() |
protected abstract void |
doFinishTask() |
protected abstract void |
doSetCustomText(java.lang.String title) |
protected abstract void |
doSetIntermediate(boolean value) |
protected abstract void |
doSetTitle(java.lang.String title) |
void |
finishTask()
Finish this progress monitor, close the dialog or inform the parent progress monitor
that it can continue with other tasks.
|
private AbstractProgressMonitor.Request |
getRequest(AbstractProgressMonitor child) |
int |
getTicks()
Get the current number of work units
|
int |
getTicksCount()
Get the total number of work units
|
void |
indeterminateSubTask(java.lang.String title)
Subtask that will show progress running back and forth
|
private void |
internalUpdateProgress(double childProgress) |
void |
invalidate()
Can be used if method receive ProgressMonitor but it's not interested progress monitoring.
|
boolean |
isCanceled()
Returns the state of user aborts
|
void |
removeCancelListener(ProgressMonitor.CancelListener listener)
Remove listener for user abort action
|
private void |
resetState() |
void |
setCustomText(java.lang.String text)
Shows additional text
|
void |
setExtraText(java.lang.String text)
Show extra text after normal task title.
|
void |
setTicks(int ticks)
Set the current number of work units
|
void |
setTicksCount(int ticks)
Set the total number of work units
|
void |
subTask(java.lang.String title)
Normal subtask
|
protected abstract void |
updateProgress(double value) |
void |
worked(int ticks)
Increase number of already done work units by ticks
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProgressTaskId, getWindowParent, setProgressTaskIdprivate final CancelHandler cancelHandler
protected AbstractProgressMonitor.State state
private int ticksCount
private int ticks
private int childTicks
private java.lang.String taskTitle
private java.lang.String customText
private java.lang.String extraText
private java.lang.String shownTitle
private java.lang.String shownCustomText
private boolean intermediateTask
private final java.util.Queue<AbstractProgressMonitor.Request> requests
private AbstractProgressMonitor currentChild
private AbstractProgressMonitor.Request requestedState
protected AbstractProgressMonitor(CancelHandler cancelHandler)
AbstractProgressMonitorcancelHandler - The handler that gets notified when the process is canceled.protected abstract void doBeginTask()
protected abstract void doFinishTask()
protected abstract void doSetIntermediate(boolean value)
protected abstract void doSetTitle(java.lang.String title)
protected abstract void doSetCustomText(java.lang.String title)
protected void checkState(AbstractProgressMonitor.State... expectedStates)
public void beginTask(java.lang.String title)
ProgressMonitorbeginTask in interface ProgressMonitortitle - title text of the taskpublic void beginTask(java.lang.String title, int ticks)
ProgressMonitorbeginTask in interface ProgressMonitortitle - title text of the taskticks - number of work units (see ProgressMonitor.setTicksCount(int ticks))public void finishTask()
ProgressMonitorfinishTask in interface ProgressMonitorpublic void invalidate()
ProgressMonitorProgressMonitor.beginTask(String) and ProgressMonitor.finishTask()
This method can be also used in finally section if method expects that some exception
might prevent it from passing progressMonitor away. If ProgressMonitor.beginTask(String) was
already called then this method does nothing.invalidate in interface ProgressMonitorpublic void subTask(java.lang.String title)
ProgressMonitorsubTask in interface ProgressMonitortitle - Can be null, in that case task title is not changedpublic void indeterminateSubTask(java.lang.String title)
ProgressMonitorindeterminateSubTask in interface ProgressMonitortitle - Can be null, in that case task title is not changedpublic void setCustomText(java.lang.String text)
ProgressMonitorsetCustomText in interface ProgressMonitortext - custom textpublic void setExtraText(java.lang.String text)
ProgressMonitorsetExtraText in interface ProgressMonitortext - extra textpublic void appendLogMessage(java.lang.String message)
appendLogMessage in interface ProgressMonitormessage - the log message. Ignored if null or white space only.private void resetState()
public void cancel()
ProgressMonitorcancel in interface ProgressMonitorpublic boolean isCanceled()
ProgressMonitorisCanceled in interface ProgressMonitortrue if user aborted operationpublic void addCancelListener(ProgressMonitor.CancelListener listener)
ProgressMonitoraddCancelListener in interface ProgressMonitorlistener - the listener for cancel operationpublic void removeCancelListener(ProgressMonitor.CancelListener listener)
ProgressMonitorremoveCancelListener in interface ProgressMonitorlistener - the listener for cancel operationprotected abstract void updateProgress(double value)
public void setTicks(int ticks)
ProgressMonitorsetTicks in interface ProgressMonitorticks - Number of work units already donepublic void setTicksCount(int ticks)
ProgressMonitorsetTicksCount in interface ProgressMonitorticks - Number of total work unitspublic void worked(int ticks)
ProgressMonitorworked in interface ProgressMonitorticks - number of ticks to addprivate void internalUpdateProgress(double childProgress)
public int getTicks()
ProgressMonitorgetTicks in interface ProgressMonitorpublic int getTicksCount()
ProgressMonitorgetTicksCount in interface ProgressMonitorpublic ProgressMonitor createSubTaskMonitor(int ticks, boolean internal)
ProgressMonitorcreateSubTaskMonitor in interface ProgressMonitorticks - Number of work units that should be done when subtask finishesinternal - If true then subtask can't modify task title/custom textprivate void applyChildRequest(AbstractProgressMonitor.Request request)
private void applyThisRequest(AbstractProgressMonitor.Request request)
protected void childFinished(AbstractProgressMonitor child)
private AbstractProgressMonitor.Request getRequest(AbstractProgressMonitor child)
protected void childSetProgress(AbstractProgressMonitor child, double value)
protected void childSetTitle(AbstractProgressMonitor child, java.lang.String title)
protected void childSetCustomText(AbstractProgressMonitor child, java.lang.String customText)
protected void childSetIntermediate(AbstractProgressMonitor child, boolean value)