Class TableLoadPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public abstract class TableLoadPanel extends JPanel
Component which aggregates a TableLoadDialog and buttons (OK and Cancel) to control it. The utility method (loadTables is a convenient way to do synchronous table loading.

Concrete implementations of this abstract class must implement the getLoadClient() method to determine how loaded tables will be consumed.

Since:
13 Sept 2010
Author:
Mark Taylor
See Also:
  • Constructor Details

    • TableLoadPanel

      public TableLoadPanel(TableLoadDialog tld, StarTableFactory tfact)
      Constructor.
      Parameters:
      tld - load dialogue
      tfact - representative table factory (not necessarily the one used to create tables)
  • Method Details

    • getLoadClient

      protected abstract TableLoadClient getLoadClient()
      Returns a GUI consumer for any tables loaded by this panel. It will be called once for each load sequence; the returned object may or may not be the same one each time.
      Returns:
      load client ready to accept tables
    • getOkAction

      public Action getOkAction()
      Returns the action which starts to load tables.
      Returns:
      OK action
    • getCancelAction

      public Action getCancelAction()
      Returns the action which cancels a load in progress.
      Returns:
      Cancel action
    • isLoading

      public boolean isLoading()
      Indicates whether a load is currently in progress.
      Returns:
      true iff loading is taking place
    • getProgressBar

      public JProgressBar getProgressBar()
      Returns the progress bar used by this panel.
      Returns:
      progress bar
    • setProgressBar

      public void setProgressBar(JProgressBar progBar)
      Sets the progress bar used by this panel.
      Parameters:
      progBar - progress bar
    • loadTable

      public static StarTable loadTable(Component parent, TableLoadDialog tld, StarTableFactory tfact) throws IOException
      Displays a modal load dialogue to load a single table, and returns the tables it has loaded when finished.
      Parameters:
      parent - parent component
      tld - load dialogue
      tfact - table factory
      Throws:
      IOException
    • loadTables

      public static StarTable[] loadTables(Component parent, TableLoadDialog tld, StarTableFactory tfact) throws IOException
      Displays a modal load dialogue to load (possibly) multiple tables, and returns the tables it has loaded when finished.
      Parameters:
      parent - parent component
      tld - load dialogue
      tfact - table factory
      Throws:
      IOException
    • main

      public static void main(String[] args) throws IOException
      Test method. Posts a file load dialogue and summarises any tables that were loaded.
      Throws:
      IOException