jsky.catalog.gui
Class TableDisplay
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jsky.catalog.gui.TableDisplay
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible, QueryResultDisplay, PrintableWithDialog, SaveableAsHTML
public class TableDisplay
- extends JPanel
- implements QueryResultDisplay, PrintableWithDialog, SaveableAsHTML
This widget displays the contents of a TableQueryResult in a JTable and
implements scrolling, editing, searching and sorting methods.
- See Also:
- Serialized Form
Method Summary |
void |
deselectRow(int row)
Deselect the given table row. |
QueryResultDisplay |
getQueryResultDisplay()
Return the object used to display query results (when following links) |
JScrollPane |
getScrollPane()
Return the JScrollPane used to scroll the table |
boolean[] |
getShow()
Return an array specifying which columns to show, if defined, otherwise null. |
SortedJTable |
getTable()
Return the widget used to display the table. |
TableQueryResult |
getTableQueryResult()
Return the current table query result (same as the table model). |
static void |
main(String[] args)
test main |
void |
print()
Display a print dialog to print the contents of this object. |
void |
print(String title)
Display a print dialog to print the contents of this object
with the specified table title. |
void |
resize()
Called when the table is resized |
void |
saveAsHTML(String filename)
Save the table to the given filename in HTML format |
void |
selectRow(int row)
Select the given table row. |
protected void |
setColumnRenderers()
Set up any required JTable renderers, so that the values in the query result are displayed
correctly by the JTable. |
void |
setModel(TableQueryResult tableQueryResult)
Set the data to display in the table. |
void |
setQueryResult(QueryResult queryResult)
If the given query result is a table, display it,
otherwise do nothing. |
void |
setQueryResultDisplay(QueryResultDisplay q)
Set the object used to display query results (when following links) |
void |
setShow(boolean[] show)
Set an array specifying which columns to show (or null, for default) |
void |
update()
Update the table after the model has changed. |
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, getName, 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 |
TableDisplay
public TableDisplay(TableQueryResult tableQueryResult,
QueryResultDisplay queryResultDisplay)
- Create a TableDisplay for viewing the given table data.
- Parameters:
tableQueryResult
- the table to use.queryResultDisplay
- used to display any query results (resulting from following links)
TableDisplay
public TableDisplay(TableQueryResult tableQueryResult)
- Create an empty TableDisplay (Call setModel to set the data to display).
- Parameters:
tableQueryResult
- the table to use.
TableDisplay
public TableDisplay(QueryResultDisplay queryResultDisplay)
- Create an empty TableDisplay (Call setModel to set the data to display).
- Parameters:
queryResultDisplay
- used to display any query results (resulting from following links)
TableDisplay
public TableDisplay()
- Initialize an empty table. Call setModel() to set the data to display,
and setQueryResultDisplay to set the display class to use when following links.
getTable
public SortedJTable getTable()
- Return the widget used to display the table.
getScrollPane
public JScrollPane getScrollPane()
- Return the JScrollPane used to scroll the table
setQueryResultDisplay
public void setQueryResultDisplay(QueryResultDisplay q)
- Set the object used to display query results (when following links)
getQueryResultDisplay
public QueryResultDisplay getQueryResultDisplay()
- Return the object used to display query results (when following links)
setQueryResult
public void setQueryResult(QueryResult queryResult)
- If the given query result is a table, display it,
otherwise do nothing.
- Specified by:
setQueryResult
in interface QueryResultDisplay
getTableQueryResult
public TableQueryResult getTableQueryResult()
- Return the current table query result (same as the table model).
setModel
public void setModel(TableQueryResult tableQueryResult)
- Set the data to display in the table.
update
public void update()
- Update the table after the model has changed.
setColumnRenderers
protected void setColumnRenderers()
- Set up any required JTable renderers, so that the values in the query result are displayed
correctly by the JTable. This is needed, for example, if a certain column should
contain a button or other widget instead of the default text item, or if a value needs
special formatting.
print
public void print(String title)
throws PrinterException
- Display a print dialog to print the contents of this object
with the specified table title.
- Throws:
PrinterException
print
public void print()
throws PrinterException
- Display a print dialog to print the contents of this object.
- Specified by:
print
in interface PrintableWithDialog
- Throws:
PrinterException
resize
public void resize()
- Called when the table is resized
selectRow
public void selectRow(int row)
- Select the given table row.
- Parameters:
row
- the index of the row (0 is the first row)
deselectRow
public void deselectRow(int row)
- Deselect the given table row.
- Parameters:
row
- the index of the row (0 is the first row)
getShow
public boolean[] getShow()
- Return an array specifying which columns to show, if defined, otherwise null.
setShow
public void setShow(boolean[] show)
- Set an array specifying which columns to show (or null, for default)
saveAsHTML
public void saveAsHTML(String filename)
throws IOException
- Save the table to the given filename in HTML format
- Specified by:
saveAsHTML
in interface SaveableAsHTML
- Throws:
IOException
main
public static void main(String[] args)
- test main
Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.