public class SubTaskMonitor extends java.lang.Object implements ProgressMonitor
SIZE_INDETERMINATE
Modifier and Type | Method and Description |
---|---|
boolean |
canBeCancelled()
return true if the process appears to support cancel.
|
void |
cancel()
Notifies the
ProgressMonitor that the task
being monitored should be canceled. |
static SubTaskMonitor |
create(ProgressMonitor parent,
boolean cancelChecked)
mode for when parent is indeterminate
|
static SubTaskMonitor |
create(ProgressMonitor parent,
long min,
long max)
create the subtask monitor.
|
static SubTaskMonitor |
create(ProgressMonitor parent,
long min,
long max,
boolean cancelChecked)
create the subtask monitor.
|
void |
finished()
Notifies the
ProgressMonitor that the task
being monitored has finished. |
java.lang.String |
getLabel()
Return the label string displayed, which is a concise string that
describes the task being performed.
|
ProgressMonitor |
getSubtaskMonitor(int start,
int end,
java.lang.String label)
return a monitor to use for a subtask.
|
ProgressMonitor |
getSubtaskMonitor(java.lang.String label)
get the subtask monitor when the current task length is indeterminate.
|
long |
getTaskProgress()
Returns the current progress of the monitored task.
|
long |
getTaskSize()
Return the size of the task.
|
boolean |
isCancelled()
Returns
true if the operation being tracked
should be cancelled. |
boolean |
isFinished()
true if the process has indicated that it is finished
|
boolean |
isStarted()
true if the process has indicated that it has started.
|
void |
setAdditionalInfo(java.lang.String s)
Deprecated.
|
void |
setLabel(java.lang.String label)
Set a concise string that describes the task being performed.
|
void |
setProgressMessage(java.lang.String message)
these messages are lost, unless doEchoToParent is set.
|
void |
setTaskProgress(long position)
Notifies the ProgressMonitor of a change in the progress
of the task.
|
void |
setTaskSize(long taskSize)
Sets the maximum value for the task progress of this
ProgressMonitor . |
void |
started()
Notifies the
ProgressMonitor that the task
being monitored has started. |
java.lang.String |
toString() |
public static SubTaskMonitor create(ProgressMonitor parent, long min, long max)
parent
- parent monitormin
- miniummax
- maximumpublic static SubTaskMonitor create(ProgressMonitor parent, long min, long max, boolean cancelChecked)
parent
- parent monitormin
- miniummax
- maximumcancelChecked
- true if we should check the parent's cancel statuspublic static SubTaskMonitor create(ProgressMonitor parent, boolean cancelChecked)
parent
- cancelChecked
- public void cancel()
ProgressMonitor
ProgressMonitor
that the task
being monitored should be canceled. After this method is
called, implementations should return true
on
any subsequent calls to ProgressMonitor.isCancelled()
and should
throw an IllegalStateException on any subsequent calls to
ProgressMonitor.setTaskProgress(long)
.cancel
in interface ProgressMonitor
public void finished()
ProgressMonitor
ProgressMonitor
that the task
being monitored has finished. This must only be called once, and note that isFinished() must return
the state of this monitor.finished
in interface ProgressMonitor
public boolean isFinished()
ProgressMonitor
isFinished
in interface ProgressMonitor
public long getTaskProgress()
ProgressMonitor
getTaskProgress
in interface ProgressMonitor
public boolean isCancelled()
ProgressMonitor
true
if the operation being tracked
should be cancelled. For example, the human operator has pressed
the cancel button indicating that the process should be stopped. Note
that if the process is not checking the cancel status, the cancel button
should be disabled.isCancelled
in interface ProgressMonitor
true
if the operation being tracked
should be cancelled.@Deprecated public void setAdditionalInfo(java.lang.String s)
ProgressMonitor
setAdditionalInfo
in interface ProgressMonitor
s
- the message, such as (50KB/s)public void setTaskProgress(long position) throws java.lang.IllegalArgumentException
ProgressMonitor
setTaskProgress
in interface ProgressMonitor
position
- the current task positionjava.lang.IllegalArgumentException
- if ProgressMonitor.isCancelled()
returns true or,
possibly if started() has not been called or
finished() has been called.public void setTaskSize(long taskSize)
ProgressMonitor
ProgressMonitor
.setTaskSize
in interface ProgressMonitor
taskSize
- maximum value for the task progress. A taskSize of -1 indicates the taskSize is indeterminate.public long getTaskSize()
ProgressMonitor
getTaskSize
in interface ProgressMonitor
public void started()
ProgressMonitor
ProgressMonitor
that the task
being monitored has started. If the ProgressMonitor
is in a cancelled state when this method is called, that
ProgressMonitor
should be 'uncancelled'.started
in interface ProgressMonitor
public boolean isStarted()
ProgressMonitor
isStarted
in interface ProgressMonitor
public void setLabel(java.lang.String label)
ProgressMonitor
setLabel
in interface ProgressMonitor
label
- the label describing the task.public java.lang.String getLabel()
ProgressMonitor
getLabel
in interface ProgressMonitor
public java.lang.String toString()
toString
in class java.lang.Object
public void setProgressMessage(java.lang.String message)
setProgressMessage
in interface ProgressMonitor
message
- public ProgressMonitor getSubtaskMonitor(int start, int end, java.lang.String label)
ProgressMonitor
getSubtaskMonitor
in interface ProgressMonitor
start
- start position on this monitor.end
- end position on this monitor (exclusive).label
- a label for the subtask, often this is handled as progress message; or null.public ProgressMonitor getSubtaskMonitor(java.lang.String label)
ProgressMonitor
getSubtaskMonitor
in interface ProgressMonitor
label
- a label for the subtask, often this is handled as progress message; or null.public boolean canBeCancelled()
ProgressMonitor
canBeCancelled
in interface ProgressMonitor