Class AbstractTableLoadDialog
java.lang.Object
uk.ac.starlink.table.gui.AbstractTableLoadDialog
- All Implemented Interfaces:
TableLoadDialog
- Direct Known Subclasses:
FileChooserTableLoadDialog, FilestoreTableLoadDialog, LocationTableLoadDialog, SQLTableLoadDialog
Partial implementation of TableLoadDialog interface.
- Since:
- 13 Sept 2010
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTableLoadDialog(String name, String description) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToolbarAction(Action act) Adds an action to the toolbar for this dialogue.static IOExceptionConverts an exception to an IOException, probably by wrapping it in one.voidconfigure(StarTableFactory tfact, Action submitAct) Provides some configuration which must be performed before use.Returns a new combo box which can be used to select table formats from the ones known by this dialogue.protected abstract ComponentConstructs the query component used by this dialogue.Returns a short description of this dialogue.getIcon()Returns an icon associated with this dialogue.JMenu[]getMenus()Returns an array of menus which may be presented in the window alongside the query component.getName()Returns the name of this dialogue.Returns the GUI component which allows the user to select how tables are to be loaded.Returns the table format currently selected by any of the format selectors.Returns the action set byTableLoadDialog.configure(StarTableFactory, Action).Action[]Returns an array of actions suitable for presentation as toolbar buttons alongside the query component.booleanThe default implementation returns true.booleanIndicates whether the query component of this dialogue is currently contained in a visible window.booleanisReady()Indicates whether the submit action should be enabled.voidSets the icon to associate with this dialogue.voidsetIconUrl(URL iconUrl) Sets the icon to associate with this dialogue by specifying its URL.voidSets the menus for this dialogue.protected voidsetToolbarActions(Action[] acts) Sets the toolbar actions for this dialogue.protected voidsubmit()Invokes this dialogue's Submit Action with a non-descript ActionEvent.protected voidUpdates the enabledness state of this dialogue's Submit Action according to the current value ofisReady().Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TableLoadDialog
createTableLoader
-
Constructor Details
-
AbstractTableLoadDialog
-
-
Method Details
-
createQueryComponent
Constructs the query component used by this dialogue. Called only once (lazily).- Returns:
- query component
-
getName
Description copied from interface:TableLoadDialogReturns the name of this dialogue. This may be used as the text of a button (Action.NAME).- Specified by:
getNamein interfaceTableLoadDialog- Returns:
- dialogue name
-
getDescription
Description copied from interface:TableLoadDialogReturns a short description of this dialogue. This may be used as the tooltip text of a button (Action.SHORT_DESCRIPTION).- Specified by:
getDescriptionin interfaceTableLoadDialog- Returns:
- dialogue description
-
getIcon
Description copied from interface:TableLoadDialogReturns an icon associated with this dialogue. A size of 24x24 pixels is preferred. Null may be returned if no icon is available.- Specified by:
getIconin interfaceTableLoadDialog- Returns:
- dialogue icon
-
getQueryComponent
Description copied from interface:TableLoadDialogReturns the GUI component which allows the user to select how tables are to be loaded.- Specified by:
getQueryComponentin interfaceTableLoadDialog- Returns:
- component for user interaction
-
getMenus
Description copied from interface:TableLoadDialogReturns an array of menus which may be presented in the window alongside the query component.- Specified by:
getMenusin interfaceTableLoadDialog- Returns:
- menu array; may be empty
-
setMenus
Sets the menus for this dialogue.- Parameters:
menus- menu array
-
getToolbarActions
Description copied from interface:TableLoadDialogReturns an array of actions suitable for presentation as toolbar buttons alongside the query component.- Specified by:
getToolbarActionsin interfaceTableLoadDialog- Returns:
- toolbar action array; may be empty
-
setToolbarActions
Sets the toolbar actions for this dialogue.- Parameters:
acts- toolbar actions
-
addToolbarAction
Adds an action to the toolbar for this dialogue. Utility function.- Parameters:
act- action to add
-
isAvailable
public boolean isAvailable()The default implementation returns true.- Specified by:
isAvailablein interfaceTableLoadDialog- Returns:
- true iff this dialogue may be able to do something useful
-
setIcon
Sets the icon to associate with this dialogue.- Parameters:
icon- icon
-
setIconUrl
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
Description copied from interface:TableLoadDialogProvides some configuration which must be performed before use. This method should be called beforeTableLoadDialog.getQueryComponent()is called.The
tfactargument 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
submitActargument sets the action which when invoked will causeTableLoadDialog.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:
configurein interfaceTableLoadDialog- Parameters:
tfact- representative table factorysubmitAct- action for load submission
-
createFormatSelector
-
getSelectedFormat
Returns the table format currently selected by any of the format selectors.- Returns:
- selected table format
- See Also:
-
getSubmitAction
Description copied from interface:TableLoadDialogReturns the action set byTableLoadDialog.configure(StarTableFactory, Action).- Specified by:
getSubmitActionin interfaceTableLoadDialog- Returns:
- action which initiates a table load attempt
-
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 ofisReady(). Subclasses should call this method when the return value ofisReadymight 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
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 inTableSupplier.getTable.- Parameters:
th- base throwable- Returns:
- IOException based on
th
-