uk.ac.starlink.table.gui
Class BasicTableLoadDialog

java.lang.Object
  extended byuk.ac.starlink.table.gui.AbstractTableLoadDialog
      extended byuk.ac.starlink.table.gui.BasicTableLoadDialog
All Implemented Interfaces:
TableLoadDialog

public abstract class BasicTableLoadDialog
extends AbstractTableLoadDialog

Skeleton implementation of a TableLoadDialog which can load a single table. Concrete subclasses need to populate this panel with components forming the specific part of the query dialogue (presumably text fields, combo boxes and so on) and then implement the getTableSupplier() method which returns an object capable of trying to load a table based on the current state of the component. All the issues about threading are taken care of by the implementation of this class.

Since:
23 Dec 2004

Nested Class Summary
static interface BasicTableLoadDialog.TableSupplier
          Defines an object which can attempt to load a particular table.
 
Constructor Summary
BasicTableLoadDialog(String name, String description)
          Constructor.
 
Method Summary
protected  void cancelLoad()
          Should interrupt any current load action, so that any pending load which is not complete should avoid passing tables to the consumer in the future, and preferably any work in progress should be stopped.
protected abstract  BasicTableLoadDialog.TableSupplier getTableSupplier()
          Concrete subclasses should implement this method to supply a TableSupplier object which can attempt to load a table based on the current state (as filled in by the user) of this component.
protected  void submitLoad(JDialog dialog, StarTableFactory tfact, String format, TableConsumer consumer)
          Should feed a table or tables to the given consuemer based on the current state of this component.
 
Methods inherited from class uk.ac.starlink.table.gui.AbstractTableLoadDialog
asIOException, createDialog, createQueryPanel, getCancelAction, getDescription, getIcon, getName, getOkAction, getProgessBar, getQueryPanel, isActive, setBusy, setFormatModel, setIcon, setIconUrl, showLoadDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.starlink.table.gui.TableLoadDialog
isAvailable
 

Constructor Detail

BasicTableLoadDialog

public BasicTableLoadDialog(String name,
                            String description)
Constructor.

Parameters:
name - dialogue name (typically used as text of a button)
description - dialogue description (typeically used as tooltip text)
Method Detail

getTableSupplier

protected abstract BasicTableLoadDialog.TableSupplier getTableSupplier()
                                                                throws RuntimeException
Concrete subclasses should implement this method to supply a TableSupplier object which can attempt to load a table based on the current state (as filled in by the user) of this component. If the state is not suitable for an attempt at loading a table (e.g. some components are filled in in an obviously wrong way) then a runtime exception such as IllegalStateException or IllegalArgumentException, with a human-readable message, should be thrown.

Returns:
table supplier corresponding to current state of this component
Throws:
RuntimeException - if validation fails

submitLoad

protected void submitLoad(JDialog dialog,
                          StarTableFactory tfact,
                          String format,
                          TableConsumer consumer)
Description copied from class: AbstractTableLoadDialog
Should feed a table or tables to the given consuemer based on the current state of this component. This method is invoked when the OK action is selected by the user.

Specified by:
submitLoad in class AbstractTableLoadDialog
Parameters:
dialog - dialogue currently containing this component
tfact - table factory to use for generating tables
format - selected table format; it may or may not be appropriate to ignore this hint
consumer - destination for loaded table or tables

cancelLoad

protected void cancelLoad()
Description copied from class: AbstractTableLoadDialog
Should interrupt any current load action, so that any pending load which is not complete should avoid passing tables to the consumer in the future, and preferably any work in progress should be stopped.

Specified by:
cancelLoad in class AbstractTableLoadDialog

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.