Class DeluxeTable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JTable
                          |
                          +--DeluxeTable

public class DeluxeTable
extends javax.swing.JTable

A base class that adds functionality for sorting a Table by column, obtaining tooltips for given cells, creating popup menus for given cells/rows/cols, and double-click actions for given cells/rows/cols

See Also:
DeluxeTableModel, Serialized Form

Inner classes inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
 
Constructor Summary
DeluxeTable(DeluxeTableModel model)
          A DeluxeTable will only accept a TableModel of the Deluxe variety.
 
Method Summary
 void autoSizeColumns()
          Cause the columns of the tables to automatically size themselves, resizing the table as a whole if necessary.
 void autoSizeColumns(boolean allowShrink, boolean allowGrow)
          Cause the columns of the table to automatically size themselves.
protected  void doDoubleClick(java.awt.event.MouseEvent evt, int row, int col)
          subclasses should override this if they want double click actions.
protected  void doPopup(java.awt.event.MouseEvent evt, int row, int col)
          subclasses should override this if they want popup menus.
 java.lang.String getTableAsString()
          dump the table as a long, formatted string.
 java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
          Implementation of getToolTipText to return tooltips
 void handleDoubleClickEvent(java.awt.event.MouseEvent evt)
          this method is called by the default mouse event listener on double clicks
 void handlePopupEvent(java.awt.event.MouseEvent evt)
          this method is called by the default mouse event listener on popup triggers
 void setMaximumColumnWidth(int num)
          set the maximum column width to be applied to all columns.
 boolean setSelectedRow(java.lang.Object content, int col)
          Set the selected row based on the contents of a column Failure to find a match results in the selection being cleared for this table.
 void setVisibleRowCount(int rows)
          Set the number of visible rows, ala JList
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowCount, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getTableHeader, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isManagingFocus, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, removeColumn, removeColumnSelectionInterval, removeEditor, removeRowSelectionInterval, reshape, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeluxeTable

public DeluxeTable(DeluxeTableModel model)
A DeluxeTable will only accept a TableModel of the Deluxe variety.
Method Detail

setMaximumColumnWidth

public void setMaximumColumnWidth(int num)
set the maximum column width to be applied to all columns. used as a sort of stopgap sanity-check to keep tables from getting out of hand
Parameters:
num - the maximum width of all columns, in pixels

getToolTipText

public final java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
Implementation of getToolTipText to return tooltips
Overrides:
getToolTipText in class javax.swing.JTable

doPopup

protected void doPopup(java.awt.event.MouseEvent evt,
                       int row,
                       int col)
subclasses should override this if they want popup menus. This method does nothing by default.

doDoubleClick

protected void doDoubleClick(java.awt.event.MouseEvent evt,
                             int row,
                             int col)
subclasses should override this if they want double click actions. This method does nothing by default.

handlePopupEvent

public final void handlePopupEvent(java.awt.event.MouseEvent evt)
this method is called by the default mouse event listener on popup triggers

handleDoubleClickEvent

public final void handleDoubleClickEvent(java.awt.event.MouseEvent evt)
this method is called by the default mouse event listener on double clicks

setSelectedRow

public final boolean setSelectedRow(java.lang.Object content,
                                    int col)
Set the selected row based on the contents of a column Failure to find a match results in the selection being cleared for this table.
Parameters:
content - the contents to match
col - the column to search in
Returns:
success or failure to find a match

setVisibleRowCount

public final void setVisibleRowCount(int rows)
Set the number of visible rows, ala JList
Parameters:
rows - the number of visible rows, not counting the table header
See Also:
JList

autoSizeColumns

public final void autoSizeColumns()
Cause the columns of the tables to automatically size themselves, resizing the table as a whole if necessary. Equivalent to: autoSizeColumns( true, true );

autoSizeColumns

public final void autoSizeColumns(boolean allowShrink,
                                  boolean allowGrow)
Cause the columns of the table to automatically size themselves.
Parameters:
allowShrink - if true, the table will shrink if the total column widths decreases. otherwise the table will remain the same size
allowGrow - if true, the table will grow if the total column widths increases. otherwise the table will remain the same size.

getTableAsString

public java.lang.String getTableAsString()
dump the table as a long, formatted string. Simply calls _deluxeModel.getModelAsString()
See Also:
DeluxeTableModel.getModelAsString()