Class AbstractTableLoadDialog

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractTableLoadDialog​(java.lang.String name, java.lang.String description)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.IOException asIOException​(java.lang.Throwable th)
      Converts an exception to an IOException, probably by wrapping it in one.
      void configure​(StarTableFactory tfact, javax.swing.Action submitAct)
      Provides some configuration which must be performed before use.
      javax.swing.JComboBox createFormatSelector()
      Returns a new combo box which can be used to select table formats from the ones known by this dialogue.
      protected abstract java.awt.Component createQueryComponent()
      Constructs the query component used by this dialogue.
      java.lang.String getDescription()
      Returns a short description of this dialogue.
      javax.swing.Icon getIcon()
      Returns an icon associated with this dialogue.
      javax.swing.JMenu[] getMenus()
      Returns an array of menus which may be presented in the window alongside the query component.
      java.lang.String getName()
      Returns the name of this dialogue.
      java.awt.Component getQueryComponent()
      Returns the GUI component which allows the user to select how tables are to be loaded.
      java.lang.String getSelectedFormat()
      Returns the table format currently selected by any of the format selectors.
      javax.swing.Action getSubmitAction()
      javax.swing.Action[] getToolbarActions()
      Returns an array of actions suitable for presentation as toolbar buttons alongside the query component.
      boolean isAvailable()
      The default implementation returns true.
      boolean isComponentShowing()
      Indicates whether the query component of this dialogue is currently contained in a visible window.
      boolean isReady()
      Indicates whether the submit action should be enabled.
      void setIcon​(javax.swing.Icon icon)
      Sets the icon to associate with this dialogue.
      void setIconUrl​(java.net.URL iconUrl)
      Sets the icon to associate with this dialogue by specifying its URL.
      void setMenus​(javax.swing.JMenu[] menus)
      Sets the menus for this dialogue.
      protected void setToolbarActions​(javax.swing.Action[] acts)
      Sets the toolbar actions for this dialogue.
      protected void submit()
      Invokes this dialogue's Submit Action with a non-descript ActionEvent.
      protected void updateReady()
      Updates the enabledness state of this dialogue's Submit Action according to the current value of isReady().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractTableLoadDialog

        protected AbstractTableLoadDialog​(java.lang.String name,
                                          java.lang.String description)
        Constructor.
        Parameters:
        name - dialogue name
        description - dialogue description
    • Method Detail

      • createQueryComponent

        protected abstract java.awt.Component createQueryComponent()
        Constructs the query component used by this dialogue. Called only once (lazily).
        Returns:
        query component
      • getName

        public java.lang.String getName()
        Description copied from interface: TableLoadDialog
        Returns the name of this dialogue. This may be used as the text of a button (Action.NAME).
        Specified by:
        getName in interface TableLoadDialog
        Returns:
        dialogue name
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: TableLoadDialog
        Returns a short description of this dialogue. This may be used as the tooltip text of a button (Action.SHORT_DESCRIPTION).
        Specified by:
        getDescription in interface TableLoadDialog
        Returns:
        dialogue description
      • getIcon

        public javax.swing.Icon getIcon()
        Description copied from interface: TableLoadDialog
        Returns an icon associated with this dialogue. A size of 24x24 pixels is preferred. Null may be returned if no icon is available.
        Specified by:
        getIcon in interface TableLoadDialog
        Returns:
        dialogue icon
      • getQueryComponent

        public java.awt.Component getQueryComponent()
        Description copied from interface: TableLoadDialog
        Returns the GUI component which allows the user to select how tables are to be loaded.
        Specified by:
        getQueryComponent in interface TableLoadDialog
        Returns:
        component for user interaction
      • getMenus

        public javax.swing.JMenu[] getMenus()
        Description copied from interface: TableLoadDialog
        Returns an array of menus which may be presented in the window alongside the query component.
        Specified by:
        getMenus in interface TableLoadDialog
        Returns:
        menu array; may be empty
      • setMenus

        public void setMenus​(javax.swing.JMenu[] menus)
        Sets the menus for this dialogue.
        Parameters:
        menus - menu array
      • getToolbarActions

        public javax.swing.Action[] getToolbarActions()
        Description copied from interface: TableLoadDialog
        Returns an array of actions suitable for presentation as toolbar buttons alongside the query component.
        Specified by:
        getToolbarActions in interface TableLoadDialog
        Returns:
        toolbar action array; may be empty
      • setToolbarActions

        protected void setToolbarActions​(javax.swing.Action[] acts)
        Sets the toolbar actions for this dialogue.
        Parameters:
        acts - toolbar actions
      • isAvailable

        public boolean isAvailable()
        The default implementation returns true.
        Specified by:
        isAvailable in interface TableLoadDialog
        Returns:
        true iff this dialogue may be able to do something useful
      • setIcon

        public void setIcon​(javax.swing.Icon icon)
        Sets the icon to associate with this dialogue.
        Parameters:
        icon - icon
      • setIconUrl

        public void setIconUrl​(java.net.URL iconUrl)
        Sets the icon to associate with this dialogue by specifying its URL. If a null URL is given, the icon is set null.
        Parameters:
        iconUrl - URL of gif, png or jpeg icon
      • configure

        public void configure​(StarTableFactory tfact,
                              javax.swing.Action submitAct)
        Description copied from interface: TableLoadDialog
        Provides some configuration which must be performed before use. This method should be called before TableLoadDialog.getQueryComponent() is called.

        The tfact argument provides a table factory which resembles the one to be used for generating tables. Although this factory should not in general be used or retained, since the one presented later to the TableLoader should be used instead, it can be interrogated for known table formats etc.

        The submitAct argument sets the action which when invoked will cause TableLoadDialog.createTableLoader() to be called. Its setEnabled method can be called to reflect readiness, and it can be added as a listener to dialogue-specific events which indicate that a selection has been made.

        Specified by:
        configure in interface TableLoadDialog
        Parameters:
        tfact - representative table factory
        submitAct - action for load submission
      • createFormatSelector

        public javax.swing.JComboBox createFormatSelector()
        Returns a new combo box which can be used to select table formats from the ones known by this dialogue. This method may be called multiple times, but the same model is used in each case.
        Returns:
        table format combo box
      • getSelectedFormat

        public java.lang.String getSelectedFormat()
        Returns the table format currently selected by any of the format selectors.
        Returns:
        selected table format
        See Also:
        createFormatSelector()
      • isComponentShowing

        public boolean isComponentShowing()
        Indicates whether the query component of this dialogue is currently contained in a visible window.
        Returns:
        true iff this dialog's query component exists and is showing
      • submit

        protected void submit()
        Invokes this dialogue's Submit Action with a non-descript ActionEvent.
      • updateReady

        protected void updateReady()
        Updates the enabledness state of this dialogue's Submit Action according to the current value of isReady(). Subclasses should call this method when the return value of isReady might have changed.
      • isReady

        public boolean isReady()
        Indicates whether the submit action should be enabled. The implementation should return true if the user should be allowed to submit the query, or false if the internal state of this dialogue is known to be incomplete in some way. Evaluation should be fast; the return does not need to provide a guarantee that a submitted query will suceed.

        The default implementation returns true.

        Returns:
        false iff dialogue state is known to be incomplete
      • asIOException

        public static java.io.IOException asIOException​(java.lang.Throwable th)
        Converts an exception to an IOException, probably by wrapping it in one. This utility method can be used for wrapping up an exception of some other kind if it needs to be thrown in TableSupplier.getTable.
        Parameters:
        th - base throwable
        Returns:
        IOException based on th