Groovy Documentation

com.wordpress.tipsforjava.swing.table
[Java] Class RXTable

java.lang.Object
  java.awt.Component
      java.awt.Container
          javax.swing.JComponent
              javax.swing.JTable
                  com.wordpress.tipsforjava.swing.table.RXTable

public class RXTable
extends JTable

The RXTable provides some extensions to the default JTable 1) Select All editing - when a text related cell is placed in editing mode the text is selected. Controlled by invoking a "setSelectAll..." method. 2) reorderColumns - static convenience method for reodering table columns

Authors:
Rob Camick
Darryl Burke


Field Summary
private boolean isSelectAllForActionEvent

private boolean isSelectAllForKeyEvent

private boolean isSelectAllForMouseEvent

 
Fields inherited from class JTable
AUTO_RESIZE_OFF, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_SUBSEQUENT_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT
 
Fields inherited from class JComponent
WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT
 
Constructor Summary
RXTable()

Constructs a default RXTable that is initialized with a default data model, a default column model, and a default selection model.

RXTable(TableModel dm)

Constructs a RXTable that is initialized with dm as the data model, a default column model, and a default selection model.

RXTable(TableModel dm, TableColumnModel cm)

Constructs a RXTable that is initialized with dm as the data model, cm as the column model, and a default selection model.

RXTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)

Constructs a RXTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model.

RXTable(int numRows, int numColumns)

Constructs a RXTable with numRows and numColumns of empty cells using DefaultTableModel.

RXTable(Vector rowData, Vector columnNames)

Constructs a RXTable to display the values in the Vector of Vectors, rowData, with column names, columnNames.

RXTable(Object[] rowData, Object[] columnNames)

Constructs a RXTable to display the values in the two dimensional array, rowData, with column names, columnNames.

 
Method Summary
boolean editCellAt(int row, int column, EventObject e)

static void reorderColumns(JTable table, Object... columnNames)

Convenience method to order the table columns of a table.

private void selectAll(EventObject e)

void setSelectAllForActionEvent(boolean isSelectAllForActionEvent)

void setSelectAllForEdit(boolean isSelectAllForEdit)

void setSelectAllForKeyEvent(boolean isSelectAllForKeyEvent)

void setSelectAllForMouseEvent(boolean isSelectAllForMouseEvent)

 
Methods inherited from class JTable
print, print, print, print, print, doLayout, addNotify, removeNotify, getAccessibleContext, setUI, updateUI, getUIClassID, getUI, setModel, getModel, getToolTipText, getRowCount, getColumnCount, getColumnName, getColumnClass, isCellEditable, getValueAt, setValueAt, clearSelection, getSelectionModel, setSelectionModel, getCellRenderer, setCellEditor, getCellEditor, getCellEditor, addColumn, removeColumn, moveColumn, getColumn, setColumnSelectionAllowed, getColumnSelectionAllowed, getSelectedColumns, getSelectedColumnCount, tableChanged, getDefaultRenderer, setDragEnabled, getDragEnabled, setDropMode, getDropMode, getDropLocation, selectAll, getPreferredScrollableViewportSize, getScrollableUnitIncrement, getScrollableBlockIncrement, getScrollableTracksViewportWidth, getScrollableTracksViewportHeight, getPrintable, getRowHeight, getRowHeight, sorterChanged, createScrollPaneForTable, setTableHeader, getTableHeader, setRowHeight, setRowHeight, setRowMargin, getRowMargin, setIntercellSpacing, getIntercellSpacing, setGridColor, getGridColor, setShowGrid, setShowHorizontalLines, setShowVerticalLines, getShowHorizontalLines, getShowVerticalLines, setAutoResizeMode, getAutoResizeMode, setAutoCreateColumnsFromModel, getAutoCreateColumnsFromModel, createDefaultColumnsFromModel, setDefaultRenderer, setDefaultEditor, getDefaultEditor, setAutoCreateRowSorter, getAutoCreateRowSorter, setUpdateSelectionOnSort, getUpdateSelectionOnSort, setRowSorter, getRowSorter, setSelectionMode, setRowSelectionAllowed, getRowSelectionAllowed, setCellSelectionEnabled, getCellSelectionEnabled, setRowSelectionInterval, setColumnSelectionInterval, addRowSelectionInterval, addColumnSelectionInterval, removeRowSelectionInterval, removeColumnSelectionInterval, getSelectedRow, getSelectedColumn, getSelectedRows, getSelectedRowCount, isRowSelected, isColumnSelected, isCellSelected, changeSelection, getSelectionForeground, setSelectionForeground, getSelectionBackground, setSelectionBackground, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToView, convertRowIndexToModel, columnAtPoint, rowAtPoint, getCellRect, sizeColumnsToFit, sizeColumnsToFit, setSurrendersFocusOnKeystroke, getSurrendersFocusOnKeystroke, editCellAt, editCellAt, isEditing, getEditorComponent, getEditingColumn, getEditingRow, setColumnModel, getColumnModel, columnAdded, columnRemoved, columnMoved, columnMarginChanged, columnSelectionChanged, valueChanged, editingStopped, editingCanceled, setPreferredScrollableViewportSize, setFillsViewportHeight, getFillsViewportHeight, setEditingColumn, setEditingRow, prepareRenderer, prepareEditor, removeEditor, contains, getLocation, print, getSize, isOpaque, enable, disable, update, getY, getX, getInsets, getInsets, setFont, getPreferredSize, getMinimumSize, getMaximumSize, getAlignmentX, getAlignmentY, paint, getListeners, setFocusTraversalKeys, requestFocus, requestFocus, firePropertyChange, firePropertyChange, firePropertyChange, setEnabled, isDoubleBuffered, setVisible, setForeground, setBackground, getBounds, reshape, getWidth, getHeight, setPreferredSize, setMinimumSize, setMaximumSize, getBaseline, getBaselineResizeBehavior, getGraphics, getFontMetrics, repaint, repaint, printAll, requestFocusInWindow, addAncestorListener, setInheritsPopupMenu, getInheritsPopupMenu, setComponentPopupMenu, getComponentPopupMenu, isPaintingTile, isPaintingForPrint, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setBorder, getBorder, setAlignmentY, setAlignmentX, setInputVerifier, getInputVerifier, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, getDefaultLocale, setDefaultLocale, setToolTipText, getToolTipText, getToolTipLocation, getPopupLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, setTransferHandler, getTransferHandler, getClientProperty, putClientProperty, isLightweightComponent, setOpaque, computeVisibleRect, getVisibleRect, addVetoableChangeListener, removeVetoableChangeListener, getVetoableChangeListeners, getTopLevelAncestor, removeAncestorListener, getAncestorListeners, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, getRootPane, add, add, add, add, add, remove, remove, list, list, removeAll, getComponent, invalidate, validate, getComponentCount, countComponents, getComponents, insets, setComponentZOrder, getComponentZOrder, getLayout, setLayout, layout, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, getContainerListeners, deliverEvent, getComponentAt, getComponentAt, locate, getMousePosition, findComponentAt, findComponentAt, isAncestorOf, getFocusTraversalKeys, areFocusTraversalKeysSet, isFocusCycleRoot, isFocusCycleRoot, transferFocusBackward, setFocusTraversalPolicy, getFocusTraversalPolicy, isFocusTraversalPolicySet, setFocusCycleRoot, setFocusTraversalPolicyProvider, isFocusTraversalPolicyProvider, transferFocusDownCycle, applyComponentOrientation, addPropertyChangeListener, addPropertyChangeListener, add, toString, getName, contains, size, getParent, getLocation, remove, setName, list, list, list, getSize, resize, resize, setSize, setSize, enable, location, isValid, setLocale, action, getMousePosition, getGraphicsConfiguration, dispatchEvent, isVisible, isEnabled, isDisplayable, isFocusable, getTreeLock, isLightweight, getPeer, isFocusOwner, transferFocus, getFont, isPreferredSizeSet, isMinimumSizeSet, isMaximumSizeSet, isShowing, handleEvent, postEvent, getFocusCycleRootAncestor, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, setDropTarget, getDropTarget, getToolkit, enableInputMethods, show, show, hide, getForeground, isForegroundSet, getBackground, isBackgroundSet, isFontSet, getLocale, getColorModel, getLocationOnScreen, setLocation, setLocation, move, getBounds, bounds, setBounds, setBounds, setCursor, getCursor, isCursorSet, paintAll, repaint, repaint, repaint, imageUpdate, createImage, createImage, createVolatileImage, createVolatileImage, prepareImage, prepareImage, checkImage, checkImage, setIgnoreRepaint, getIgnoreRepaint, inside, addComponentListener, removeComponentListener, getComponentListeners, addFocusListener, removeFocusListener, getFocusListeners, addHierarchyListener, removeHierarchyListener, getHierarchyListeners, addHierarchyBoundsListener, removeHierarchyBoundsListener, getHierarchyBoundsListeners, addKeyListener, removeKeyListener, getKeyListeners, addMouseListener, removeMouseListener, getMouseListeners, addMouseMotionListener, removeMouseMotionListener, getMouseMotionListeners, addMouseWheelListener, removeMouseWheelListener, getMouseWheelListeners, addInputMethodListener, removeInputMethodListener, getInputMethodListeners, getInputMethodRequests, getInputContext, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, gotFocus, lostFocus, isFocusTraversable, setFocusable, setFocusTraversalKeysEnabled, getFocusTraversalKeysEnabled, nextFocus, transferFocusUpCycle, hasFocus, removePropertyChangeListener, removePropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, setComponentOrientation, getComponentOrientation, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 
Methods inherited from class JComponent
contains, getLocation, print, getSize, isOpaque, enable, disable, update, getY, getX, getInsets, getInsets, setFont, getPreferredSize, getMinimumSize, getMaximumSize, getAlignmentX, getAlignmentY, paint, getListeners, addNotify, removeNotify, setFocusTraversalKeys, requestFocus, requestFocus, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, setEnabled, isDoubleBuffered, setVisible, setForeground, setBackground, getBounds, reshape, getWidth, getHeight, setPreferredSize, setMinimumSize, setMaximumSize, getBaseline, getBaselineResizeBehavior, getGraphics, getFontMetrics, repaint, repaint, printAll, requestFocusInWindow, updateUI, getUIClassID, addAncestorListener, setInheritsPopupMenu, getInheritsPopupMenu, setComponentPopupMenu, getComponentPopupMenu, isPaintingTile, isPaintingForPrint, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setBorder, getBorder, setAlignmentY, setAlignmentX, setInputVerifier, getInputVerifier, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, getDefaultLocale, setDefaultLocale, setToolTipText, getToolTipText, getToolTipText, getToolTipLocation, getPopupLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, setTransferHandler, getTransferHandler, getClientProperty, putClientProperty, isLightweightComponent, setOpaque, computeVisibleRect, getVisibleRect, addVetoableChangeListener, removeVetoableChangeListener, getVetoableChangeListeners, getTopLevelAncestor, removeAncestorListener, getAncestorListeners, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, getRootPane, add, add, add, add, add, remove, remove, list, list, removeAll, getComponent, invalidate, validate, getComponentCount, countComponents, getComponents, insets, setComponentZOrder, getComponentZOrder, getLayout, setLayout, doLayout, layout, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, getContainerListeners, deliverEvent, getComponentAt, getComponentAt, locate, getMousePosition, findComponentAt, findComponentAt, isAncestorOf, getFocusTraversalKeys, areFocusTraversalKeysSet, isFocusCycleRoot, isFocusCycleRoot, transferFocusBackward, setFocusTraversalPolicy, getFocusTraversalPolicy, isFocusTraversalPolicySet, setFocusCycleRoot, setFocusTraversalPolicyProvider, isFocusTraversalPolicyProvider, transferFocusDownCycle, applyComponentOrientation, addPropertyChangeListener, addPropertyChangeListener, add, toString, getName, contains, size, getParent, getLocation, remove, setName, list, list, list, getSize, resize, resize, setSize, setSize, enable, location, isValid, setLocale, action, getMousePosition, getGraphicsConfiguration, dispatchEvent, isVisible, isEnabled, isDisplayable, isFocusable, getTreeLock, isLightweight, getPeer, isFocusOwner, transferFocus, getFont, isPreferredSizeSet, isMinimumSizeSet, isMaximumSizeSet, isShowing, handleEvent, postEvent, getFocusCycleRootAncestor, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, setDropTarget, getDropTarget, getToolkit, enableInputMethods, show, show, hide, getForeground, isForegroundSet, getBackground, isBackgroundSet, isFontSet, getLocale, getColorModel, getLocationOnScreen, setLocation, setLocation, move, getBounds, bounds, setBounds, setBounds, setCursor, getCursor, isCursorSet, paintAll, repaint, repaint, repaint, imageUpdate, createImage, createImage, createVolatileImage, createVolatileImage, prepareImage, prepareImage, checkImage, checkImage, setIgnoreRepaint, getIgnoreRepaint, inside, addComponentListener, removeComponentListener, getComponentListeners, addFocusListener, removeFocusListener, getFocusListeners, addHierarchyListener, removeHierarchyListener, getHierarchyListeners, addHierarchyBoundsListener, removeHierarchyBoundsListener, getHierarchyBoundsListeners, addKeyListener, removeKeyListener, getKeyListeners, addMouseListener, removeMouseListener, getMouseListeners, addMouseMotionListener, removeMouseMotionListener, getMouseMotionListeners, addMouseWheelListener, removeMouseWheelListener, getMouseWheelListeners, addInputMethodListener, removeInputMethodListener, getInputMethodListeners, getInputMethodRequests, getInputContext, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, gotFocus, lostFocus, isFocusTraversable, setFocusable, setFocusTraversalKeysEnabled, getFocusTraversalKeysEnabled, nextFocus, transferFocusUpCycle, hasFocus, removePropertyChangeListener, removePropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, setComponentOrientation, getComponentOrientation, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 

Field Detail

isSelectAllForActionEvent

private boolean isSelectAllForActionEvent


isSelectAllForKeyEvent

private boolean isSelectAllForKeyEvent


isSelectAllForMouseEvent

private boolean isSelectAllForMouseEvent


 
Constructor Detail

RXTable

public RXTable()
Constructs a default RXTable that is initialized with a default data model, a default column model, and a default selection model.


RXTable

public RXTable(TableModel dm)
Constructs a RXTable that is initialized with dm as the data model, a default column model, and a default selection model.
Parameters:
dm - the data model for the table


RXTable

public RXTable(TableModel dm, TableColumnModel cm)
Constructs a RXTable that is initialized with dm as the data model, cm as the column model, and a default selection model.
Parameters:
dm - the data model for the table
cm - the column model for the table


RXTable

public RXTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
Constructs a RXTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model. If any of the parameters are null this method will initialize the table with the corresponding default model. The autoCreateColumnsFromModel flag is set to false if cm is non-null, otherwise it is set to true and the column model is populated with suitable TableColumns for the columns in dm.
Parameters:
dm - the data model for the table
cm - the column model for the table
sm - the row selection model for the table


RXTable

public RXTable(int numRows, int numColumns)
Constructs a RXTable with numRows and numColumns of empty cells using DefaultTableModel. The columns will have names of the form "A", "B", "C", etc.
Parameters:
numRows - the number of rows the table holds
numColumns - the number of columns the table holds


RXTable

public RXTable(Vector rowData, Vector columnNames)
Constructs a RXTable to display the values in the Vector of Vectors, rowData, with column names, columnNames. The Vectors contained in rowData should contain the values for that row. In other words, the value of the cell at row 1, column 5 can be obtained with the following code:

((Vector)rowData.elementAt(1)).elementAt(5);

Parameters:
rowData - the data for the new table
columnNames - names of each column


RXTable

public RXTable(Object[] rowData, Object[] columnNames)
Constructs a RXTable to display the values in the two dimensional array, rowData, with column names, columnNames. rowData is an array of rows, so the value of the cell at row 1, column 5 can be obtained with the following code:

 rowData[1][5]; 

All rows must be of the same length as columnNames.

Parameters:
rowData - the data for the new table
columnNames - names of each column


 
Method Detail

editCellAt

public boolean editCellAt(int row, int column, EventObject e)


reorderColumns

public static void reorderColumns(JTable table, Object... columnNames)
Convenience method to order the table columns of a table. The columns are ordered based on the column names specified in the array. If the column name is not found then no column is moved. This means you can specify a null value to preserve the current order of a given column.
Parameters:
table - the table containing the columns to be sorted
columnNames - an array containing the column names in the order they should be displayed


selectAll

private void selectAll(EventObject e)


setSelectAllForActionEvent

public void setSelectAllForActionEvent(boolean isSelectAllForActionEvent)


setSelectAllForEdit

public void setSelectAllForEdit(boolean isSelectAllForEdit)


setSelectAllForKeyEvent

public void setSelectAllForKeyEvent(boolean isSelectAllForKeyEvent)


setSelectAllForMouseEvent

public void setSelectAllForMouseEvent(boolean isSelectAllForMouseEvent)


 

Groovy Documentation