Package org.topbraid.jenax.progress
Interface ProgressMonitor
- All Known Implementing Classes:
NullProgressMonitor,SimpleProgressMonitor
public interface ProgressMonitor
Inspired by the Eclipse IProgressMonitor, this interface supports monitoring long-running processes with intermediate
status messages and the ability to cancel.
- Author:
- Holger Knublauch
-
Method Summary
Modifier and TypeMethodDescriptionvoidInforms the progress monitor that a new task has been started, with a given number of expected steps.voiddone()Informs the progress monitor that all is completed.booleanTypically used by the (long-running) process to determine whether the user has requested cancellation.voidsetCanceled(boolean value) Typically called from a parallel thread triggered by the user, this informs the progress monitor that it needs to returntrueforisCanceled.voidsetTaskName(String value) Changes the name or label of the current task.voidSets the label that serves as sub-task, typically printed under the main task name.voidworked(int amount) Informs the progress monitor that one or more steps have been completed towards the current task (seebeginTask).
-
Method Details
-
isCanceled
boolean isCanceled()Typically used by the (long-running) process to determine whether the user has requested cancellation. The process should then find a suitable, clean termination.- Returns:
- true if cancel was requested
-
beginTask
Informs the progress monitor that a new task has been started, with a given number of expected steps. A UI connected to the ProgressMonitor would typically display something like a progress bar and the task name.- Parameters:
label- the name of the tasktotalWork- the number of steps (seeworked) that is expected to be needed to complete the task
-
done
void done()Informs the progress monitor that all is completed. -
setCanceled
void setCanceled(boolean value) Typically called from a parallel thread triggered by the user, this informs the progress monitor that it needs to returntrueforisCanceled. Once a process has been canceled, it should not be un-canceled.- Parameters:
value- true if canceled
-
setTaskName
Changes the name or label of the current task.- Parameters:
value-
-
subTask
Sets the label that serves as sub-task, typically printed under the main task name.- Parameters:
label- the subtask label
-
worked
void worked(int amount) Informs the progress monitor that one or more steps have been completed towards the current task (seebeginTask).- Parameters:
amount- the number of steps completed
-