|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.myJava.util.taskmonitor.TaskMonitor
public class TaskMonitor
This task allows to monitor a task completion.
It also holds multiple listeners for event management.
Field Summary | |
---|---|
protected boolean |
cancellable
Boolean telling whether the current tack can be canceled or not |
protected boolean |
cancelRequested
Tells whether a "cancel" has been requested by the user |
protected double |
currentCompletionRate
Completion rate of the task : between 0 and 1 |
protected TaskMonitor |
currentSubTask
Current subtask |
protected double |
currentSubTaskShare
Part of the subtask in the global task completion (between 0 and 1) |
protected java.util.List |
listeners
Task's listeners |
protected java.lang.String |
name
Task name |
protected TaskMonitor |
parentTask
Parent task (null if no parent task) |
static long |
PAUSE_CHECK_DELAY_MS
|
protected boolean |
pauseRequested
Tells whether a "pause" has been requested by the user |
Constructor Summary | |
---|---|
TaskMonitor(java.lang.String name)
|
Method Summary | |
---|---|
void |
addCompletion(double completionStep)
|
void |
addListener(TaskMonitorListener listener)
Add a new listener |
void |
addNewSubTask(double subTaskShare,
java.lang.String name)
|
void |
checkTaskState()
Checks whether the task has been canceled or paused. |
void |
clearAllListeners()
remove all listeners |
protected void |
completionChanged()
Call all listeners |
void |
enforceCompletion()
Enforces the task's completion. |
TaskMonitor |
getCurrentActiveSubTask()
Returns the really active subtask of the current task. |
double |
getGlobalCompletionRate()
Return the global completion rate of the task Task completion rate + subtask share * subtask global completion rate |
boolean |
isCancellable()
|
boolean |
isCancelRequested()
|
boolean |
isPauseRequested()
|
void |
resetCancellationState()
|
void |
setCancellable(boolean cancellable)
|
void |
setCancelRequested()
|
void |
setCurrentCompletion(double completion)
Enforce the task's global completion rate. |
void |
setCurrentCompletion(long numerator,
long denominator)
|
void |
setCurrentSubTask(TaskMonitor subTask,
double subTaskShare)
Set the current sub task. |
void |
setPauseRequested(boolean pauseRequested)
|
java.lang.String |
toOldString()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long PAUSE_CHECK_DELAY_MS
protected double currentCompletionRate
protected TaskMonitor currentSubTask
protected double currentSubTaskShare
protected TaskMonitor parentTask
protected java.util.List listeners
protected boolean pauseRequested
protected boolean cancellable
protected boolean cancelRequested
protected java.lang.String name
Constructor Detail |
---|
public TaskMonitor(java.lang.String name)
Method Detail |
---|
public void addListener(TaskMonitorListener listener)
listener
- public void clearAllListeners()
public double getGlobalCompletionRate()
public void setCurrentSubTask(TaskMonitor subTask, double subTaskShare)
subTask
- subTaskShare
- is the share of the subtask in the task's global completion (between 0 and 1)public void addNewSubTask(double subTaskShare, java.lang.String name)
public void setCurrentCompletion(double completion)
completion
- public void addCompletion(double completionStep)
public void setCurrentCompletion(long numerator, long denominator)
public void enforceCompletion()
public TaskMonitor getCurrentActiveSubTask()
protected void completionChanged()
public boolean isCancellable()
public boolean isCancelRequested()
public boolean isPauseRequested()
public void setPauseRequested(boolean pauseRequested)
public void setCancelRequested()
public void resetCancellationState()
public void setCancellable(boolean cancellable)
public void checkTaskState() throws TaskCancelledException
TaskCancelledException
public java.lang.String toOldString()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |