public class DefaultProgressMonitor extends java.lang.Object implements IProgressMonitor
Logger
with level Level.INFO
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
subTask |
protected java.lang.String |
taskName |
protected int |
totalWork |
protected double |
workDone |
UNKNOWN
Modifier | Constructor and Description |
---|---|
protected |
DefaultProgressMonitor() |
Modifier and Type | Method and Description |
---|---|
void |
beginTask(java.lang.String taskName,
int totalWork)
Notifies that the main task is beginning.
|
void |
done()
Notifies that the work is done; that is, either the main task is completed
or the user canceled it.
|
java.io.Serializable |
getFeedback()
Returns the most recently set feedback object
|
boolean |
getIsWaitingForFeedback()
Boolean flag to indicate whether the monitor is
waiting for feedback
|
java.lang.String |
getOwner()
Returns the user who started the monitored job
|
java.lang.Double |
getPercentage()
Percentage of work done.
|
java.math.BigDecimal |
getPercentageRounded(int scale) |
boolean |
hasFeedbackWaitTimedOut() |
void |
internalWorked(double work)
Internal method to handle scaling correctly.
|
void |
interrupt() |
boolean |
isCanceled()
Returns whether cancelation of current operation has been requested.
|
static DefaultProgressMonitor |
NewInstance() |
void |
setCanceled(boolean isCanceled)
Sets the cancel state to the given value.
|
void |
setFeedback(java.io.Serializable feedback)
Sets the feedback object the monitor is currently waiting for.
|
void |
setOwner(java.lang.String owner)
Sets the user who started the monitored job
|
void |
setTaskName(java.lang.String taskName)
Sets the task name to the given value.
|
void |
subTask(java.lang.String subTask)
Notifies that a subtask of the main task is beginning.
|
void |
waitForFeedback()
Waits for external feedback during the lifetime of the
operation
|
void |
waitForFeedback(long feedbackWaitTimeout)
Waits for external feedback during the lifetime of the
operation with given timeout
|
void |
warning(java.lang.String warning)
Notifies about a warning
|
void |
warning(java.lang.String warning,
java.lang.Throwable exception)
Notifies about a warning that was caused by an exception.
|
void |
worked(int work)
Notifies that a given number of work unit of the main task
has been completed.
|
protected java.lang.String taskName
protected int totalWork
protected double workDone
protected java.lang.String subTask
public static final DefaultProgressMonitor NewInstance()
public void beginTask(java.lang.String taskName, int totalWork)
IProgressMonitor
beginTask
in interface IProgressMonitor
taskName
- the name (or description) of the main tasktotalWork
- the total number of work units into which
the main task is been subdivided. If the value is UNKNOWN
the implementation is free to indicate progress in a way which
doesn't require the total number of work units in advance.public void done()
IProgressMonitor
done
in interface IProgressMonitor
public boolean isCanceled()
IProgressMonitor
isCanceled
in interface IProgressMonitor
true
if cancellation has been requested,
and false
otherwiseIProgressMonitor.setCanceled(boolean)
public void setCanceled(boolean isCanceled)
IProgressMonitor
setCanceled
in interface IProgressMonitor
isCanceled
- true
indicates that cancelation has
been requested (but not necessarily acknowledged);
false
clears this flagIProgressMonitor.isCanceled()
public void setTaskName(java.lang.String taskName)
IProgressMonitor
setTaskName
in interface IProgressMonitor
taskName
- the name (or description) of the main taskIProgressMonitor.beginTask(java.lang.String, int)
public void subTask(java.lang.String subTask)
IProgressMonitor
subTask
in interface IProgressMonitor
subTask
- the name (or description) of the subtaskpublic void worked(int work)
IProgressMonitor
worked
in interface IProgressMonitor
work
- a non-negative number of work units just completedpublic void internalWorked(double work)
IProgressMonitor
internalWorked
in interface IProgressMonitor
work
- the amount of work donepublic void warning(java.lang.String warning)
IProgressMonitor
warning
in interface IProgressMonitor
public void warning(java.lang.String warning, java.lang.Throwable exception)
IProgressMonitor
warning
in interface IProgressMonitor
public java.lang.Double getPercentage()
SubProgressMonitor
the result is rounded to 5 digits.
So do not use the result for additive percentages.public java.math.BigDecimal getPercentageRounded(int scale)
public void waitForFeedback()
waitForFeedback
in interface IProgressMonitor
public void setFeedback(java.io.Serializable feedback)
setFeedback
in interface IProgressMonitor
public java.io.Serializable getFeedback()
getFeedback
in interface IProgressMonitor
public boolean getIsWaitingForFeedback()
getIsWaitingForFeedback
in interface IProgressMonitor
public void waitForFeedback(long feedbackWaitTimeout)
waitForFeedback
in interface IProgressMonitor
feedbackWaitTimeout
- time (in ms to wait for feedback)public boolean hasFeedbackWaitTimedOut()
hasFeedbackWaitTimedOut
in interface IProgressMonitor
public java.lang.String getOwner()
getOwner
in interface IProgressMonitor
public void setOwner(java.lang.String owner)
setOwner
in interface IProgressMonitor
owner
- the user who started the monitored jobpublic void interrupt()
interrupt
in interface IProgressMonitor
Copyright © 2007-2020 EDIT. All Rights Reserved.