jsky.catalog.gui
Class TableDisplayTool

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by jsky.catalog.gui.TableDisplayTool
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, QueryResultDisplay, PrintableWithDialog, Saveable, SaveableAsHTML, SaveableWithDialog, Storeable

public class TableDisplayTool
extends javax.swing.JPanel
implements QueryResultDisplay, Saveable, SaveableWithDialog, SaveableAsHTML, PrintableWithDialog, Storeable

Combines a TableDisplay component for displaying query results in tabular form with a title and some buttons to perform various actions.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TableDisplayTool(TableQueryResult table, QueryResultDisplay queryResultDisplay, TablePlotter plotter)
          Create a TableDisplayTool for viewing the given table data.
 
Method Summary
protected  void addPlotterConfigPanel()
          Add a panel to the config window to configure the symbol plotting
 void addRow()
          Add an empty row to the table.
 void addRow(java.util.Vector v)
          Add a row to the table.
protected  void addTableColumnConfigPanel()
          Add a panel to the config window to configure the table columns
 void configure()
          Pop up a dialog to configure the plot symbols and table display.
 void deleteSelectedRows()
          Delete the selected rows.
 javax.swing.JPanel getButtonPanel()
          Return the button panel
 javax.swing.JButton getConfigButton()
           
 TabbedPanel getConfigPanel()
          Panel used to configure the table and plot symbol display
 java.lang.String getName()
          Return the name of this component (based on the data being displayed)
 javax.swing.JButton getPlotButton()
           
 TablePlotter getPlotter()
          Return the object to use to plot the table data
 java.util.Vector getRow(int rowIndex)
          Return the vector for the given row.
 int getRowCount()
          Return the number of rows in the table.
protected  SortedJTable getSortedJTable()
          Return the table for displaying query results
 TableQueryResult getTable()
          Return the TableQueryResult corresponding to this object
 TableDisplay getTableDisplay()
          Return the table for displaying query results
 javax.swing.JButton getUnplotAllButton()
           
 javax.swing.JButton getUnplotButton()
           
 void hidePopups()
          Hide any popup windows associated with this window
protected  javax.swing.JPanel makeButtonPanel()
          make and return the button panel
protected  javax.swing.JFileChooser makeFileChooser()
          Create and return a new file chooser to be used to select a local catalog file to open.
protected  void makeLayout(QueryResultDisplay queryResultDisplay)
          Do the window layout
protected  TableDisplay makeTableDisplay(TableQueryResult table, QueryResultDisplay queryResultDisplay)
          Create the TableDisplay or a derived widget.
 void plot()
          Plot the contents of the table.
 void print()
          Display a print dialog to print the contents of this object.
 void replot()
          Replot any plot symbols for this table.
 boolean restoreSettings(java.lang.Object obj)
          Restore the settings previously stored.
 void saveAs()
          Pop up a dialog to ask the user for a file name, and then save the contents of the table to the selected file.
 void saveAs(java.lang.String filename)
          Save the table to the given file.
 void saveAsHTML(java.lang.String filename)
          Save the table to the given file in HTML format.
 void setPlotter(TablePlotter plotter)
          Set the object to use to plot the table data
 void setQueryResult(QueryResult queryResult)
          Display the given query results.
 void setTableCellsEditable(boolean b)
          Set the editable state of the cells in the displayed table.
 java.lang.Object storeSettings()
          Store the current settings in a serializable object and return the object.
 void unplot()
          Remove any plot symbols for this table.
 void unplotAll()
          Remove all plot symbols.
protected  void updateConfigPanel()
          Update the table config panel, if needed
 void updateRow(int rowIndex, java.util.Vector v)
          Update a row in the table with the new data.
protected  void updateTitle()
          Update the table and frame titles to show the table title and number of rows
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableDisplayTool

public TableDisplayTool(TableQueryResult table,
                        QueryResultDisplay queryResultDisplay,
                        TablePlotter plotter)
Create a TableDisplayTool for viewing the given table data.

Parameters:
table - the table data
queryResultDisplay - object used to display any query results resulting from following links
plotter - object used to plot the table data
Method Detail

makeLayout

protected void makeLayout(QueryResultDisplay queryResultDisplay)
Do the window layout

Parameters:
queryResultDisplay - object used to display any query results resulting from following links

makeTableDisplay

protected TableDisplay makeTableDisplay(TableQueryResult table,
                                        QueryResultDisplay queryResultDisplay)
Create the TableDisplay or a derived widget.


getTableDisplay

public TableDisplay getTableDisplay()
Return the table for displaying query results


makeButtonPanel

protected javax.swing.JPanel makeButtonPanel()
make and return the button panel


getButtonPanel

public javax.swing.JPanel getButtonPanel()
Return the button panel


getPlotButton

public javax.swing.JButton getPlotButton()

getUnplotButton

public javax.swing.JButton getUnplotButton()

getUnplotAllButton

public javax.swing.JButton getUnplotAllButton()

getConfigButton

public javax.swing.JButton getConfigButton()

plot

public void plot()
Plot the contents of the table.


unplot

public void unplot()
Remove any plot symbols for this table.


unplotAll

public void unplotAll()
Remove all plot symbols.


replot

public void replot()
Replot any plot symbols for this table.


getTable

public TableQueryResult getTable()
Return the TableQueryResult corresponding to this object


getSortedJTable

protected SortedJTable getSortedJTable()
Return the table for displaying query results


getPlotter

public TablePlotter getPlotter()
Return the object to use to plot the table data


setPlotter

public void setPlotter(TablePlotter plotter)
Set the object to use to plot the table data


configure

public void configure()
Pop up a dialog to configure the plot symbols and table display.


addPlotterConfigPanel

protected void addPlotterConfigPanel()
Add a panel to the config window to configure the symbol plotting


addTableColumnConfigPanel

protected void addTableColumnConfigPanel()
Add a panel to the config window to configure the table columns


getConfigPanel

public TabbedPanel getConfigPanel()
Panel used to configure the table and plot symbol display


hidePopups

public void hidePopups()
Hide any popup windows associated with this window


getName

public java.lang.String getName()
Return the name of this component (based on the data being displayed)

Overrides:
getName in class java.awt.Component

setQueryResult

public void setQueryResult(QueryResult queryResult)
Display the given query results. Tabular data is displayed in the table. Other query result types must be implemented in a derived class.

Specified by:
setQueryResult in interface QueryResultDisplay
Parameters:
queryResult - an object returned from the Catalog query method.

updateConfigPanel

protected void updateConfigPanel()
Update the table config panel, if needed


makeFileChooser

protected javax.swing.JFileChooser makeFileChooser()
Create and return a new file chooser to be used to select a local catalog file to open.


saveAs

public void saveAs()
Pop up a dialog to ask the user for a file name, and then save the contents of the table to the selected file.

Specified by:
saveAs in interface SaveableWithDialog

saveAs

public void saveAs(java.lang.String filename)
Save the table to the given file.

Specified by:
saveAs in interface Saveable

saveAsHTML

public void saveAsHTML(java.lang.String filename)
Save the table to the given file in HTML format.

Specified by:
saveAsHTML in interface SaveableAsHTML

print

public void print()
           throws java.awt.print.PrinterException
Display a print dialog to print the contents of this object.

Specified by:
print in interface PrintableWithDialog
Throws:
java.awt.print.PrinterException

updateTitle

protected void updateTitle()
Update the table and frame titles to show the table title and number of rows


addRow

public void addRow()
Add an empty row to the table.


addRow

public void addRow(java.util.Vector v)
Add a row to the table.


updateRow

public void updateRow(int rowIndex,
                      java.util.Vector v)
Update a row in the table with the new data. An exception will be thrown if the row index is out of range or the vector has the wrong size.


getRow

public java.util.Vector getRow(int rowIndex)
Return the vector for the given row.


deleteSelectedRows

public void deleteSelectedRows()
Delete the selected rows.


setTableCellsEditable

public void setTableCellsEditable(boolean b)
Set the editable state of the cells in the displayed table.


getRowCount

public int getRowCount()
Return the number of rows in the table.


storeSettings

public java.lang.Object storeSettings()
Store the current settings in a serializable object and return the object.

Specified by:
storeSettings in interface Storeable

restoreSettings

public boolean restoreSettings(java.lang.Object obj)
Restore the settings previously stored.

Specified by:
restoreSettings in interface Storeable