|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.microsoft.tfs.util.tasks.NullTaskMonitor
public class NullTaskMonitor
NullTaskMonitor is a do-nothing implementation of the
TaskMonitor interface. Since TaskMonitorService never returns
a null TaskMonitor when one is requested, it returns a
NullTaskMonitor if a TaskMonitor has not been set on the
TaskMonitorService.
NullTaskMonitor is stateless and a singleton instance is shared for
all uses. NullTaskMonitor's implementation of the
TaskMonitor.isCanceled() method always returns false.
Calling setCanceled() does not affect the result of
isCanceled().
| Field Summary | |
|---|---|
static NullTaskMonitor |
INSTANCE
The singleton instance of NullTaskMonitor. |
| Method Summary | |
|---|---|
void |
begin(java.lang.String taskName,
int totalWork)
Called to indicate the start of the task that this TaskMonitor
instance is monitoring. |
void |
beginWithUnknownTotalWork(java.lang.String taskName)
Called to indicate the start of the task that this TaskMonitor
instance is monitoring. |
void |
done()
Called to indicate the end of the task that this TaskMonitor
instance is monitoring. |
boolean |
isCanceled()
Called to test whether cancelation has been requested for the task that this TaskMonitor instance is monitoring. |
TaskMonitor |
newSubTaskMonitor(int amount)
Called to obtain a new TaskMonitor instance to be used in a
sub-task of the task being monitored by this TaskMonitor
instance. |
void |
setCanceled()
Sets the cancel state to true for the task this TaskMonitor is
monitoring. |
void |
setCurrentWorkDescription(java.lang.String description)
Called to set a more detailed description of the current work being done than the task name alone gives. |
void |
setTaskName(java.lang.String taskName)
Called to set the task name of the task being monitored by this TaskMonitor. |
void |
worked(int amount)
Called by the task that this TaskMonitor is monitoring to report
progress. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final NullTaskMonitor INSTANCE
NullTaskMonitor. Note that
NullTaskMonitor is stateless - this instance can be shared for
all uses.
| Method Detail |
|---|
public void begin(java.lang.String taskName,
int totalWork)
TaskMonitor
Called to indicate the start of the task that this TaskMonitor
instance is monitoring. This method is called when the total number of
work units for the task are known.
Either this method or the TaskMonitor.beginWithUnknownTotalWork(String)
method must be called only once per TaskMonitor instance, and one
or the other must be called before other methods on the instance are
called.
begin in interface TaskMonitortaskName - the name of the task that is beginning, or null if
there is no task nametotalWork - the total amount of work units that this task will take (must be
non-negative)public void beginWithUnknownTotalWork(java.lang.String taskName)
TaskMonitor
Called to indicate the start of the task that this TaskMonitor
instance is monitoring. This method is called when the total number of
work units for the task is not known.
Either this method or the TaskMonitor.begin(String, int) method must be
called only once per TaskMonitor instance, and one or the other
must be called before other methods on the instance are called.
beginWithUnknownTotalWork in interface TaskMonitortaskName - the name of the task that is beginning, or null if
there is no task namepublic void done()
TaskMonitor
Called to indicate the end of the task that this TaskMonitor
instance is monitoring. This method must be called, even if the
task aborts with an error or is canceled.
It is safe to call this method multiple times.
done in interface TaskMonitorpublic boolean isCanceled()
TaskMonitor
Called to test whether cancelation has been requested for the task that
this TaskMonitor instance is monitoring.
To be cancelation-aware, the task should poll this method at regular
intervals. If true is returned, the task should return early
as quickly as possible.
isCanceled in interface TaskMonitortrue if cancelation has been requested for this taskpublic void setCanceled()
TaskMonitor
Sets the cancel state to true for the task this TaskMonitor is
monitoring.
setCanceled in interface TaskMonitorpublic TaskMonitor newSubTaskMonitor(int amount)
TaskMonitor
Called to obtain a new TaskMonitor instance to be used in a
sub-task of the task being monitored by this TaskMonitor
instance.
Note that every call to this method results in a new TaskMonitor
instance, and all of the TaskMonitor rules apply to each
instance. Specifically, one of the begin methods should be
called on the new instance, and the TaskMonitor.done() method must be called
on the new instance.
Each sub-TaskMonitor uses up sub number of work units of its
parent TaskMonitor. This number is specified as the
amount argument to this method. The sub-TaskMonitor
will have its own number of total work units (specified by the
TaskMonitor.begin(String, int) method) and internally sub-task progress will
be scaled into main-task progress.
newSubTaskMonitor in interface TaskMonitoramount - the amount of work units of the main task that the sub-task will
use up (must be non-negative)
TaskMonitor instance to be used for a sub-task as
described above (never null)public void setCurrentWorkDescription(java.lang.String description)
TaskMonitor
Called to set a more detailed description of the current work being done
than the task name alone gives. The current work description is an
additional description above and beyond the task name that is specified
in the TaskMonitor.begin(String, int),
TaskMonitor.beginWithUnknownTotalWork(String), and/or
TaskMonitor.setTaskName(String) methods.
Many UI implementations of TaskMonitor will render the task name
as a header and the current work description as a sub-header. Other UI
implementations may choose to ignore the current work description or to
let it override the task name.
setCurrentWorkDescription in interface TaskMonitordescription - the current work description as described above, or
null to clear the current work descriptionpublic void worked(int amount)
TaskMonitorTaskMonitor is monitoring to report
progress. This method is typically called multiple times during the task.
Each time the number of work units that have been completed since the
last call to this method are passed. In other words, the number of work
units reported to this method must be non-cumulative.
worked in interface TaskMonitoramount - a non-negative, non-cumulative amount of work unitspublic void setTaskName(java.lang.String taskName)
TaskMonitorTaskMonitor. Normally there is no reason to call this method,
since the task name is set by either the TaskMonitor.begin(String, int) or
TaskMonitor.beginWithUnknownTotalWork(String) methods and generally remains
constant throughout the lifetime of the task.
setTaskName in interface TaskMonitortaskName - the task name as described above, or null to clear
the task name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||