public abstract class AbstractTableLoadDialog extends java.lang.Object implements TableLoadDialog
Modifier | Constructor and Description |
---|---|
protected |
AbstractTableLoadDialog(java.lang.String name,
java.lang.String description)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addToolbarAction(javax.swing.Action act)
Adds an action to the toolbar for this dialogue.
|
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<java.lang.String> |
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()
Returns the action set by
TableLoadDialog.configure(uk.ac.starlink.table.StarTableFactory, javax.swing.Action) . |
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() . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createTableLoader
protected AbstractTableLoadDialog(java.lang.String name, java.lang.String description)
name
- dialogue namedescription
- dialogue descriptionprotected abstract java.awt.Component createQueryComponent()
public java.lang.String getName()
TableLoadDialog
Action.NAME
).getName
in interface TableLoadDialog
public java.lang.String getDescription()
TableLoadDialog
Action.SHORT_DESCRIPTION
).getDescription
in interface TableLoadDialog
public javax.swing.Icon getIcon()
TableLoadDialog
getIcon
in interface TableLoadDialog
public java.awt.Component getQueryComponent()
TableLoadDialog
getQueryComponent
in interface TableLoadDialog
public javax.swing.JMenu[] getMenus()
TableLoadDialog
getMenus
in interface TableLoadDialog
public void setMenus(javax.swing.JMenu[] menus)
menus
- menu arraypublic javax.swing.Action[] getToolbarActions()
TableLoadDialog
getToolbarActions
in interface TableLoadDialog
protected void setToolbarActions(javax.swing.Action[] acts)
acts
- toolbar actionsprotected void addToolbarAction(javax.swing.Action act)
act
- action to addpublic boolean isAvailable()
isAvailable
in interface TableLoadDialog
public void setIcon(javax.swing.Icon icon)
icon
- iconpublic void setIconUrl(java.net.URL iconUrl)
iconUrl
- URL of gif, png or jpeg iconpublic void configure(StarTableFactory tfact, javax.swing.Action submitAct)
TableLoadDialog
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.
configure
in interface TableLoadDialog
tfact
- representative table factorysubmitAct
- action for load submissionpublic javax.swing.JComboBox<java.lang.String> createFormatSelector()
public java.lang.String getSelectedFormat()
createFormatSelector()
public javax.swing.Action getSubmitAction()
TableLoadDialog
TableLoadDialog.configure(uk.ac.starlink.table.StarTableFactory, javax.swing.Action)
.getSubmitAction
in interface TableLoadDialog
public boolean isComponentShowing()
protected void submit()
protected void updateReady()
isReady()
.
Subclasses should call this method when the return value of
isReady
might have changed.public boolean isReady()
The default implementation returns true.
public static java.io.IOException asIOException(java.lang.Throwable th)
TableSupplier.getTable
.th
- base throwableth