Class ProgressBarStarTable

  • All Implemented Interfaces:
    StarTable

    public class ProgressBarStarTable
    extends WrapperStarTable
    A WrapperStarTable which behaves the same as its base, except that UI intervention is permitted on any RowSequence which is taken out on it. For one thing, the RowSequence will update a supplied JProgressBar component as it iterates, and for another thing Thread.interrupt()ing the thread in which the RowSequence is being iterated over will cause the next method to throw an IOException. Said RowSequences may be used from any thread, that is they are not restricted to use from the AWT event dispatcher thread. However you don't want to be using two such row sequences simultaneously or the progress bar will be getting two sets of updates at once.

    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)
    • Constructor Detail

      • ProgressBarStarTable

        public ProgressBarStarTable​(StarTable baseTable)
      • ProgressBarStarTable

        public ProgressBarStarTable​(StarTable baseTable,
                                    javax.swing.JProgressBar progBar)
    • Method Detail

      • setProgressBar

        public void setProgressBar​(javax.swing.JProgressBar progBar)
      • getProgressBar

        public javax.swing.JProgressBar getProgressBar()
      • setActiveLabel

        public void setActiveLabel​(java.lang.String label)
        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

        public java.lang.String 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

        public RowSequence getRowSequence()
                                   throws java.io.IOException
        Description copied from interface: StarTable
        Returns an object which can iterate over all the rows in the table sequentially.
        Specified by:
        getRowSequence in interface StarTable
        Overrides:
        getRowSequence in class WrapperStarTable
        Returns:
        an object providing sequential access to the table data
        Throws:
        java.io.IOException - if there is an error providing access