Package uk.ac.starlink.table.gui
Class ProgressBarStarTable
java.lang.Object
uk.ac.starlink.table.WrapperStarTable
uk.ac.starlink.table.gui.ProgressBarStarTable
- All Implemented Interfaces:
Closeable
,AutoCloseable
,StarTable
A WrapperStarTable which behaves the same as its base, except that
UI intervention is permitted on any RowSequence which is taken out on it.
It provides two services:
- Iteration using
getRowSequence()
orgetRowSplittable()
will update a suppliedJProgressBar
as it goes. - Iteration can be forced to terminate based on the behaviour of a given BooleanSupplier.
You might think this should be based on a
BoundedRangeModel
(JProgressBar's model) instead,
but unfortunately that doesn't allow you use of
indeterminate progress states.
- Author:
- Mark Taylor (Starlink)
-
Field Summary
Fields inherited from class uk.ac.starlink.table.WrapperStarTable
baseTable
-
Constructor Summary
ConstructorsConstructorDescriptionProgressBarStarTable
(StarTable baseTable, JProgressBar progBar) Constructor with default cancellation control.ProgressBarStarTable
(StarTable baseTable, JProgressBar progBar, BooleanSupplier isCancelled) Constructor with supplied cancellation control. -
Method Summary
Modifier and TypeMethodDescriptionReturns the text of the label which is visible in the progress bar when a RowSequence acquired from this table is active.Returns the progress bar which this table controls.Returns an object which can iterate over all the rows in the table sequentially.Returns an object which can iterate over all the rows in the table, but which may also be requested to split recursively for potentially parallel processing.void
setActiveLabel
(String label) Sets a label which will be visible in the progress bar when a RowSequence acquired from this table is being iterated over.void
setProgressBar
(JProgressBar progBar) Sets the progress bar which this table controls.Methods inherited from class uk.ac.starlink.table.WrapperStarTable
checkedLongToInt, close, getBaseTable, getCell, getColumnAuxDataInfos, getColumnCount, getColumnInfo, getName, getParameterByName, getParameters, getRow, getRowAccess, getRowCount, getURL, isRandom, setName, setParameter, setURL, toString
-
Constructor Details
-
ProgressBarStarTable
Constructor with default cancellation control. Iteration is cancelled if the calling thread is interrupted. This may be appropriate for single-threaded iteration (using aRowSequence
), but is unlikely to achieve cancellation of multi-threaded iteration (using aRowSplittable
).- Parameters:
baseTable
- table supplying dataprogBar
- progress bar to update
-
ProgressBarStarTable
Constructor with supplied cancellation control.- Parameters:
baseTable
- table supplying dataprogBar
- progress bar to updateisCancelled
- object controlling cancellation: if it supplies a true value, thenext
method of anyRowSequence
orRowSplittable
taken out on this table will (probably, at some point) throw IOExceptions
-
-
Method Details
-
setProgressBar
Sets the progress bar which this table controls.- Parameters:
progBar
- progress bar
-
getProgressBar
Returns the progress bar which this table controls.- Returns:
- progress bar
-
setActiveLabel
Sets a label which will be visible in the progress bar when a RowSequence acquired from this table is being iterated over.- Parameters:
label
- label text
-
getActiveLabel
Returns the text of the label which is visible in the progress bar when a RowSequence acquired from this table is active.- Returns:
- label text
-
getRowSequence
Description copied from interface:StarTable
Returns an object which can iterate over all the rows in the table sequentially. Each such returned object is safe for use within a single thread, but not in general from multiple threads concurrently.- Specified by:
getRowSequence
in interfaceStarTable
- Overrides:
getRowSequence
in classWrapperStarTable
- Returns:
- new RowSequence
- Throws:
IOException
- if there is an error providing access
-
getRowSplittable
Description copied from interface:StarTable
Returns an object which can iterate over all the rows in the table, but which may also be requested to split recursively for potentially parallel processing.The return value must be non-null, and may provide splitting arrangements specially appropriate for the implementation. If this table 'wraps' an upstream table, it is usually best to base the implementation on calls to the the upstream
getRowSplittable
method, so that upstream policy about how to divide up the table is respected. However, implementations without special requirements may returnTables.getDefaultRowSplittable
(this)
.- Specified by:
getRowSplittable
in interfaceStarTable
- Overrides:
getRowSplittable
in classWrapperStarTable
- Returns:
- new RowSplittable
- Throws:
IOException
- See Also:
-