Package net.ssehub.easy.basics.progress
Class BasicProgressObserver
- java.lang.Object
-
- net.ssehub.easy.basics.progress.ProgressObserver
-
- net.ssehub.easy.basics.progress.BasicProgressObserver
-
- Direct Known Subclasses:
EclipseProgressObserver,EclipseProgressObserver
public class BasicProgressObserver extends ProgressObserver
A basic, eclipse-like progress observer.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBasicProgressObserver.IProgressMonitorSimple progress monitor interface.private static classBasicProgressObserver.TaskRepresentation of a task, which will be observed by theBasicProgressObserver.IProgressMonitor.-
Nested classes/interfaces inherited from class net.ssehub.easy.basics.progress.ProgressObserver
ProgressObserver.ISubtask, ProgressObserver.ITask
-
-
Field Summary
Fields Modifier and Type Field Description private BasicProgressObserver.IProgressMonitormonitorprivate BasicProgressObserver.Taskparentprivate java.util.List<BasicProgressObserver.Task>subtasks-
Fields inherited from class net.ssehub.easy.basics.progress.ProgressObserver
NO_OBSERVER, NO_SUBTASK
-
-
Constructor Summary
Constructors Constructor Description BasicProgressObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnotifyEnd(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask)Notifies about ending a (sub)task.voidnotifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step, int max)Notifies about processing a task or a subtask.voidnotifyStart(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int max)Notifies about starting a (sub)task.voidregister(BasicProgressObserver.IProgressMonitor monitor)Sets the monitor to this progress observer.ProgressObserver.ISubtaskregisterSubtask(java.lang.String subtask)Registers a subtask to notify about processing progress.ProgressObserver.ITaskregisterTask(java.lang.String task)Registers a task for notify about processing progress.voidunregister(BasicProgressObserver.IProgressMonitor monitor)Sets this monitor to null if the current monitor is the same as the specified monitor.-
Methods inherited from class net.ssehub.easy.basics.progress.ProgressObserver
notifyEnd, notifyProgress, notifyProgress, notifyProgress, notifyStart
-
-
-
-
Field Detail
-
monitor
private BasicProgressObserver.IProgressMonitor monitor
-
parent
private BasicProgressObserver.Task parent
-
subtasks
private java.util.List<BasicProgressObserver.Task> subtasks
-
-
Method Detail
-
register
public void register(BasicProgressObserver.IProgressMonitor monitor)
Sets the monitor to this progress observer.
Overwrites already set monitors.- Parameters:
monitor- The monitor which should be added to this observer.
-
unregister
public void unregister(BasicProgressObserver.IProgressMonitor monitor)
Sets this monitor to null if the current monitor is the same as the specified monitor.- Parameters:
monitor- If the given monitor is the same monitor as the monitor of this observer instance the monitor of this observer will be set to null otherwise will nothing happen.
-
registerTask
public ProgressObserver.ITask registerTask(java.lang.String task)
Description copied from class:ProgressObserverRegisters a task for notify about processing progress.- Specified by:
registerTaskin classProgressObserver- Parameters:
task- the name of the task- Returns:
- the task identification
-
registerSubtask
public ProgressObserver.ISubtask registerSubtask(java.lang.String subtask)
Description copied from class:ProgressObserverRegisters a subtask to notify about processing progress.- Specified by:
registerSubtaskin classProgressObserver- Parameters:
subtask- the name of the sub task- Returns:
- the task identification
-
notifyStart
public void notifyStart(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int max)
Description copied from class:ProgressObserverNotifies about starting a (sub)task. Subtask notifications shall occur after task notifications, i.e. nested.- Specified by:
notifyStartin classProgressObserver- Parameters:
task- the identification of task to notify about (initially useProgressObserver.registerTask(String)for registering a task)subtask- the subtask (may beProgressObserver.NO_SUBTASK) (initially useProgressObserver.registerSubtask(String)for registering a sub task)max- the intended maximum steps of the subtask
-
notifyProgress
public void notifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step, int max)
Description copied from class:ProgressObserverNotifies about processing a task or a subtask.- Specified by:
notifyProgressin classProgressObserver- Parameters:
task- the identification of the task to notify about (initially useProgressObserver.registerTask(String)for registering a task)subtask- the identification of the subtask (may beProgressObserver.NO_SUBTASK, initially useProgressObserver.registerSubtask(String)for registering a sub task)step- the current step in 0<=step<=maxmax- the maximum number of steps, ignored if negative and value from start notification is used instead
-
notifyEnd
public void notifyEnd(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask)
Description copied from class:ProgressObserverNotifies about ending a (sub)task. Subtask notifications shall occur before task notifications, i.e. correctly nested. Use the identifications returned byProgressObserver.registerTask(String)andProgressObserver.registerSubtask(String). This method shall implicitly unregister the given task and/or subtask.- Specified by:
notifyEndin classProgressObserver- Parameters:
task- the identification of the task which ends (initially useProgressObserver.registerTask(String)for registering a task)subtask- the identification of the subtask withtask(may be <ProgressObserver.NO_SUBTASK, if given, only the subtask is supposed to end, initially useProgressObserver.registerSubtask(String)for registering a sub task)
-
-