Class TableLoadWorker

java.lang.Object
java.lang.Thread
uk.ac.starlink.table.gui.TableLoadWorker
All Implemented Interfaces:
Runnable

public class TableLoadWorker extends Thread
Thread which passes data from a TableLoader to a TableLoadClient. As well as ensuring that everything happens on sensible threads, and updating a progress bar appropriately, it provides the facility to cancel the load in progress.
Since:
13 Sept 2010
Author:
Mark Taylor
  • Constructor Details

    • TableLoadWorker

      public TableLoadWorker(TableLoader loader, TableLoadClient client, JProgressBar progBar)
      Constructs a TableLoadWorker with a given progress bar.
      Parameters:
      loader - table loader, supplies tables
      client - table load client, consumes tables into a GUI
      progBar - progress bar to keep track of loading
    • TableLoadWorker

      public TableLoadWorker(TableLoader loader, TableLoadClient client)
      Constructs a TableLoadWorker with a default progress bar.
      Parameters:
      loader - table loader, supplies tables
      client - table load client, consumes tables into a GUI
  • Method Details

    • getLoader

      public TableLoader getLoader()
      Returns the table loader used by this worker.
      Returns:
      table loader
    • getLoadClient

      public TableLoadClient getLoadClient()
      Returns the table load client used by this worker.
      Returns:
      load client
    • getCancelAction

      public Action getCancelAction()
      Returns an action which will cancel the current load.
      Returns:
      cancel action
    • getProgressBar

      public JProgressBar getProgressBar()
      Returns the progress bar controlled by this worker.
      Returns:
      progress bar
    • run

      public void run()
      Performs loading until completed or cancelled.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • cancel

      public void cancel()
      Cancels the current load. It is not an error to call this multiple times. It must be called on the Event Dispatch Thread.
    • finish

      protected void finish(boolean cancelled)
      Tidies up following execution. Must be called exactly once. It must be called on the Event Dispatch Thread.
      Parameters:
      cancelled - true iff cancel has been called