Package uk.ac.starlink.topcat.plot2
Class Progresser
java.lang.Object
uk.ac.starlink.topcat.plot2.Progresser
Manages use of a JProgressBar model.
The methods of this class may be called from any thread.
- Since:
- 18 Nov 2013
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionProgresser
(BoundedRangeModel progModel, long count) Constructs a progresser with default step values.Progresser
(BoundedRangeModel progModel, long count, int maxStepCount, int minStepSize, long minStartMillis, long minUpdateMillis) Constructs a progresser with step value configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int count) Records a number of increments contributing to the progress.int
getStep()
Returns the number of increments between each attempted update of the GUI.void
Records a single increment contributing to the progress.void
init()
Prepares this progresser for use.void
reset()
Resets this progresser and its GUI to its initial state (no progress).
-
Constructor Details
-
Progresser
Constructs a progresser with default step values.- Parameters:
progModel
- progress bar modelcount
- number of increments expected for progress completion
-
Progresser
public Progresser(BoundedRangeModel progModel, long count, int maxStepCount, int minStepSize, long minStartMillis, long minUpdateMillis) Constructs a progresser with step value configuration.- Parameters:
progModel
- progress bar modelcount
- number of increments expected for progress completionmaxStepCount
- maximum number of steps that will be recorded in the GUI for progress completionminStepSize
- minimum number of increments before a step is recorded in the GUIminStartMillis
- minimum interval in milliseconds after initialisation before the first update is mademinUpdateMillis
- minimum interval in milliseconds between updates
-
-
Method Details
-
init
public void init()Prepares this progresser for use. Must be called before any increments. -
getStep
public int getStep()Returns the number of increments between each attempted update of the GUI.- Returns:
- step count
-
increment
public void increment()Records a single increment contributing to the progress. -
add
public void add(int count) Records a number of increments contributing to the progress. This is suitable for use if a significant number of increments have taken place.- Parameters:
count
- number of counts to register; should normally be significantly larger than 1
-
reset
public void reset()Resets this progresser and its GUI to its initial state (no progress).
-