Package uk.ac.starlink.table.join
Class RangeModelProgressIndicator
- java.lang.Object
-
- javax.swing.DefaultBoundedRangeModel
-
- uk.ac.starlink.table.join.RangeModelProgressIndicator
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Runnable
,javax.swing.BoundedRangeModel
,ProgressIndicator
public class RangeModelProgressIndicator extends javax.swing.DefaultBoundedRangeModel implements ProgressIndicator, java.lang.Runnable
ProgressIndicator implementation that can serve as the model for aJProgressBar
. Calls to startStage, setLevel and endStage cause the state of theBoundedRangeModel
that this implements to be updated accordingly (asynchronously of course). The string messages passed to startStage and logMessage are ignored - subclasses should override these methods (calling the superclass implementations as well) to do something with these strings.- Since:
- 24 Mar 2004
- Author:
- Mark Taylor (Starlink)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RangeModelProgressIndicator(boolean profile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endStage()
Indicates that no moreProgressIndicator.setLevel(double)
calls will be made until the nextProgressIndicator.startStage(java.lang.String)
.void
logMessage(java.lang.String msg)
Registers a comment about the progress of the algorithm.void
run()
Updates the state of the BoundedRangeModel - should only be called from the event dispatch thread.void
setLevel(double lev)
Specifies that the work of the most recently-started stage is a certain proportion complete.void
startStage(java.lang.String stage)
Indicates that a number ofProgressIndicator.setLevel(double)
calls may follow, followed by aProgressIndicator.endStage()
call.-
Methods inherited from class javax.swing.DefaultBoundedRangeModel
addChangeListener, fireStateChanged, getChangeListeners, getExtent, getListeners, getMaximum, getMinimum, getValue, getValueIsAdjusting, removeChangeListener, setExtent, setMaximum, setMinimum, setRangeProperties, setValue, setValueIsAdjusting, toString
-
-
-
-
Method Detail
-
startStage
public void startStage(java.lang.String stage)
Description copied from interface:ProgressIndicator
Indicates that a number ofProgressIndicator.setLevel(double)
calls may follow, followed by aProgressIndicator.endStage()
call.- Specified by:
startStage
in interfaceProgressIndicator
- Parameters:
stage
- name/description of the processing stage
-
setLevel
public void setLevel(double lev) throws java.lang.InterruptedException
Description copied from interface:ProgressIndicator
Specifies that the work of the most recently-started stage is a certain proportion complete. Calls to this method must take place between paired calls toProgressIndicator.startStage(java.lang.String)
andProgressIndicator.endStage()
, preferably with non-decreasing values of level.The method may throw an InterruptedException as a message to the caller that the work should be interrupted. A caller which receives such an exception should stop using resources and tidy up as soon as is convenient.
- Specified by:
setLevel
in interfaceProgressIndicator
- Parameters:
lev
- value between 0. and 1. indicating amount of completion- Throws:
java.lang.InterruptedException
- as a message to the caller that the work is no longer required Is this abuse of InterruptedException??
-
endStage
public void endStage()
Description copied from interface:ProgressIndicator
Indicates that no moreProgressIndicator.setLevel(double)
calls will be made until the nextProgressIndicator.startStage(java.lang.String)
.- Specified by:
endStage
in interfaceProgressIndicator
-
logMessage
public void logMessage(java.lang.String msg)
Description copied from interface:ProgressIndicator
Registers a comment about the progress of the algorithm. This should not be called between calls toProgressIndicator.startStage(java.lang.String)
andProgressIndicator.endStage()
.- Specified by:
logMessage
in interfaceProgressIndicator
- Parameters:
msg
- message
-
run
public void run()
Updates the state of the BoundedRangeModel - should only be called from the event dispatch thread.- Specified by:
run
in interfacejava.lang.Runnable
-
-