com.retek.commons.gui.table
Class RDisplayTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JTable
                  extended bycom.retek.commons.gui.table.RDisplayTable
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.CellEditorListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, javax.swing.event.ListSelectionListener, java.awt.MenuContainer, java.awt.event.MouseListener, javax.swing.Scrollable, java.io.Serializable, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener

public class RDisplayTable
extends javax.swing.JTable
implements java.awt.event.KeyListener, java.awt.event.MouseListener

This class subclasses the standard JTable class in the Swing package to provide custom functionality for the Rcom client application. This functionality includes allowing the tab key to exit a table instead of going between cells. Each cell of a RDisplayTable must contain a RDisplayTableCell. This table is only capable of displaying and the cells can never be editable.

Retek Inc. Copyright (c) 2002

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int MULTI_ROWS
           
static int NO_ROWS
           
static int SINGLE_ROW
           
static java.lang.String TABLE_LIMIT_ERROR
           
static java.lang.String TABLE_MESSAGE
           
static java.lang.String TABLE_SORTED
           
static java.lang.String TABLE_SORTING
           
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RDisplayTable()
          Returns new RDisplayTable object.
 
Method Summary
 void addRow(RDisplayTableCell[] rowArray)
          Adds a row of data to the table.
 void addRow(java.lang.String[] rowArray)
          Adds a row of data to the table.
 void addRow(java.lang.String[] rowArray, int column, java.lang.Object secondaryData)
          Deprecated. This method will be removed in the future. Please change call code using this method to use column names instead of indexes.
 void addRow(java.lang.String[] rowArray, java.lang.String columnName, java.lang.Object secondaryData)
          Adds a row of data to the table.
 void buildColumn(java.lang.String name, int type, int minSize, int maxSize)
          Builds a table column.
 void buildColumn(java.lang.String name, int type, int minSize, int prefSize, int maxSize)
          Builds a table column.
 void buildColumns(java.lang.String[] columnArray)
          Builds all columns in a string arrays to default settings.
 void clearBooleanColumn(java.lang.String columnName)
          Clears all values in a boolean-type column - setting all values to "false".
 void clearTable()
          Clears the entire table of rows.
 void disableColumnSorting()
          Disables column sorting in the table.
 void enableColumnSorting()
          Enables column sorting in the table.
 void fillTable(java.util.List list)
          Sets the entire table data from a single List.
 void fillTable(java.util.List list, java.awt.Color color)
          Sets the entire table data from a single list.
 java.util.List getAllSecondaryData(java.lang.String columnName)
          Retrieves all the secondary objects stored within the given column for the entire table.
 java.util.List getAllSelectedSecondaryData(java.lang.String columnName)
          Retrieves all the selected secondary objects stored within the given column.
 java.lang.String getCellValueAt(int row, int column)
          Retrieves the value within a cell as a string.
 RDisplayTableCell[] getFullRowData(int row)
          Retrieves the entire row data for a given row number.
 java.util.ArrayList getFullTableData()
          Gathers all the data inside the table (without turning it into a string array).
 int getLastRowNumber()
          Retrieves the last row number of the table.
 java.lang.String[] getRowData(int rowNumber)
          Retrieves all the row data as a string array given a row number.
 int getRowNumber(java.lang.String columnName, java.lang.Object object)
          Retrieves the row number for a value searching the specified column.
 int getRowNumber(java.lang.String columnName, java.lang.String value)
          Retrieves the row number for a value searching the specified column.
 java.lang.Object getSecondaryData(int row, int column)
          Retrieves the secondary data object stored in a cell for the selected row and the given column name.
 java.lang.Object getSecondaryData(int row, java.lang.String columnName)
          Retrieves the secondary data object stored in a cell for the given row number and column name.
 java.lang.String[] getSelectedColumnData(java.lang.String columnName)
          Retrieves selected column data for a column name.
 java.lang.String[] getSelectedRowData()
          Retrieves the selected row data.
 java.lang.Object getSelectedSecondaryData(java.lang.String columnName)
          Retrieves the secondary data object stored in a cell for the selected row and the given column name.
 RDisplayTableModel getTableModel()
          Retrieves the RDisplayTableModel from the table.
 void insertRow(RDisplayTableCell[] rowArray, int rowNumber)
          Inserts a row of data into the table.
 void insertRow(java.lang.String[] rowArray, java.lang.String columnName, java.lang.Object data, int rowNumber)
          Inserts a row of data into the table.
 boolean isEmpty()
          Returns true if the table is empty.
 void keyPressed(java.awt.event.KeyEvent keyEvent)
          Implements the key listener interface 'key pressed' method.
 void keyReleased(java.awt.event.KeyEvent keyEvent)
          Empty implementation of the key listener interface method.
 void keyTyped(java.awt.event.KeyEvent keyEvent)
          Empty implementation of the mouse listener interface method.
 void mouseClicked(java.awt.event.MouseEvent mouseEvent)
          Implement the mouse listener interface 'mouse clicked' method.
 void mouseEntered(java.awt.event.MouseEvent event)
          Empty implementation of the mouse listener interface method.
 void mouseExited(java.awt.event.MouseEvent event)
          Empty implementation of the mouse listener interface method.
 void mousePressed(java.awt.event.MouseEvent event)
          Empty implementation of the mouse listener interface method.
 void mouseReleased(java.awt.event.MouseEvent event)
          Empty implementation of the mouse listener interface method.
 void removeDoubleClickAction()
          Removes the double click action event from the table.
 void removeMessageListener()
          Removes the message listener from the table.
 void removeRow(int rowNumber)
          Removes a row from the table.
 void removeRow(java.lang.String columnName, java.lang.String columnValue)
          Removes each row from the table based on values found within a column.
 void removeRowBySecondaryData(java.lang.String columnName, java.lang.Object data)
          Removes each row from the table based on the secondary value within the column.
 void removeRowsBySecondaryData(java.lang.String columnName, java.util.Collection data)
          Removes each row from the table based on the secondary value within the column.
 void removeSelectedRow()
          Removes the currently selected row from the table.
 void removeSelectedRows()
          Removes all currently selected rows from the table.
 void removeSingleClickAction()
          Removes the single click action event from the table.
 void resetSortColumnArrows()
          Resets the default sorted column arrows.
 void resetTable()
          Clears the entire table of rows.
 void resort()
          Resorts the table.
 void setAvailableWidth(int width)
          Sets the available width of the table.
 void setCellType(int rowNumber, java.lang.String columnName, int type)
          Sets the type information in a single cell within the table.
 void setCellValue(int row, java.lang.String columnName, java.lang.String value)
          Sets the value information for a single cell in the table.
 void setColumnBackgroundColor(java.lang.String columnName, java.awt.Color color)
          Assigns a background color to a particular column.
 void setColumnForegroundColor(java.lang.String columnName, java.awt.Color color)
          Assigns a foreground color to a particular column.
 void setColumnSortDirection(boolean[] sortOrderArray)
          Sets the sort order of each sortable columns within the table.
 void setColumnSortDirection(java.lang.String columnName, boolean isAscending)
          Sets the sort order of a specific column in the table.
 void setColumnSortOrder(java.lang.String[] columnNames)
          Sets the order of columns sorted within the table.
 void setColumnType(java.lang.String columnName, int columnType)
          Assigns a cell type for an entire column.
 void setDoubleClickAction(REventListener listener, java.lang.String command)
          Assigns an action to be sent when a row is double-clicked or a row is selected and the enter key is pressed.
 void setMask(java.lang.String columnName, Mask formatMask)
          Assigns a formatted mask to all table cells within a column.
 void setMessageListener(REventListener listener)
          Assigns a message listener to the table.
 void setMobileColumns(boolean mobileColumns)
          Sets whether or not column re-ordering is allowed.
 void setRowSelection(int row)
          Sets a single row as the row selection by row number (which begins at zero).
 void setRowSelection(java.lang.String columnName, java.lang.Object secondaryData)
          Selects a row based on column name and an object.
 void setRowSelectionMode(int mode)
          Sets the table row selection mode, which determines the number of rows that can be selected.
 void setSecondaryData(int row, int column, java.lang.Object object)
          Sets the secondary data to store in the cell.
 void setSecondaryData(int row, java.lang.String columnName, java.lang.Object object)
          Sets the secondary data to store in the cell.
 void setSingleClickAction(REventListener listener, java.lang.String command)
          Assigns an action to be sent when a row is selected through key navigation or a single click.
 void setTableModel(java.lang.String[] headers)
          Sets the table model for the table.
 void updateRow(RDisplayTableCell[] rowArray, int rowNumber)
          Updates a row of data in the table.
 void updateRow(java.lang.String[] rowArray, int rowNumber)
          Updates a row of data in the table using a String array and preserving the other values assigned to the RDisplayTableCell.
 void updateRow(java.lang.String[] rowArray, java.lang.String columnName, java.lang.Object object)
          Updates a row of data in the table using a String array and a secondary data object in the table.
 void valueChanged(javax.swing.event.ListSelectionEvent event)
          Overrides the JTable list selection event and notifies single action listener of the event.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Field Detail

TABLE_LIMIT_ERROR

public static final java.lang.String TABLE_LIMIT_ERROR
See Also:
Constant Field Values

TABLE_MESSAGE

public static final java.lang.String TABLE_MESSAGE
See Also:
Constant Field Values

TABLE_SORTING

public static final java.lang.String TABLE_SORTING
See Also:
Constant Field Values

TABLE_SORTED

public static final java.lang.String TABLE_SORTED
See Also:
Constant Field Values

NO_ROWS

public static final int NO_ROWS
See Also:
Constant Field Values

SINGLE_ROW

public static final int SINGLE_ROW
See Also:
Constant Field Values

MULTI_ROWS

public static final int MULTI_ROWS
See Also:
Constant Field Values
Constructor Detail

RDisplayTable

public RDisplayTable()
Returns new RDisplayTable object.

Method Detail

setTableModel

public void setTableModel(java.lang.String[] headers)
Sets the table model for the table.

Parameters:
headers - A string array containing the column headers.

getTableModel

public RDisplayTableModel getTableModel()
Retrieves the RDisplayTableModel from the table.

Returns:
The RDisplayTableModel assigned to the table.

setRowSelectionMode

public void setRowSelectionMode(int mode)
Sets the table row selection mode, which determines the number of rows that can be selected. Valid selection modes are: NO_ROWS, SINGLE_ROW, and MULTI_ROWS. The default mode is SINGLE_ROW.

Parameters:
mode - The selection mode to assign to the table.

setMobileColumns

public void setMobileColumns(boolean mobileColumns)
Sets whether or not column re-ordering is allowed. This determines whether or not the user can drag the columns around the table, thus placing them in a different order.

Parameters:
mobileColumns - True if columns should allow re-ordering, false if they should not.

setAvailableWidth

public void setAvailableWidth(int width)
Sets the available width of the table. If this value is greater than zero, then the table will calculate the size of the header and place a scrollbar on the table if it exceeds the available space.

Note: This could be updated to subtract the system scrollbar width instead of SCROLLBAR_PAD.

Parameters:
width - The available width of the table in pixels.

enableColumnSorting

public void enableColumnSorting()
Enables column sorting in the table. Column sorting is enabled by default. The remove method is called first to keep from adding multiple column sorting listeners by repeatedly calling this method.


disableColumnSorting

public void disableColumnSorting()
Disables column sorting in the table. Column sorting is enabled by default.


setColumnSortOrder

public void setColumnSortOrder(java.lang.String[] columnNames)
Sets the order of columns sorted within the table.

Parameters:
columnNames - An array of column names to assign as the default sort order.

setColumnSortDirection

public void setColumnSortDirection(boolean[] sortOrderArray)
Sets the sort order of each sortable columns within the table.

Parameters:
sortOrderArray - An array of boolean values (true = ascending, false = descending).

setColumnSortDirection

public void setColumnSortDirection(java.lang.String columnName,
                                   boolean isAscending)
Sets the sort order of a specific column in the table.

Parameters:
columnName - The column name.
isAscending - True if ascending is desired, false if not.

setMessageListener

public void setMessageListener(REventListener listener)
Assigns a message listener to the table. This listener receives all internal table messages as RActionEvents.

Parameters:
listener - The listener to assign to the table.

removeMessageListener

public void removeMessageListener()
Removes the message listener from the table.


setSingleClickAction

public void setSingleClickAction(REventListener listener,
                                 java.lang.String command)
Assigns an action to be sent when a row is selected through key navigation or a single click. The command will be sent to the listener.

Parameters:
listener - The listener to assign to the table to receive single click actions.
command - The command to send in the action event.

removeSingleClickAction

public void removeSingleClickAction()
Removes the single click action event from the table. No action will be sent for row selections.


setDoubleClickAction

public void setDoubleClickAction(REventListener listener,
                                 java.lang.String command)
Assigns an action to be sent when a row is double-clicked or a row is selected and the enter key is pressed. The command will be sent to the listener inside an RActionEvent.

Parameters:
listener - The listener to assign to the table to receive single click actions.
command - The command to send in the action event.

removeDoubleClickAction

public void removeDoubleClickAction()
Removes the double click action event from the table. No action will be sent when double-clicking on a row.


buildColumns

public void buildColumns(java.lang.String[] columnArray)
Builds all columns in a string arrays to default settings.


buildColumn

public void buildColumn(java.lang.String name,
                        int type,
                        int minSize,
                        int maxSize)
Builds a table column.

Parameters:
minSize - Minimum width in pixels the column should allow.
maxSize - Maximum width in pixels the column should allow.

buildColumn

public void buildColumn(java.lang.String name,
                        int type,
                        int minSize,
                        int prefSize,
                        int maxSize)
Builds a table column. In the case of a column without a header title to display, the column is assigned its index internally for reference. No header title will be displayed.

For sizes: -1 Means Ignore, 0 means set to default, positive number means set to value

Parameters:
minSize - Minimum width in pixels the column should allow.
prefSize - Preferred width in pixels the column should have upon creation.
maxSize - Maximum width in pixels the column should allow.

setMask

public void setMask(java.lang.String columnName,
                    Mask formatMask)
Assigns a formatted mask to all table cells within a column.

Parameters:
formatMask - The format mask to assign to the column.

setColumnBackgroundColor

public void setColumnBackgroundColor(java.lang.String columnName,
                                     java.awt.Color color)
Assigns a background color to a particular column.

Parameters:
color - The color to assign to the coloumn.

setColumnForegroundColor

public void setColumnForegroundColor(java.lang.String columnName,
                                     java.awt.Color color)
Assigns a foreground color to a particular column.

Parameters:
color - The color to assign to the coloumn.

getCellValueAt

public java.lang.String getCellValueAt(int row,
                                       int column)
Retrieves the value within a cell as a string.

Parameters:
row - The row index of the cell.
column - The column index of the cell.
Returns:
The value contained within the cell at the given row and column.
Throws:
java.lang.IllegalStateException - Thrown if the cell does not exists or does not contain an RDisplayTableCell object.

getRowNumber

public int getRowNumber(java.lang.String columnName,
                        java.lang.String value)
Retrieves the row number for a value searching the specified column.

Parameters:
columnName - The column name to retrieve selections from.
value - The value to match in the column.
Returns:
The row number corresponding to the column and value.

getRowNumber

public int getRowNumber(java.lang.String columnName,
                        java.lang.Object object)
Retrieves the row number for a value searching the specified column.

Parameters:
columnName - The column name to retrieve selections from.
object - An object to find within the column.
Returns:
The row number corresponding to the column and value.

getSelectedColumnData

public java.lang.String[] getSelectedColumnData(java.lang.String columnName)
Retrieves selected column data for a column name. This retrieves all the values in a a column identified by columnName that have their rows selected.

Parameters:
columnName - The column name to retrieve selections from.
Returns:
A string array containing the selected column data.

getSelectedRowData

public java.lang.String[] getSelectedRowData()
Retrieves the selected row data. This only works when the table is in single selection mode. If in multiple selection mode, this will return the data of the first selected row, but none of the additional selected rows. This method returns an empty array if no row is selected.

Returns:
An array containing the string representations of the row data.

getAllSecondaryData

public java.util.List getAllSecondaryData(java.lang.String columnName)
Retrieves all the secondary objects stored within the given column for the entire table. This returns an empty list if the table is empty.

Parameters:
columnName - The column name to retrieve the secondary data object from.
Returns:
A list of secondary objects stored within the table.

getAllSelectedSecondaryData

public java.util.List getAllSelectedSecondaryData(java.lang.String columnName)
Retrieves all the selected secondary objects stored within the given column. This returns an empty list if the table is empty.

Parameters:
columnName - The column name to retrieve the secondary data object from.
Returns:
A list of selected secondary objects stored within the table.

getSelectedSecondaryData

public java.lang.Object getSelectedSecondaryData(java.lang.String columnName)
Retrieves the secondary data object stored in a cell for the selected row and the given column name. This returns null if no row is selected.

Parameters:
columnName - The column name to retrieve the secondary data object from.
Returns:
A secondary object stored within the table cell.

getSecondaryData

public java.lang.Object getSecondaryData(int row,
                                         java.lang.String columnName)
Retrieves the secondary data object stored in a cell for the given row number and column name.

Parameters:
row - The row number of the cell to retrieve the data object from.
columnName - The column name to retrieve the secondary data object from.
Returns:
A secondary object stored within the table cell.

getSecondaryData

public java.lang.Object getSecondaryData(int row,
                                         int column)
Retrieves the secondary data object stored in a cell for the selected row and the given column name. This returns null if no row is selected.

Parameters:
row - The row number of the cell to retrieve the data object from.
column - The column index of the cell to retrieve the secondary data object from.
Returns:
A secondary object stored within the table cell.

getRowData

public java.lang.String[] getRowData(int rowNumber)
Retrieves all the row data as a string array given a row number.

Parameters:
rowNumber - The row number of the row to retrieve.
Returns:
An string array containing the string representation of each cell in the row.

getFullRowData

public RDisplayTableCell[] getFullRowData(int row)
Retrieves the entire row data for a given row number. This means retrieving the RDisplayTableCell object for each cell within the row. If an exception occurs, such as NullPointer or ClassCast, throw an IllegalStateException to indicate that the table has been used improperly.

Parameters:
row - The row index to retrieve data for.
Returns:
A RDisplayTableCell array containing the data of each cell in the row.

getFullTableData

public java.util.ArrayList getFullTableData()
Gathers all the data inside the table (without turning it into a string array). This will return a giant list of arrays of RDisplayTableCell objects. Each array represents a row and each RDisplayTableCell represents a single cell.

Returns:
An list containing rows of data represented by RDisplayTableCell arrays.

setColumnType

public void setColumnType(java.lang.String columnName,
                          int columnType)
Assigns a cell type for an entire column. This updates the cell information for each cell within the column (and any future cells in the column).

Parameters:
columnName - The name of the column to update.
columnType - Type the column should be: STRING, DATE or NUMBER.

setCellType

public void setCellType(int rowNumber,
                        java.lang.String columnName,
                        int type)
Sets the type information in a single cell within the table.

Parameters:
rowNumber - The row number to update.
columnName - The name of the column to update.
type - The new type to put in the cell (TEXT, NUMBER or DATE).

setCellValue

public void setCellValue(int row,
                         java.lang.String columnName,
                         java.lang.String value)
Sets the value information for a single cell in the table.

Parameters:
row - The row index to update.
columnName - The name of the column to update.
value - The new value to put in the cell.

setSecondaryData

public void setSecondaryData(int row,
                             java.lang.String columnName,
                             java.lang.Object object)
Sets the secondary data to store in the cell.

Parameters:
row - The row index to store the secondary data in.
columnName - The name of the column to store the secondary data in.
object - The data object to store in the cell.

setSecondaryData

public void setSecondaryData(int row,
                             int column,
                             java.lang.Object object)
Sets the secondary data to store in the cell.

Parameters:
row - The row index to store the secondary data in.
column - The column index to store the secondary data in.
object - The data object to store in the cell.

clearBooleanColumn

public void clearBooleanColumn(java.lang.String columnName)
Clears all values in a boolean-type column - setting all values to "false".

Parameters:
columnName - The name of the column to update.

setRowSelection

public void setRowSelection(int row)
Sets a single row as the row selection by row number (which begins at zero).

Parameters:
row - The row number to select.

setRowSelection

public void setRowSelection(java.lang.String columnName,
                            java.lang.Object secondaryData)
Selects a row based on column name and an object. It searches each row and checks the paramater object against the secondary data stored in the row. If a match is found, the row is selected and the method stops.

Parameters:
columnName - The name of the column to search.
secondaryData - The object to seek in secondary data within the column.

addRow

public void addRow(java.lang.String[] rowArray)
Adds a row of data to the table. This method accepts a string array that represents a single row. It is converted into an array of RDisplayTableCell objects in which each RDisplayTable Cell represents a single cell in the table.

Parameters:
rowArray - An array of strings representing a single row.

addRow

public void addRow(RDisplayTableCell[] rowArray)
Adds a row of data to the table. This method accepts an array of RDisplayTabelCell that represents a single row. Each RDisplayTabelCell within the array represents a single cell.

Parameters:
rowArray - An array of RDisplayTabelCell objects representing a single table row.

addRow

public void addRow(java.lang.String[] rowArray,
                   java.lang.String columnName,
                   java.lang.Object secondaryData)
Adds a row of data to the table. This method accepts an array of RDisplayTabelCell that represents a single row. Each RDisplayTabelCell within the array represents a single cell.

Parameters:
rowArray - An array of RDisplayTabelCell objects representing a single table row.
columnName - The name of the column to place the secondary data in.
secondaryData - A data object to place in the row at a given column.

addRow

public void addRow(java.lang.String[] rowArray,
                   int column,
                   java.lang.Object secondaryData)
Deprecated. This method will be removed in the future. Please change call code using this method to use column names instead of indexes.


insertRow

public void insertRow(RDisplayTableCell[] rowArray,
                      int rowNumber)
Inserts a row of data into the table. This method accepts an array of RDisplayTableCell objects that represents a single row. Each RDisplayTableCell within the array represents a single cell.

Parameters:
rowArray - An array of RDisplayTableCell objects representing a single table row.
rowNumber - The table location to insert the row at.

insertRow

public void insertRow(java.lang.String[] rowArray,
                      java.lang.String columnName,
                      java.lang.Object data,
                      int rowNumber)
Inserts a row of data into the table.

Parameters:
rowArray - An array of strings to display in the row.
columnName - Name of the column to place the data object in.
data - An object to store in the row at the column indicated by column name.
rowNumber - The table location to insert the row at.

updateRow

public void updateRow(RDisplayTableCell[] rowArray,
                      int rowNumber)
Updates a row of data in the table. This method accepts an array of RDisplayTableCells that represents a single row. Each RDisplayTableCell within the array represents a single cell.

Parameters:
rowArray - An array of RDisplayTableCell objects representing a single table row.
rowNumber - The table row to update.

updateRow

public void updateRow(java.lang.String[] rowArray,
                      int rowNumber)
Updates a row of data in the table using a String array and preserving the other values assigned to the RDisplayTableCell.

Parameters:
rowArray - An array of Strings representing a single table row.
rowNumber - The table row to update.

updateRow

public void updateRow(java.lang.String[] rowArray,
                      java.lang.String columnName,
                      java.lang.Object object)
Updates a row of data in the table using a String array and a secondary data object in the table.

Parameters:
rowArray - An array of Strings representing a single table row.

removeRow

public void removeRow(java.lang.String columnName,
                      java.lang.String columnValue)
Removes each row from the table based on values found within a column. This removes rows based on whether or not the column value is found in the identified column. This method must search the table backwards as removing a row shrinks the total count.

Parameters:
columnName - The column to search for matching value.
columnValue - The value to match with the column.

removeRowBySecondaryData

public void removeRowBySecondaryData(java.lang.String columnName,
                                     java.lang.Object data)
Removes each row from the table based on the secondary value within the column. This removes rows based on whether or not the column value is found in the identified column. This method must search the table backwards as removing a row shrinks the total count.

Parameters:
columnName - The column to search for matching value.

removeRowsBySecondaryData

public void removeRowsBySecondaryData(java.lang.String columnName,
                                      java.util.Collection data)
Removes each row from the table based on the secondary value within the column. This removes rows based on whether or not the column value is found in the identified column. This method must search the table backwards as removing a row shrinks the total count.

Parameters:
columnName - The column to search for matching value.
data - The values to match with the column.

removeRow

public void removeRow(int rowNumber)
Removes a row from the table.

Parameters:
rowNumber - The row number of the table row to remove.

removeSelectedRow

public void removeSelectedRow()
Removes the currently selected row from the table. This should probably only be used in single selection mode as in multi-selection tables, it removes only the first selected row and ignores each additional row.


removeSelectedRows

public void removeSelectedRows()
Removes all currently selected rows from the table. This remove occurs from the bottom of the table backwards as everything is reorganized when a row is removed.


getLastRowNumber

public int getLastRowNumber()
Retrieves the last row number of the table.

Returns:
The last row number of the table.

fillTable

public void fillTable(java.util.List list)
Sets the entire table data from a single List. The list must contain string arrays (or the equivalent list). Each string array represents an entire row of cell values in the correct order. This method will automatically clear the table of all previous information.

Parameters:
list - A list of string arrays (or equivalent list) representing rows.

fillTable

public void fillTable(java.util.List list,
                      java.awt.Color color)
Sets the entire table data from a single list. The list must contain string arrays (or the equivalent list). Each string array represents an entire row of cell values in the correct order. This method will automatically clear the table of all previous information.

Parameters:
list - A list of string arrays (or equivalent list) representing rows.
color - The color to make the display text within the table.

clearTable

public void clearTable()
Clears the entire table of rows. It calls repaint because removing rows does not automatically trigger a repaint, but we want it to anyway. Additionally, it will send an event for every row that is deselected during the clear process.


resetTable

public void resetTable()
Clears the entire table of rows. It calls repaint because removing rows does not automatically trigger a repaint, but we want it to anyway. This method does not trigger any events if rows were programmatically de-selected. This method should only be used in the process of refreshing a table.


isEmpty

public boolean isEmpty()
Returns true if the table is empty.


keyTyped

public void keyTyped(java.awt.event.KeyEvent keyEvent)
Empty implementation of the mouse listener interface method.

Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent keyEvent)
Empty implementation of the key listener interface method.

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent keyEvent)
Implements the key listener interface 'key pressed' method. This method checks to see if the tab key was pressed, and if so, it tansfers the focus to the next focusable component. If ALT-HotKey is pressed, the appropriate column is sorted. If ENTER is pressed, then the table row selected action is triggered.

Specified by:
keyPressed in interface java.awt.event.KeyListener

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent event)
Overrides the JTable list selection event and notifies single action listener of the event. This method strips out adjusting values.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Empty implementation of the mouse listener interface method.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Empty implementation of the mouse listener interface method.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Empty implementation of the mouse listener interface method.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Empty implementation of the mouse listener interface method.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent mouseEvent)
Implement the mouse listener interface 'mouse clicked' method. If the time event is identical to the last event, then do nothing. If a double click occurs within a row, the table listener is informed. If a single click occurs within a column header, the table is sorted on that column. If the same column is clicked again, the sort order is reversed.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

resort

public void resort()
Resorts the table.


resetSortColumnArrows

public void resetSortColumnArrows()
Resets the default sorted column arrows. Resetting the initial arrow display state of the table.



Copyright © 2004 Retek Inc. All Rights Reserved. - Generated at Fri, 10/22/2004 07:28