public class AbstractProgressMonitor extends java.lang.Object implements ProgressMonitor
SIZE_INDETERMINATE
Constructor and Description |
---|
AbstractProgressMonitor() |
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. |
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.
|
java.lang.String |
getProgressMessage()
provide access to the last progress message setting.
|
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 s)
Set a concise string that describes the task being performed.
|
void |
setProgressMessage(java.lang.String message)
Provides additional feedback as to what's going on in the process.
|
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()
return a human-readable representation of the monitor, which is
currently position + "of" + taskSize.
|
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 setProgressMessage(java.lang.String message)
ProgressMonitor
setProgressMessage
in interface ProgressMonitor
message
- the message describing the state of progress.public java.lang.String getProgressMessage()
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 long getTaskProgress()
ProgressMonitor
getTaskProgress
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 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 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 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 setLabel(java.lang.String s)
ProgressMonitor
setLabel
in interface ProgressMonitor
s
- 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 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