Package snap.util
Class TaskMonitor
java.lang.Object
snap.props.PropObject
snap.util.TaskMonitor
- All Implemented Interfaces:
PropChange.DoChange
- Direct Known Subclasses:
TaskMonitorPanel
Interface for tracking the progress of arbitrary tasks.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
ConstructorDescriptionConstructor.TaskMonitor
(PrintStream aPrintStream) Constructor for given writer.TaskMonitor
(String aTitle) Constructor for given title. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Begin processing a single task.void
endTask()
Finish the current task, so the next can begin.Returns the next monitor in chain (if this monitor is linked to another).getPropValue
(String aPropName) Override to support props for this class.int
Returns the number of task work units completed.double
Returns the task progress.int
Returns the number of tasks done.int
Returns the total number of tasks.Returns the current task title.int
Returns the total number of task work units.getTitle()
Returns a string to describe task.protected void
Override to support props for this class.boolean
Returns whether the user asked the process to stop working.boolean
Returns whether monitor has finished.protected void
Called when source monitor changes.void
setCancelled
(boolean aValue) Sets whether the user asked the process to stop working.void
setFinished
(boolean aValue) Sets whether monitor has finished.void
setMonitor
(TaskMonitor sourceMonitor) Sets the next monitor in chain (if this monitor is linked to another).void
setPropValue
(String aPropName, Object aValue) Override to support props for this class.protected void
setTaskDone
(int aValue) Sets the number of task work units completed.protected void
setTasksDone
(int aValue) Sets the number of tasks done.protected void
setTasksTotal
(int aValue) Sets the total number of tasks.protected void
setTaskTitle
(String aString) Sets the current task title.protected void
setTaskTotal
(int aValue) Sets the total number of task work units.void
Sets a string to describe task.showProgressPanel
(View aView) Creates a monitor panel to show progress.void
startTasks
(int aTaskCount) Advise the monitor of the total number of subtasks (invoke only once).void
updateTask
(int theWorkDone) Denote that some work units have been completed.Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, clone, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toString, toStringProps
-
Field Details
-
Title_Prop
- See Also:
-
TasksTotal_Prop
- See Also:
-
TasksDone_Prop
- See Also:
-
TaskTotal_Prop
- See Also:
-
TaskDone_Prop
- See Also:
-
TaskTitle_Prop
- See Also:
-
Cancelled_Prop
- See Also:
-
Finished_Prop
- See Also:
-
-
Constructor Details
-
TaskMonitor
public TaskMonitor()Constructor. -
TaskMonitor
Constructor for given title. -
TaskMonitor
Constructor for given writer.
-
-
Method Details
-
getTitle
Returns a string to describe task. -
setTitle
Sets a string to describe task. -
getTasksTotal
public int getTasksTotal()Returns the total number of tasks. -
setTasksTotal
protected void setTasksTotal(int aValue) Sets the total number of tasks. -
getTasksDone
public int getTasksDone()Returns the number of tasks done. -
setTasksDone
protected void setTasksDone(int aValue) Sets the number of tasks done. -
getTaskTotal
public int getTaskTotal()Returns the total number of task work units. -
setTaskTotal
protected void setTaskTotal(int aValue) Sets the total number of task work units. -
getTaskDone
public int getTaskDone()Returns the number of task work units completed. -
setTaskDone
protected void setTaskDone(int aValue) Sets the number of task work units completed. -
getTaskTitle
Returns the current task title. -
setTaskTitle
Sets the current task title. -
startTasks
public void startTasks(int aTaskCount) Advise the monitor of the total number of subtasks (invoke only once). -
beginTask
Begin processing a single task. -
updateTask
public void updateTask(int theWorkDone) Denote that some work units have been completed. -
endTask
public void endTask()Finish the current task, so the next can begin. -
isCancelled
public boolean isCancelled()Returns whether the user asked the process to stop working. -
setCancelled
public void setCancelled(boolean aValue) Sets whether the user asked the process to stop working. -
isFinished
public boolean isFinished()Returns whether monitor has finished. -
setFinished
public void setFinished(boolean aValue) Sets whether monitor has finished. -
getMonitor
Returns the next monitor in chain (if this monitor is linked to another). -
setMonitor
Sets the next monitor in chain (if this monitor is linked to another). -
getTaskProgress
public double getTaskProgress()Returns the task progress. -
showProgressPanel
Creates a monitor panel to show progress. -
monitorDidChange
Called when source monitor changes. -
initProps
Override to support props for this class.- Overrides:
initProps
in classPropObject
-
getPropValue
Override to support props for this class.- Overrides:
getPropValue
in classPropObject
-
setPropValue
Override to support props for this class.- Overrides:
setPropValue
in classPropObject
-