Package net.ssehub.easy.basics.progress
Class ObservableTask
- java.lang.Object
-
- net.ssehub.easy.basics.progress.ObservableTask
-
public class ObservableTask extends java.lang.ObjectCombines observable and task/subtask for convenient use.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private intcountprivate ProgressObserverobserverprivate ProgressObserver.ISubtasksubtaskprivate ProgressObserver.ITasktask
-
Constructor Summary
Constructors Constructor Description ObservableTask(java.lang.String name, int max, ObservableTask parent)Creates a new observable sub task.ObservableTask(java.lang.String name, int max, ProgressObserver observer)Creates a new observable top-level task.ObservableTask(java.lang.String name, int max, ProgressObserver observer, ProgressObserver.ITask task)Creates a new observable (sub) task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnotifyEnd()Notifies the observer about ending this (sub)task.voidnotifyProgress()Notifies the observer about progressing on step.voidnotifyProgress(int steps)Notifies the observer about progressing multiple steps.
-
-
-
Field Detail
-
task
private ProgressObserver.ITask task
-
subtask
private ProgressObserver.ISubtask subtask
-
observer
private ProgressObserver observer
-
count
private int count
-
-
Constructor Detail
-
ObservableTask
public ObservableTask(java.lang.String name, int max, ProgressObserver observer)Creates a new observable top-level task. Notifies the observer about starting the task.- Parameters:
name- the name of the taskmax- the maximum stepsobserver- the observer
-
ObservableTask
public ObservableTask(java.lang.String name, int max, ProgressObserver observer, ProgressObserver.ITask task)Creates a new observable (sub) task. Notifies the observer about starting the task.- Parameters:
name- the name of the taskmax- the maximum stepsobserver- the observertask- the parent task (may be null)
-
ObservableTask
public ObservableTask(java.lang.String name, int max, ObservableTask parent)Creates a new observable sub task. Notifies the observer about starting the task.- Parameters:
name- the name of the sub taskmax- the maximum stepsparent- The parent task
-
-
Method Detail
-
notifyProgress
public void notifyProgress()
Notifies the observer about progressing on step.
-
notifyProgress
public void notifyProgress(int steps)
Notifies the observer about progressing multiple steps.- Parameters:
steps- the progressed steps
-
notifyEnd
public void notifyEnd()
Notifies the observer about ending this (sub)task.
-
-