com.sas.swing.visuals.tableview
Class TableView

com.sas.swing.visuals.tableview.TableView
All Implemented Interfaces:
ActionProviderViewInterface, SwingActionProviderViewInterface, com.sas.collection.ContentsChangedListener, TableRowModelListener, com.sas.table.MoveColumnInterface, SupportsGenericErrorHandlerInterface, java.awt.event.AdjustmentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.RowSorterListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable
Direct Known Subclasses:
OLAPTableView

public class TableView
implements TableRowModelListener, SwingActionProviderViewInterface, com.sas.collection.ContentsChangedListener, java.awt.event.AdjustmentListener, java.awt.print.Printable, SupportsGenericErrorHandlerInterface, com.sas.table.MoveColumnInterface

TableView is a swing component that extends from JTable and allows two-dimensional data to be viewed, edited, and manipulated in tabular form. The TableView add many features on top of the features JTable already provides. Some of these features include:

Model

TableView requires a model that implements TableModel.

If available, it will also utilize the following:

To attach a model to TableView:

setModel (your-model);

Sizing Columns and Rows

[Note: for simplicity and ease in reading this section is written in terms of columns, but the same information and techniques are applicable to rows.]

By default, columns are sized based on their contents. A column's label cell and data cells are individually measured to determine the widest one, and its width is used as the column's width. Since a table may contain a very large number of rows only a sample number of data cells are measured. The number to measure is determined by the effective value of ColumnHeader's cellsToSizeCount property. By default the number is 25, which means that the width of a column will be determined from the width of its label and its first 25 cells. A value of zero will cause only the label to be considered, while a negative value will result in the entire column being measured -- use this when you want to guarantee that no data will be clipped, but only when you're sure that the number of rows will not be too large. By default, clipped data will be appended with ellipsis (...).

Columns can be resized interactively by grabbing their label's right border, or programmatically via TableColumn.setPreferredSize().

For More Information:

Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.

Examples for this class may be found on the Examples Site.

Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .

See Also:
JTable, Serialized Form

Field Summary
static int AUTO_RESIZE_ALL_ROWS
          Resizes all rows to their own preferred height.
static int AUTO_RESIZE_FIRST_ROW
          Resizes all rows to the height of the first row, the default option.
protected  boolean changingCurrentCell
           
protected  boolean clearRowSelectionAfterSorting
           
protected  int columnAutoResizeMode
           
protected  ActionSupportFilter columnHeaderFilter
           
protected  boolean columnsSized
           
protected  ActionSupportFilter dataCellFilter
           
protected  ActionUIFactory factory
           
protected  GenericErrorHandlerInterface genericErrorHandler
           
static int LASTROW
          Used to specify the LASTROW when setting the CellRenderers and CellEditors.
protected  int[] lastSortDirections
           
protected  java.lang.String[] lastSortedColumns
           
 boolean printing
           
static java.lang.String RB_KEY
           
protected  int rowAutoResizeMode
           
protected  ActionSupportFilter rowHeaderFilter
           
protected  javax.swing.SizeSequence rowHeightModel
           
protected  boolean tableInitialized
           
protected  ActionSupportFilter titleFilter
           
protected  ActionSupportFilter toolbarFilter
           
protected static java.lang.String uiClassID
           
protected  SwingViewerSupport viewerSupport
           
 
Constructor Summary
TableView()
          Constructs a default TableView that is initialized with a default data model, a default column model, a default row model, and default selection models.
TableView(int numRows, int numColumns)
          Constructs a TableView with numRows and numColumns of empty cells using DefaultTableModel.
TableView(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
          Constructs a TableView to display the values in the two dimensional array, rowData, with column names, columnNames.
TableView(javax.swing.table.TableModel tableModel)
          Constructs a TableView that is initialized with tableModel as the data model, a default column model, a default row model, and default selection models.
TableView(javax.swing.table.TableModel tableModel, javax.swing.table.TableColumnModel columnModel)
          Constructs a TableView that is initialized with tableModel as the data model, columnModel as the column model, a default row model, and default selection models.
TableView(javax.swing.table.TableModel tableModel, javax.swing.table.TableColumnModel columnModel, javax.swing.ListSelectionModel selectionModel)
          Constructs a TableView that is initialized with tableModel as the data model, columnModel as the column model, selectionModel as the cell selection model, and a default row model .
TableView(java.util.Vector rowData, java.util.Vector columnNames)
          Constructs a TableView to display the values in the Vector of Vectors, rowData, with column names, columnNames.
 
Method Summary
 void addCellSelectionInterval(int row0, int column0, int row1, int column1)
          Adds the cells from row0, column0 to row1, column1, inclusive.
 void addColumnSelectionInterval(int index0, int index1)
          Adds the columns from index0 to index1, inclusive, to the current selection.
 void addRowSelectionInterval(int index0, int index1)
          Adds the rows from index0 to index1, inclusive, to the current selection.
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          Invoked when an adjustment event is received form the scroll bars from the JScrollPane containing the TableView.
protected  int boundColumn(int col)
           
protected  int boundRow(int row)
           
 void changeCurrentCell(int row, int column)
          Changes the current cell (cell with focus) to the given row-column pair.
 void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
          Updates the selection models of the table, depending on the state of the two flags: toggle and extend.
 void clearSelection()
          Deselects all selected columns and rows.
 int columnAtPoint(java.awt.Point point)
          Returns the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount() - 1].
 int columnAtPoint(java.awt.Point point, boolean accountForHolds)
          Returns the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount() - 1].
 void columnMarginChanged(javax.swing.event.ChangeEvent e)
          Invoked when a column is moved due to a margin change.
 void columnMoved(javax.swing.event.TableColumnModelEvent e)
          Invoked when a column is repositioned.
 void columnRemoved(javax.swing.event.TableColumnModelEvent e)
          Invoked when a column is removed from the table column model.
 void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
          Invoked when the selection model of the TableColumnModel is changed.
protected  ActionSupportFilter configureColumnHeaderActionFilter(int row, int column)
           
protected  ActionSupportFilter configureDataCellActionFilter(int row, int column)
           
protected  void configureEnclosingScrollPane()
          If this TableView is the viewportView of an enclosing JScrollPane (the usual situation), configure this ScrollPane by, amongst other things, installing the table's tableHeader as the columnHeaderView of the scroll pane and the table's rowHeader as the rowHeaderView of the scroll pane.
protected  ActionSupportFilter configureRowHeaderActionFilter(int row, int column)
           
protected  ActionSupportFilter configureTitleActionFilter(int row, int column)
           
protected  ActionSupportFilter configureToolBarActionFilter()
          Configures the toolbar action filter for the ActionProvider.
 void contentsChanged(com.sas.collection.ContentsChangedEvent event)
          Invoked when the table receives a ContentsChangeEvent from the action provider.
 int convertRowIndexToModel(int viewRowIndex)
          Maps the index of the row in the view at viewRowIndex to the index of the row in the table model.
 int convertRowIndexToView(int modelRowIndex)
          Maps the index of the row in the table model at modelRowIndex to the index of the row in the view.
 void copy()
          Copies the selected cells to the system clipboard if access is permitted to it, otherwise, nothing is done.
 void createDefaultActionProviderFilters()
          Creates the default action provider filters that get used for by the action provider to return various actions for the given areas.
protected  void createDefaultEditors()
          Creates default cell editors for objects, numbers, and boolean values.
protected  javax.swing.JComponent createDefaultOriginComponent()
          Creates a default OriginComponent to be used at the intersection of the row and column headers.
protected  void createDefaultRenderers()
          Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons.
protected  RowHeader createDefaultRowHeader()
          Returns the default row header object, which is a RowHeader.
protected  TableRowModel createDefaultRowModel()
          Returns the default row model object, which is a DefaultTableRowModel.
protected  javax.swing.ListSelectionModel createDefaultSelectionModel()
          Returns the default selection model object, which is a CellSelectionModel.
protected  javax.swing.table.JTableHeader createDefaultTableHeader()
          Returns the default table header object, which is a ColumnHeader.
 void createDefaultViewerSupport()
          Creates the default viewer support, which by default is an instanceof com.sas.actionprovider.support.SwingViewerSupport.
protected  int createOrdinal(int row, int column)
           
 javax.swing.JPopupMenu createPopupMenu()
          Creates the default popupMenu used to display the commands to preform on the table.
 void cut()
          Cuts the selected cells and copies them to the system clipboard if access is permitted to it, otherwise, nothing is done.
 void doLayout()
          Overrode so that the columns will keep their preferred size if the autoResizeMode is set to AUTO_RESIZE_OFF.
 SwingActionProvider getActionProvider()
          Returns the ActionProvider object used to return actions for the TableView.
 java.lang.String getActionSupportType()
          Return the key that associated with a particular support class in the ActionProvider framework.
 int getCellAreaHeight()
          Returns the height in pixels that the cells are given, this may be equal to a call to getHeight().
 java.awt.Rectangle getCellAreaRect()
          Returns a rectangle the size of all the cells, this rectangle may have the same size as a call to getWith() and getHeight().
 int getCellAreaWidth()
          Returns the width in pixels that the cells are given, this may be equal to a call to getWidth().
 javax.swing.table.TableCellEditor getCellEditor(int row, int column)
          Returns an appropriate editor for the cell specified by row and column.
 java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing)
          Returns a rectangle for the cell that lies at the intersection of row and column.
 java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing, boolean accountForHolds)
          Returns a rectangle for the cell that lies at the intersection of row and column.
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
          Returns an appropriate renderer for the cell specified by this row and column.
 boolean getCellSelectionEnabled()
          Returns true if both row and column selection models are enabled.
 TableViewClipboardAdapter getClipboardAdapter()
          Returns the clipboard adapter used by the tableView.
 int getColumnAutoResizeMode()
          Returns the mode the columns are sized, values can be AUTO_RESIZE_OFF or AUTO_RESIZE_ALL_COLUMNS.
 ColumnHeader getColumnHeader()
          Convience method to return the column header, calls getTableHeader() and casts the header to a ColumnHeader.
 int[] getCurrentCell()
          Returns the row-columnpair of the current cell that has focus.
 int getCurrentColumn()
          Returns the current column index that has the lead selection, the column that has focus when the table cell area has focus.
 int getCurrentRow()
          Returns the current row index that has the lead selection, the row that has focus when the table cell area has focus.
 com.sas.table.EditControllerInterface getEditController()
          Returns the controller class use to assist in editing the table.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this TableView.
 int getFirstVisibleColumn()
          Returns the first column index that the table is showing.
 int getFirstVisibleRow()
          Returns the first row index that the table is showing.
 GenericErrorHandlerInterface getGenericErrorHandler()
          Returns the error handler that the TableView uses to handle various errors it catches.
 int getGridWidth()
          Returns the width the grid lines are drawn.
 java.util.List getHiddenColumns()
          Returns a list of the columns that have been hidden, the list will contain the model indexes of the hidden columns.
 java.awt.Dimension getIntercellSpacing()
          Returns the horizontal and vertical space between cells.
 int getLastVisibleColumn()
          Returns the last column index that the table is showing.
 int getLastVisibleRow()
          Returns the last row index that the table is showing.
 javax.swing.JComponent getOriginComponent()
          Returns the component displayed at the intersection of the row and column headers.
 javax.swing.JPopupMenu getPopupMenu()
          Returns the popup menu that is used for the tableview.
 int getRowAutoResizeMode()
          Returns the mode the rows are sized, values can be AUTO_RESIZE_OFF, AUTO_RESIZE_ALL_ROWS or AUTO_RESIZE_FIRST_ROW.
 RowHeader getRowHeader()
          Returns the rowHeader used by this TableView.
 int getRowHeight(int row)
          Returns the height, in pixels, of the cells in row.
 int getRowMargin()
          Gets the amount of empty space, in pixels, between cells.
 TableRowModel getRowModel()
          Returns the TableRowModel that contains all row information of this table.
 boolean getRowSelectionAllowed()
          Returns true if rows can be selected.
 javax.swing.JScrollPane getScrollPane()
          Returns the JScrollPane that the table resides in if there is a scroll pane.
 int getSelectedCellCount()
          Returns the number of selected cells.
 int[][] getSelectedCells()
          Returns ar array of integers mapping to the row, column pairs of all selected cells.
 int[][] getSelectedCellsForColumn(int column)
          Returns the selected cells for the given column.
 int[][] getSelectedCellsForRow(int row)
          Returns the selected cells for the given row.
 int getSelectedColumn()
          Returns the index of the first selected column, -1 if no column is selected.
 int getSelectedColumnCount()
          Returns the number of selected columns.
 int[] getSelectedColumns()
          Returns the indices of all selected columns.
 int getSelectedRow()
          Returns the index of the first selected row, -1 if no row is selected.
 int getSelectedRowCount()
          Returns the number of selected rows.
 int[] getSelectedRows()
          Returns the indices of all selected rows.
 java.lang.String getUIClassID()
          Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
 java.lang.Class getUnformattedColumnClass(int column)
          Returns the type of data that appears in the column appearing in the view at column position column.
 java.lang.Object getUnformattedValueAt(int row, int column)
          Returns the unformatted cell value at row and column if possible.
 java.lang.Object getUniqueId()
          Returns the Viewer's uniqueId
 java.lang.Object getValueAt(int row, int column)
          Returns the cell value at row and column.
 java.awt.Point getViewPosition()
          If the table is contained in a JViewport, then the view position of the viewport is return, else a point of (0, 0) will be returned.
protected  void handlePostSortingSelections(javax.swing.event.TableModelEvent e)
           
 void hideColumn(int columnModelIndex)
          Makes the columnModelIndex invisible to the table.
protected  void initializeLocalVars()
          Initializes table properties to their default values.
 boolean isActionVisible(java.lang.String actionType, java.lang.String areaType)
          Returns a boolean indicating if the action type is visible everywhere in the specified areaType.
 boolean isCellEditable(int row, int column)
          Returns true if the cell at row and column is editable.
 boolean isCellSelected(int row, int column)
          Returns true if the cell at the specified position is selected.
 boolean isColumnHeaderVisible()
          Returns true if the column header is being displayed, false if hidden.
 boolean isColumnMoveAllowed(int columnIndex, int newIndex)
          Check to see if the column at columnIndex can be moved to newIndex.
 boolean isColumnSelected(int column)
          Returns true if the column at the specified index is selected.
 boolean isPopupMenuEnabled()
          Returns whether the popup menu is enabled or not, if so, the popup menu can be displayed, if not, a call to showPopup will do nothing.
 boolean isRowHeaderVisible()
          Returns true if the row header is being displayed, false if hidden.
 boolean isRowSelected(int row)
          Returns true if the row at the specified index is selected.
 boolean isRowsReorderable()
          Returns whether the rows can be reordered by dragging their label in the row header.
 java.util.Collection listActionTypes(java.lang.String areaType)
          Returns a Collection of String keys that define the valid actionTypes for the specified area of the action support class designated the actionSupportType attribute.
 java.util.Collection listAreaTypes()
          Returns a Collection of String keys that define the valid areaTypes for the action support class designated by the actionSupportType attribute.
 void moveRow(int fromIndex, int toIndex)
          Moves the row rowIndex to the position currently occupied by the row newIndex in the view.
 void paintComponent(java.awt.Graphics g)
          Overrode this method as the clipBounds needs to be modified on the Graphics due to held rows and columns, if nothing is currently being held, the clipBounds will be left untouched.
 void paste()
          If access to the system clipboard is granted, this will paste the data into the table if the size of the data can fit in the cells.
 void populatePopupMenu(javax.swing.JPopupMenu popup, int row, int column)
          Populates a popup menu based on a given row and column.
 void populateToolBar(javax.swing.JToolBar toolbar)
          Populates a toolbar based on the default actions register on the table in the ActionProvider for the TOOLBAR_AREA type.
 java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor, int row, int column)
          Prepares the editor by querying the data model for the value and selection state of the cell at row, column.
 java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int row, int column)
          Prepares the renderer by querying the data model for the value and selection state of the cell at row, column.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
          Prints the table, taking into account the held rows and columns.
 void printComponent(java.awt.Graphics g)
          Overrode this method so that the clipbounds will not be modified to accomate the held rows and column when printing as the clipbounds should already be set to the correct size.
protected  boolean processKeyBinding(javax.swing.KeyStroke ks, java.awt.event.KeyEvent e, int condition, boolean pressed)
           
 void removeCellSelectionInterval(int row0, int column0, int row1, int column1)
          Deletes the cells from row0, column0 to row1, column1, inclusive.
 void removeColumnSelectionInterval(int index0, int index1)
          Deselects the columns from index0 to index1, inclusive.
 void removeRowSelectionInterval(int index0, int index1)
          Deselects the rows from index0 to index1, inclusive.
protected  void repaintCells(int oldRow, int newRow, int oldColumn, int newColumn)
           
protected  void repaintCurrentCell()
           
protected  void resizeAndRepaint()
          Equivalent to revalidate followed by repaint
 int rowAtPoint(java.awt.Point point)
          Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount() - 1].
 int rowAtPoint(java.awt.Point point, boolean accountForHolds)
          Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount() - 1].
 void rowMarginChanged(javax.swing.event.ChangeEvent e)
          Tells listeners that a row was moved due to a margin change.
 void rowMoved(TableRowModelEvent e)
          Tells listeners that a row was repositioned.
 void rowSelectionChanged(javax.swing.event.ListSelectionEvent e)
          Tells listeners that the selection model of the TableRowModel changed.
 void selectAll()
          Selects all rows, columns, and cells in the table.
 void setActionProvider(SwingActionProvider actionProvider)
          Sets the ActionProvider object which is used to generate all the actions that get displayed in the popupmenu for the TableView.
 void setActionSupportType(java.lang.String actionSupportType)
          Set the key that associated with a particular support class in the ActionProvider framework.
 void setActionVisible(java.lang.String actionType, java.lang.String areaType, boolean visible)
          Sets the visible status of the specified actionType for the specified area.
 void setCellEditor(int startRow, int endRow, int repeatRowFactor, int startColumn, int endColumn, int repeatColumnFactor, javax.swing.table.TableCellEditor editor)
          Sets the cell editor for the specific cells located in the specified area determined by startRow, endRow, repeatRowFactor, startColumn, endColumn and repeatColumnFactor.
 void setCellEditor(int row, int column, javax.swing.table.TableCellEditor editor)
          Sets the cell editor for the specific cell located at the row and column passed in.
 void setCellRenderer(int startRow, int endRow, int repeatRowFactor, int startColumn, int endColumn, int repeatColumnFactor, javax.swing.table.TableCellRenderer renderer)
          Sets the cell renderer for the specific cells located in the specified area determined by startRow, endRow, repeatRowFactor, startColumn, endColumn and repeatColumnFactor.
 void setCellRenderer(int row, int column, javax.swing.table.TableCellRenderer renderer)
          Sets the cell renderer for the specific cell located at the row and column passed in.
 void setCellSelectionEnabled(boolean cellSelectionEnabled)
          Sets whether this table allows both a column selection and a row selection to exist simultaneously.
 void setCellSelectionInterval(int row0, int column0, int row1, int column1)
          Selects the cells from row0, column0 to row1, column1, inclusive.
 void setClipboardAdapter(TableViewClipboardAdapter clipboardAdapter)
          Sets the clipboard adapter used by the tableView.
 void setColumnAutoResizeMode(int mode)
          Sets the mode the columns will be sized.
 void setColumnHeader(ColumnHeader columnHeader)
          Convience method to set the column/table header, calls setTableHeader(JTableHeader).
 void setColumnHeaderVisible(boolean b)
          Makes the column header visible or hidden.
 void setColumnSelectionAllowed(boolean columnSelectionAllowed)
          Sets whether the columns in this model can be selected.
 void setColumnSelectionInterval(int index0, int index1)
          Selects the columns from index0 to index1, inclusive.
 void setCurrentColumn(int newColumn)
          Sets the current column to the given index, the column will have focus.
 void setCurrentRow(int newRow)
          Sets the current row to the given index, the row will have focus.
 void setEditController(com.sas.table.EditControllerInterface newEditController)
          Sets the controller class use to assist in editing the table.
 void setGenericErrorHandler(GenericErrorHandlerInterface errorHandler)
          Sets an error handler to be used on the TableView, this errorhandler will be used to handle various errors the table catches.
 void setGridWidth(int newWidth)
          Sets the size the grid lines are to be drawn in pixels.
 void setOriginComponent(javax.swing.JComponent newOriginComponent)
          Sets the component to be used at the intersection of the row and column headers.
 void setPopupMenuEnabled(boolean enablePopupMenu)
          Sets whether the popup menu is enabled or not.
 void setRowAutoResizeMode(int mode)
          Sets the mode the rows will be sized.
 void setRowHeader(RowHeader newHeader)
          Sets the rowHeader working with this TableView to newHeader.
 void setRowHeaderVisible(boolean b)
          Makes the row header visible or hidden.
 void setRowHeight(int rowHeight)
          Sets the height, in pixels, of all cells to rowHeight, revalidates, and repaints.
 void setRowHeight(int row, int rowHeight)
          Sets the height for row to rowHeight, revalidates, and repaints.
 void setRowMargin(int rowMargin)
          Sets the amount of empty space between cells in adjacent rows.
 void setRowModel(TableRowModel rowModel)
          Sets the row model for this table to newModel and registers for listener notifications from the new row model.
 void setRowSelectionAllowed(boolean rowSelectionAllowed)
          Sets whether the rows in this model can be selected.
 void setRowSelectionInterval(int index0, int index1)
          Selects the rows from index0 to index1, inclusive.
 void setRowsReorderable(boolean newValue)
          Sets whether the rows can be reordered by dragging the label in the row header.
 void setSelectionMode(int selectionMode)
          Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.
 void setSize(int width, int height)
          Overrode this method so that rows can get sized correctly if needed.
 void setUniqueId(java.lang.Object uniqueId)
          Returns the Viewer's uniqueId
 void setValueAt(java.lang.Object aValue, int row, int column)
          Sets the value for the cell in the table model at row and column.
 void showAllColumns()
          Makes all the columns that have been hidden visible again to the table.
 void showColumn(int columnModelIndex)
          Makes the columnModelIndex visible to the table again.
 void showPopup(int row, int column)
          Displays the popup menu at the bottom right corner of the cell specified.
protected  void showPopup(int row, int column, java.awt.Point point)
           
 void showPopup(java.awt.Point point)
          Displays the popup menu at the given point.
 void tableChanged(javax.swing.event.TableModelEvent e)
          Invoked when this table's TableModel generates a TableModelEvent.
protected  void tableRowsDeleted(javax.swing.event.TableModelEvent e)
           
protected  void tableRowsInserted(javax.swing.event.TableModelEvent e)
           
protected  void tableRowsUpdated(javax.swing.event.TableModelEvent e)
           
protected  void unconfigureEnclosingScrollPane()
          Reverses the effect of configureEnclosingScrollPane by replacing the columnHeaderView and rowHeaderView of the enclosing scroll pane with null.
 void updateUI()
          Notification from the UIManager that the look and feel (L&F) has changed.
protected  void validateCurrentCell()
           
 void valueChanged(javax.swing.event.ListSelectionEvent e)
          Invoked when the row selection changes -- repaints to show the new selection.
 
Methods inherited from interface com.sas.table.MoveColumnInterface
moveColumn
 

Field Detail

RB_KEY

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

LASTROW

public static final int LASTROW
Used to specify the LASTROW when setting the CellRenderers and CellEditors.

See Also:
Constant Field Values

uiClassID

protected static final java.lang.String uiClassID
See Also:
getUIClassID(), Constant Field Values

rowHeightModel

protected javax.swing.SizeSequence rowHeightModel

changingCurrentCell

protected boolean changingCurrentCell

viewerSupport

protected SwingViewerSupport viewerSupport

dataCellFilter

protected ActionSupportFilter dataCellFilter

rowHeaderFilter

protected ActionSupportFilter rowHeaderFilter

columnHeaderFilter

protected ActionSupportFilter columnHeaderFilter

titleFilter

protected ActionSupportFilter titleFilter

toolbarFilter

protected ActionSupportFilter toolbarFilter

columnsSized

protected boolean columnsSized

rowAutoResizeMode

protected int rowAutoResizeMode

columnAutoResizeMode

protected int columnAutoResizeMode

genericErrorHandler

protected GenericErrorHandlerInterface genericErrorHandler

factory

protected ActionUIFactory factory

tableInitialized

protected boolean tableInitialized

AUTO_RESIZE_FIRST_ROW

public static final int AUTO_RESIZE_FIRST_ROW
Resizes all rows to the height of the first row, the default option.

See Also:
Constant Field Values

AUTO_RESIZE_ALL_ROWS

public static final int AUTO_RESIZE_ALL_ROWS
Resizes all rows to their own preferred height.

See Also:
Constant Field Values

printing

public boolean printing

lastSortedColumns

protected java.lang.String[] lastSortedColumns

lastSortDirections

protected int[] lastSortDirections

clearRowSelectionAfterSorting

protected boolean clearRowSelectionAfterSorting
Constructor Detail

TableView

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

See Also:
JTable.createDefaultDataModel(), JTable.createDefaultColumnModel(), createDefaultSelectionModel(), createDefaultRowModel()

TableView

public TableView(javax.swing.table.TableModel tableModel)
Constructs a TableView that is initialized with tableModel as the data model, a default column model, a default row model, and default selection models.

Parameters:
tableModel - the data model for the table
See Also:
JTable.createDefaultColumnModel(), createDefaultSelectionModel(), createDefaultRowModel()

TableView

public TableView(javax.swing.table.TableModel tableModel,
                 javax.swing.table.TableColumnModel columnModel)
Constructs a TableView that is initialized with tableModel as the data model, columnModel as the column model, a default row model, and default selection models.

Parameters:
tableModel - the data model for the table
columnModel - the column model for the table
See Also:
createDefaultSelectionModel(), createDefaultRowModel()

TableView

public TableView(javax.swing.table.TableModel tableModel,
                 javax.swing.table.TableColumnModel columnModel,
                 javax.swing.ListSelectionModel selectionModel)
Constructs a TableView that is initialized with tableModel as the data model, columnModel as the column model, selectionModel as the cell selection model, and a default row 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 columnModel is non-null, otherwise it is set to true and the column model is populated with suitable TableColumns for the columns in tableModel.

Parameters:
tableModel - the data model for the table
columnModel - the column model for the table
selectionModel - the row selection model for the table
See Also:
JTable.createDefaultDataModel(), JTable.createDefaultColumnModel(), createDefaultSelectionModel(), createDefaultRowModel()

TableView

public TableView(int numRows,
                 int numColumns)
Constructs a TableView 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
See Also:
DefaultTableModel

TableView

public TableView(java.util.Vector rowData,
                 java.util.Vector columnNames)
Constructs a TableView 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

TableView

public TableView(java.lang.Object[][] rowData,
                 java.lang.Object[] columnNames)
Constructs a TableView 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

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this TableView.

Returns:
the ExtendedBeanInfo for this class

rowAtPoint

public int rowAtPoint(java.awt.Point point)
Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount() - 1].

Overrides:
rowAtPoint in class javax.swing.JTable
Parameters:
point - the location of interest
Returns:
the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount() - 1]
See Also:
columnAtPoint(java.awt.Point)

rowAtPoint

public int rowAtPoint(java.awt.Point point,
                      boolean accountForHolds)
Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount() - 1].

Parameters:
point - the location of interest
accountForHolds - if false and the point is over a held row, this method will return the row index for the row beneath the held row. If true, this will return the index of the row the point is on, taking into account the held rows.
Returns:
the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount() - 1]
See Also:
columnAtPoint(java.awt.Point)

columnAtPoint

public int columnAtPoint(java.awt.Point point)
Returns the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount() - 1].

Overrides:
columnAtPoint in class javax.swing.JTable
Parameters:
point - the location of interest
Returns:
the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount() - 1]
See Also:
rowAtPoint(java.awt.Point)

columnAtPoint

public int columnAtPoint(java.awt.Point point,
                         boolean accountForHolds)
Returns the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount() - 1].

Parameters:
point - the location of interest
accountForHolds - if false and the point is over a held column, this method will return the column index for the column beneath the held column. If true, this will return the index of the column the point is on, taking into account the held columns.
Returns:
the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount() - 1]
See Also:
rowAtPoint(java.awt.Point)

getCellRect

public java.awt.Rectangle getCellRect(int row,
                                      int column,
                                      boolean includeSpacing,
                                      boolean accountForHolds)
Returns a rectangle for the cell that lies at the intersection of row and column. If includeSpacing is true then the value returned has the full height and width of the row and column specified. If it is false, the returned rectangle is inset by the intercell spacing to return the true bounds of the rendering or editing component as it will be set during rendering.

If the column index is valid but the row index is less than zero the method returns a rectangle with the y and height values set appropriately and the x and width values both set to zero. In general, when either the row or column indices indicate a cell outside the appropriate range, the method returns a rectangle depicting the closest edge of the closest cell that is within the table's range. When both row and column indices are out of range the returned rectangle covers the closest point of the closest cell.

In all cases, calculations that use this method to calculate results along one axis will not fail because of anomalies in calculations along the other axis. When the cell is not valid the includeSpacing parameter is ignored.

Parameters:
includeSpacing - if false, return the true cell bounds - computed by subtracting the intercell spacing from the height and widths of the column and row models
accountForHolds - if false, return the cell bounds the cell would have if the row or column was not held. if true, return the location the cell currently has in the view due to scrolling
Returns:
the rectangle containing the cell at location row, column

getCellRect

public java.awt.Rectangle getCellRect(int row,
                                      int column,
                                      boolean includeSpacing)
Returns a rectangle for the cell that lies at the intersection of row and column. Delegates to calling getCellRect(int, int, boolean, boolean) with the last boolean being set to true. This causes the location of a cell in a held row or column to be influenced by the location the table is currently scrolled to. If includeSpacing is true then the value returned has the full height and width of the row and column specified. If it is false, the returned rectangle is inset by the intercell spacing to return the true bounds of the rendering or editing component as it will be set during rendering.

If the column index is valid but the row index is less than zero the method returns a rectangle with the y and height values set appropriately and the x and width values both set to zero. In general, when either the row or column indices indicate a cell outside the appropriate range, the method returns a rectangle depicting the closest edge of the closest cell that is within the table's range. When both row and column indices are out of range the returned rectangle covers the closest point of the closest cell.

In all cases, calculations that use this method to calculate results along one axis will not fail because of anomalies in calculations along the other axis. When the cell is not valid the includeSpacing parameter is ignored.

Overrides:
getCellRect in class javax.swing.JTable
Parameters:
includeSpacing - if false, return the true cell bounds - computed by subtracting the intercell spacing from the height and widths of the column and row models
Returns:
the rectangle containing the cell at location row, column
See Also:
getCellRect(int, int, boolean, boolean)

getFirstVisibleRow

public int getFirstVisibleRow()
Returns the first row index that the table is showing. The index is zero-based. Will return -1 if no rows are present.

Returns:
the zero-based index of the first visible row

getLastVisibleRow

public int getLastVisibleRow()
Returns the last row index that the table is showing. The index is zero-based. Will return -1 if no rows are present.

Returns:
the zero-based index of the last visible row

getFirstVisibleColumn

public int getFirstVisibleColumn()
Returns the first column index that the table is showing. The index is zero-based. Will return -1 if no columns are present.

Returns:
the zero-based index of the first visible column

getLastVisibleColumn

public int getLastVisibleColumn()
Returns the last column index that the table is showing. The index is zero-based. Will return -1 if no columns are present.

Returns:
the zero-based index of the last visible column

setRowMargin

public void setRowMargin(int rowMargin)
Sets the amount of empty space between cells in adjacent rows.

Overrides:
setRowMargin in class javax.swing.JTable
Parameters:
rowMargin - the number of pixels between cells in a row
See Also:
getRowMargin()

getRowMargin

public int getRowMargin()
Gets the amount of empty space, in pixels, between cells. Equivalent to: getIntercellSpacing().height.

Overrides:
getRowMargin in class javax.swing.JTable
Returns:
the number of pixels between cells in a row
See Also:
setRowMargin(int)

getIntercellSpacing

public java.awt.Dimension getIntercellSpacing()
Returns the horizontal and vertical space between cells. The default spacing is (1, 1), which provides room to draw the grid.

Overrides:
getIntercellSpacing in class javax.swing.JTable
Returns:
the horizontal and vertical spacing between cells
See Also:
JTable.setIntercellSpacing(java.awt.Dimension)

getGridWidth

public int getGridWidth()
Returns the width the grid lines are drawn. The size of the grid will not be drawn any larger then what the row or column margin is.

Returns:
the size the grid lines will be drawn in pixels
See Also:
setGridWidth(int)

setGridWidth

public void setGridWidth(int newWidth)
Sets the size the grid lines are to be drawn in pixels. The default value is 1. This value can be set any value 0 or greater, but the grid lines will only be drawn as large as the row or column margin are.

Parameters:
newWidth - The new size the draw the grid lines
See Also:
getGridWidth()

getViewPosition

public java.awt.Point getViewPosition()
If the table is contained in a JViewport, then the view position of the viewport is return, else a point of (0, 0) will be returned. The point returned is used to help locate where the held rows and columns will be displayed in the TableView.

Returns:
the view position of the viewport if available

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the cell value at row and column. If the value returned from the model is an instance of a String and a call to getUnformattedColumnClass returns a calls that extends from Number.class, then the string will get trim() called on it so that all unnecessary whitespace is removed.

Note: The column and row is specified in the table view's display order, and not in the TableModel's column and row order. This is an important distinction because as the user rearranges the columns and rows in the table, the column/row at a given index in the view will change. Meanwhile the user's actions never affect the model's column/row ordering.

Overrides:
getValueAt in class javax.swing.JTable
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the Object at the specified cell
See Also:
getUnformattedColumnClass(int), String.trim()

getUnformattedValueAt

public java.lang.Object getUnformattedValueAt(int row,
                                              int column)
Returns the unformatted cell value at row and column if possible. The table's model must implement FormattedInterface in order for this method to work, otherwise getValueAt(int, int) is called and that value is returned.

Note: The column and row is specified in the table view's display order, and not in the TableModel's column and row order. This is an important distinction because as the user rearranges the columns and rows in the table, the column/row at a given index in the view will change. Meanwhile the user's actions never affect the model's column/row ordering.

Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the Object at the specified cell
See Also:
getValueAt(int, int), FormattedInterface

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)
Sets the value for the cell in the table model at row and column.

Note: The column and row is specified in the table view's display order, and not in the TableModel's column and row order. This is an important distinction because as the user rearranges the columns and rows in the table, the column/row at a given index in the view will change. Meanwhile the user's actions never affect the model's column/row ordering.

Overrides:
setValueAt in class javax.swing.JTable
Parameters:
aValue - the new value
row - the row of the cell to be changed
column - the column of the cell to be changed
See Also:
getValueAt(int, int)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns true if the cell at row and column is editable. Otherwise, invoking setValueAt on the cell will have no effect. This first makes a call to isEditableColumn to see if the column is editable, and if so, then it queries the model for whether the cell is editable.

Note: The column and row is specified in the table view's display order, and not in the TableModel's column and row order. This is an important distinction because as the user rearranges the columns and rows in the table, the column/row at a given index in the view will change. Meanwhile the user's actions never affect the model's column/row ordering.

Overrides:
isCellEditable in class javax.swing.JTable
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
true if the cell is editable
See Also:
setValueAt(Object, int, int)

convertRowIndexToModel

public int convertRowIndexToModel(int viewRowIndex)
Maps the index of the row in the view at viewRowIndex to the index of the row in the table model. Returns the index of the corresponding row in the model. If viewRowIndex is less than zero, returns viewRowIndex.

Overrides:
convertRowIndexToModel in class javax.swing.JTable
Parameters:
viewRowIndex - the index of the row in the view
Returns:
the index of the corresponding row in the model
See Also:
convertRowIndexToView(int)

convertRowIndexToView

public int convertRowIndexToView(int modelRowIndex)
Maps the index of the row in the table model at modelRowIndex to the index of the row in the view. Returns the index of the corresponding row in the view; returns -1 if this row is not being displayed. If modelRowIndex is less than zero, returns modelRowIndex.

Overrides:
convertRowIndexToView in class javax.swing.JTable
Parameters:
modelRowIndex - the index of the row in the model
Returns:
the index of the corresponding row in the view
See Also:
convertRowIndexToModel(int)

createDefaultSelectionModel

protected javax.swing.ListSelectionModel createDefaultSelectionModel()
Returns the default selection model object, which is a CellSelectionModel. A subclass can override this method to return a different selection model object.

Overrides:
createDefaultSelectionModel in class javax.swing.JTable
Returns:
the default selection model object
See Also:
CellSelectionModel

createDefaultTableHeader

protected javax.swing.table.JTableHeader createDefaultTableHeader()
Returns the default table header object, which is a ColumnHeader. A subclass can override this method to return a different table header object.

Overrides:
createDefaultTableHeader in class javax.swing.JTable
Returns:
the default table header object for a TableView
See Also:
JTableHeader, ColumnHeader

getScrollPane

public javax.swing.JScrollPane getScrollPane()
Returns the JScrollPane that the table resides in if there is a scroll pane.

Returns:
the parent of the table if it is a JScrollPane

configureEnclosingScrollPane

protected void configureEnclosingScrollPane()
If this TableView is the viewportView of an enclosing JScrollPane (the usual situation), configure this ScrollPane by, amongst other things, installing the table's tableHeader as the columnHeaderView of the scroll pane and the table's rowHeader as the rowHeaderView of the scroll pane. When a TableView is added to a JScrollPane in the usual way, using new JScrollPane(myTable), addNotify is called in the TableView (when the table is added to the viewport). TableView's addNotify method in turn calls this method, which is protected so that this default installation procedure can be overridden by a subclass.

Overrides:
configureEnclosingScrollPane in class javax.swing.JTable
See Also:
JTable.addNotify()

unconfigureEnclosingScrollPane

protected void unconfigureEnclosingScrollPane()
Reverses the effect of configureEnclosingScrollPane by replacing the columnHeaderView and rowHeaderView of the enclosing scroll pane with null. TableView's removeNotify method calls this method, which is protected so that this default uninstallation procedure can be overridden by a subclass.

Overrides:
unconfigureEnclosingScrollPane in class javax.swing.JTable
See Also:
JTable.removeNotify(), configureEnclosingScrollPane()

setRowHeaderVisible

public void setRowHeaderVisible(boolean b)
Makes the row header visible or hidden. The table must be in a JScrollPane for this to work.

Parameters:
b - true to show the row header, false to hide the header
See Also:
isRowHeaderVisible()

isRowHeaderVisible

public boolean isRowHeaderVisible()
Returns true if the row header is being displayed, false if hidden.

Returns:
true if the row header is visible, false otherwise
See Also:
setRowHeaderVisible(boolean)

setRowsReorderable

public void setRowsReorderable(boolean newValue)
Sets whether the rows can be reordered by dragging the label in the row header. The default value is true.

Parameters:
newValue - true to makes the rows reorderable, false otherwise
See Also:
isRowsReorderable()

isRowsReorderable

public boolean isRowsReorderable()
Returns whether the rows can be reordered by dragging their label in the row header. True is the default value.

Returns:
whether rows can be reordered.
See Also:
setRowsReorderable(boolean)

setColumnHeaderVisible

public void setColumnHeaderVisible(boolean b)
Makes the column header visible or hidden. The table must be in a JScrollPane for this to work.

Parameters:
b - true to show the column header, false to hide the header
See Also:
isColumnHeaderVisible()

isColumnHeaderVisible

public boolean isColumnHeaderVisible()
Returns true if the column header is being displayed, false if hidden.

Returns:
true if the column header is visible, false otherwise
See Also:
setColumnHeaderVisible(boolean)

setEditController

public void setEditController(com.sas.table.EditControllerInterface newEditController)
Sets the controller class use to assist in editing the table.

Parameters:
controller - the new edit controller
See Also:
EditControllerInterface

getEditController

public com.sas.table.EditControllerInterface getEditController()
Returns the controller class use to assist in editing the table.

Returns:
the edit controller
See Also:
EditControllerInterface

initializeLocalVars

protected void initializeLocalVars()
Initializes table properties to their default values.

Overrides:
initializeLocalVars in class javax.swing.JTable

createDefaultViewerSupport

public void createDefaultViewerSupport()
Creates the default viewer support, which by default is an instanceof com.sas.actionprovider.support.SwingViewerSupport. The action support type is set to com.sas.actionprovider.support.ActionProviderSupportTypes.TABLEVIEW_SUPPORT


createDefaultActionProviderFilters

public void createDefaultActionProviderFilters()
Creates the default action provider filters that get used for by the action provider to return various actions for the given areas. This method creates a filter for the following areas: TableViewAreaInterface.DATA_CELL_AREA, TableViewAreaInterface.ROW_HEADER_AREA, TableViewAreaInterface.COLUMN_HEADER_AREA, TableViewAreaInterface.TITLE_AREA, TOOLBAR_AREA


processKeyBinding

protected boolean processKeyBinding(javax.swing.KeyStroke ks,
                                    java.awt.event.KeyEvent e,
                                    int condition,
                                    boolean pressed)
Overrides:
processKeyBinding in class javax.swing.JTable

getUnformattedColumnClass

public java.lang.Class getUnformattedColumnClass(int column)
Returns the type of data that appears in the column appearing in the view at column position column. This may differ from getColumnClass(int) if the model set on the table implements FormattedInterface. If the model implements this interface, then getUnformattedColumnClass(int) will be called on the model and this class will be returned. This method is used for determining what type of data is in a column even if the column has formatted data.

Parameters:
column - the column in the view being queried
Returns:
the raw data type of the column at position column in the view where the first column is column 0
See Also:
FormattedInterface.getUnformattedColumnClass(int), getCellRenderer(int, int)

createDefaultRenderers

protected void createDefaultRenderers()
Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons.

Overrides:
createDefaultRenderers in class javax.swing.JTable
See Also:
DefaultTableCellRenderer

createDefaultEditors

protected void createDefaultEditors()
Creates default cell editors for objects, numbers, and boolean values.

Overrides:
createDefaultEditors in class javax.swing.JTable
See Also:
DefaultTableCellEditor

setCellRenderer

public void setCellRenderer(int row,
                            int column,
                            javax.swing.table.TableCellRenderer renderer)
Sets the cell renderer for the specific cell located at the row and column passed in. If either the row or column has a -1 value, the renderer is set for the entire row or column. If the renderer is null, it sets the renderer to be null, and will use the renderer set on the table column, or if that is also null, it will use the default renderer set on the table. If both -1 are passed in for the row and column, it sets the renderer for the entire table. If a renderer is set for an entire row, and then a different renderer is set for the same row, but a specific column, the second renderer will be used for that cell. The last renderer applied always wins. So if a bunch of renderers are set for rows, columns, and individual cells, and then a renderer is set for the entire table (-1 for row, -1 for column), the entire table will use the same renderer.

Parameters:
row - the row to set the renderer on, -1 if setting the renderer on the entire column is desired
column - the column to set the renderer on, -1 if setting the renderer on the entire row is desired
renderer - the renderer to use for the row and column, null to remove the renderer if previously set
See Also:
setCellRenderer(int, int, int, int, int, int, TableCellRenderer), getCellRenderer(int, int)

setCellRenderer

public void setCellRenderer(int startRow,
                            int endRow,
                            int repeatRowFactor,
                            int startColumn,
                            int endColumn,
                            int repeatColumnFactor,
                            javax.swing.table.TableCellRenderer renderer)
Sets the cell renderer for the specific cells located in the specified area determined by startRow, endRow, repeatRowFactor, startColumn, endColumn and repeatColumnFactor. The repeatRowFactor and repeatColumnFactor are used to specify every nth row or column after the startRow or startColumn to set the renderer on.

The valid values for startRow and startColumn are:

       start >= 1
 
The valid values for endRow and endColumn are:
       end >= start, or end == -1 for all rows/columns
 
The valid values for repeatRowFactor and repeatColumnFactor are:
       repeat >= 1
 

If the renderer is null, it sets the renderer for the specified area of cells to be null, and the tableview will use the renderer set on the table column, or if that is also null, the tableview will use the default renderer set on the tableview.

If a renderer is set for an entire row, and then a different renderer is set for the same row, but a specific column, the second renderer will be used for that cell. The last renderer applied always wins. So if a bunch of renderers are set for rows, columns, and individual cells, and then a renderer is set for the entire tableview (i.e. startRow=1, endRow=-1, repeatRowFactor=1, startColumn=1, endColumn=-1, repeatColumnFactor=1), then the entire tableview will use the same renderer.

Parameters:
startRow - the first row in the specified area to set the renderer on
endRow - the last row in the specified area to set the renderer on or -1 for all rows after startRow
repeatRowFactor - specifies every nth row after the startRow to set the renderer on
startColumn - the first column in the specified area to set the renderer on
endRow - the last column in the specified area to set the renderer on or -1 for all columns after startColumn
repeatColumnFactor - specifies every nth column after the startColumn to set the renderer on
renderer - the renderer to use for specified area or null to remove the renderer for the specified area
See Also:
setCellRenderer(int, int, TableCellRenderer), getCellRenderer(int, int)

getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                           int column)
Returns an appropriate renderer for the cell specified by this row and column. First it will check to see if a specific renderer has been set using the setCellRenderer method and returns thats. If not, it then checks the TableColumn for the specific column to see if it has a non-null renderer, returns that. If not, finds the class of the data in this column (using getUnformattedColumnClass) and returns the default renderer for this type of data.

Note: Throughout the tableview package, the internal implementations always use this method to provide renderers so that this default behavior can be safely overridden by a subclass.

Overrides:
getCellRenderer in class javax.swing.JTable
Parameters:
row - the row of the cell to render, where 0 is the first row
column - the column of the cell to render, where 0 is the first column
Returns:
the assigned renderer; if null returns the default renderer for this type of object
See Also:
getUnformattedColumnClass(int), setCellRenderer(int, int, TableCellRenderer), setCellRenderer(int, int, int, int, int, int, TableCellRenderer), DefaultTableCellRenderer, TableColumn.setCellRenderer(javax.swing.table.TableCellRenderer), JTable.setDefaultRenderer(Class, TableCellRenderer)

prepareRenderer

public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer,
                                          int row,
                                          int column)
Prepares the renderer by querying the data model for the value and selection state of the cell at row, column.

Note: Throughout the table package, the internal implementations always use this method to prepare renderers so that this default behavior can be safely overridden by a subclass.

Overrides:
prepareRenderer in class javax.swing.JTable
Parameters:
renderer - the TableCellRenderer to prepare
row - the row of the cell to render, where 0 is the first row
column - the column of the cell to render, where 0 is the first column

prepareEditor

public java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor,
                                        int row,
                                        int column)
Prepares the editor by querying the data model for the value and selection state of the cell at row, column.

Note: Throughout the table package, the internal implementations always use this method to prepare editors so that this default behavior can be safely overridden by a subclass.

Overrides:
prepareEditor in class javax.swing.JTable
Parameters:
editor - the TableCellEditor to set up
row - the row of the cell to edit, where 0 is the first row
column - the column of the cell to edit, where 0 is the first column
Returns:
the Component being edited

setCellEditor

public void setCellEditor(int row,
                          int column,
                          javax.swing.table.TableCellEditor editor)
Sets the cell editor for the specific cell located at the row and column passed in. If either the row or column has a -1 value, the editor is set for the entire row or column. If the editor is null, it sets the editor to be null, and will use the editor set on the table column, or if that is also null, it will use the default editor set on the table. If both -1 are passed in for the row and column, it sets the editor for the entire table. If a editor is set for an entire row, and then a different editor is set for the same row, but a specific column, the second editor will be used for that cell. The last editor applied always wins. So if a bunch of editors are set for rows, columns, and individual cells, and then a editor is set for the entire table (-1 for row, -1 for column), the entire table will use the same editor.

Parameters:
row - the row to set the editor on, -1 if setting the editor on the entire column is desired
column - the column to set the editor on, -1 if setting the editor on the entire row is desired
editor - the editor to use for the row and column, null to remove the editor if previously set
See Also:
setCellEditor(int, int, int, int, int, int, TableCellEditor), getCellEditor(int, int)

setCellEditor

public void setCellEditor(int startRow,
                          int endRow,
                          int repeatRowFactor,
                          int startColumn,
                          int endColumn,
                          int repeatColumnFactor,
                          javax.swing.table.TableCellEditor editor)
Sets the cell editor for the specific cells located in the specified area determined by startRow, endRow, repeatRowFactor, startColumn, endColumn and repeatColumnFactor. The repeatRowFactor and repeatColumnFactor are used to specify every nth row or column after the startRow or startColumn to set the editor on.

The valid values for startRow and startColumn are:

       start >= 1
 
The valid values for endRow and endColumn are:
       end >= start, or end == -1 for all rows/columns
 
The valid values for repeatRowFactor and repeatColumnFactor are:
       repeat >= 1
 

If the editor is null, it sets the editor for the specified area of cells to be null, and the tableview will use the editor set on the table column, or if that is also null, the tableview will use the default editor set on the tableview.

If a editor is set for an entire row, and then a different editor is set for the same row, but a specific column, the second editor will be used for that cell. The last editor applied always wins. So if a bunch of editors are set for rows, columns, and individual cells, and then a editor is set for the entire tableview (i.e. startRow=1, endRow=-1, repeatRowFactor=1, startColumn=1, endColumn=-1, repeatColumnFactor=1), then the entire tableview will use the same editor.

Parameters:
startRow - the first row in the specified area to set the editor on
endRow - the last row in the specified area to set the editor on or -1 for all rows after startRow
repeatRowFactor - specifies every nth row after the startRow to set the editor on
startColumn - the first column in the specified area to set the editor on
endRow - the last column in the specified area to set the editor on or -1 for all columns after startColumn
repeatColumnFactor - specifies every nth column after the startColumn to set the editor on
editor - the editor to use for specified area or null to remove the editor for the specified area
See Also:
setCellEditor(int, int, TableCellEditor), getCellEditor(int, int)

getCellEditor

public javax.swing.table.TableCellEditor getCellEditor(int row,
                                                       int column)
Returns an appropriate editor for the cell specified by row and column. First it will check to see if a specific editor has been set using the setCellEditor method and returns thats. If not, it then checks the TableColumn for the specific column to see if it has a non-null editor, returns that. If not, finds the class of the data in this column (using getColumnClass) and returns the default editor for this type of data.

Note: Throughout the tableview package, the internal implementations always use this method to provide editors so that this default behavior can be safely overridden by a subclass.

Overrides:
getCellEditor in class javax.swing.JTable
Parameters:
row - the row of the cell to edit, where 0 is the first row
column - the column of the cell to edit, where 0 is the first column
Returns:
the editor for this cell; if null return the default editor for this type of cell
See Also:
DefaultCellEditor, setCellEditor(int, int, TableCellEditor), setCellEditor(int, int, int, int, int, int, TableCellEditor)

getGenericErrorHandler

public GenericErrorHandlerInterface getGenericErrorHandler()
Returns the error handler that the TableView uses to handle various errors it catches. The error handler might display a JOptionPane or write the error to a log. By default, the error handler is an instance of a com.sas.util.errorhandlers.JOptionPaneErrorHandler.

Specified by:
getGenericErrorHandler in interface SupportsGenericErrorHandlerInterface
Returns:
the error handler that is used to handle various errors in the table
See Also:
setGenericErrorHandler(GenericErrorHandlerInterface)

setGenericErrorHandler

public void setGenericErrorHandler(GenericErrorHandlerInterface errorHandler)
Sets an error handler to be used on the TableView, this errorhandler will be used to handle various errors the table catches. The error handler set might display a JOptionPane with the error, write the error to a log, or handle the error by another means. The error handler can do whatever it chooses with the error. By default, the error handler is an instance of a com.sas.util.errorhandlers.JOptionPaneErrorHandler.

Specified by:
setGenericErrorHandler in interface SupportsGenericErrorHandlerInterface
Parameters:
errorHandler - the new error handler interface to use to handle errors or null to remove the current error handler
See Also:
getGenericErrorHandler()

updateUI

public void updateUI()
Notification from the UIManager that the look and feel (L&F) has changed. Replaces the current UI object with the latest version from the UIManager.

Overrides:
updateUI in class javax.swing.JTable
See Also:
JComponent.updateUI()

getUIClassID

public java.lang.String getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.

Overrides:
getUIClassID in class javax.swing.JTable
Returns:
the string "JTableHeaderUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

createDefaultRowModel

protected TableRowModel createDefaultRowModel()
Returns the default row model object, which is a DefaultTableRowModel. A subclass can override this method to return a different row model object.

Returns:
the default row model object
See Also:
DefaultTableRowModel

createDefaultRowHeader

protected RowHeader createDefaultRowHeader()
Returns the default row header object, which is a RowHeader. A subclass can override this method to return a different row header object.

Returns:
the default row header object
See Also:
RowHeader

createDefaultOriginComponent

protected javax.swing.JComponent createDefaultOriginComponent()
Creates a default OriginComponent to be used at the intersection of the row and column headers. Subclasses can override this method to provide their own custom origin component if wanted. This is the "TITLE_AREA" for the action provider.

Returns:
a JComponent to be displayed at the intersection of the row and column headers

setRowHeader

public void setRowHeader(RowHeader newHeader)
Sets the rowHeader working with this TableView to newHeader. It is legal to have a null rowHeader.

Parameters:
newHeader - new row header
See Also:
getRowHeader()

getRowHeader

public RowHeader getRowHeader()
Returns the rowHeader used by this TableView.

Returns:
the rowHeader used by this table
See Also:
setRowHeader(RowHeader)

setColumnHeader

public void setColumnHeader(ColumnHeader columnHeader)
Convience method to set the column/table header, calls setTableHeader(JTableHeader).

Parameters:
columnHeader - the new column header to use on the table, calls setTableHeader(columnHeader)
See Also:
getColumnHeader()

getColumnHeader

public ColumnHeader getColumnHeader()
Convience method to return the column header, calls getTableHeader() and casts the header to a ColumnHeader. Will return null if the tableHeader is not an instance of a ColumnHeader.

See Also:
setColumnHeader(ColumnHeader)

setOriginComponent

public void setOriginComponent(javax.swing.JComponent newOriginComponent)
Sets the component to be used at the intersection of the row and column headers. The method putClientProperty is called on the newOriginComponent with table as the property. This is done to give the origin component a hook into the table it is being displayed in in case it needs to know.

Parameters:
newOriginComponent - the new component to display in the top left corner of the table
See Also:
getOriginComponent()

getOriginComponent

public javax.swing.JComponent getOriginComponent()
Returns the component displayed at the intersection of the row and column headers.

Returns:
the component to be displayed in the upper left corner of the table
See Also:
setOriginComponent(JComponent)

setRowHeight

public void setRowHeight(int rowHeight)
Sets the height, in pixels, of all cells to rowHeight, revalidates, and repaints. The height of the cells in this row will be equal to the row height minus the row margin.

Overrides:
setRowHeight in class javax.swing.JTable
Parameters:
rowHeight - new row height
See Also:
JTable.getRowHeight()

setRowHeight

public void setRowHeight(int row,
                         int rowHeight)
Sets the height for row to rowHeight, revalidates, and repaints. The height of the cells in this row will be equal to the row height minus the row margin.

Overrides:
setRowHeight in class javax.swing.JTable
Parameters:
row - the row whose height is being changed
rowHeight - new row height, in pixels
Throws:
java.lang.IllegalArgumentException - if rowHeight is less than 1

getRowHeight

public int getRowHeight(int row)
Returns the height, in pixels, of the cells in row.

Overrides:
getRowHeight in class javax.swing.JTable
Parameters:
row - the row whose height is to be returned
Returns:
the height, in pixels, of the cells in the row

setRowModel

public void setRowModel(TableRowModel rowModel)
Sets the row model for this table to newModel and registers for listener notifications from the new row model. Also sets the row model of the RowHeader to rowModel.

Parameters:
rowModel - the new data source for this table
Throws:
java.lang.IllegalArgumentException - if rowModel is null
See Also:
getRowModel()

getRowModel

public TableRowModel getRowModel()
Returns the TableRowModel that contains all row information of this table.

Returns:
the object that provides the row state of the table
See Also:
setRowModel(com.sas.swing.visuals.tableview.TableRowModel)

hideColumn

public void hideColumn(int columnModelIndex)
Makes the columnModelIndex invisible to the table.

Parameters:
columnModelIndex - the column to hide. The index should be a data model index.
See Also:
showColumn(int)

showColumn

public void showColumn(int columnModelIndex)
Makes the columnModelIndex visible to the table again. The new column will be added back to the table where the column was previously.

Parameters:
columnModelIndex - the index of the column to unhide. The index should be a data model index.
See Also:
hideColumn(int)

showAllColumns

public void showAllColumns()
Makes all the columns that have been hidden visible again to the table. It places the hidden columns back to where they were previously.

See Also:
hideColumn(int)

getHiddenColumns

public java.util.List getHiddenColumns()
Returns a list of the columns that have been hidden, the list will contain the model indexes of the hidden columns.

Returns:
a list of the hidden columns

moveRow

public void moveRow(int fromIndex,
                    int toIndex)
Moves the row rowIndex to the position currently occupied by the row newIndex in the view. The old row at newIndex is shifted up or down to make room.

Parameters:
rowIndex - the view index of row to be moved
newIndex - the new view index of the row

isColumnMoveAllowed

public boolean isColumnMoveAllowed(int columnIndex,
                                   int newIndex)
Check to see if the column at columnIndex can be moved to newIndex. The column indices are 1-based.

Specified by:
isColumnMoveAllowed in interface com.sas.table.MoveColumnInterface
Parameters:
columnIndex - The index of the column to be moved.
newIndex - The index of the column's new location.
Returns:
true if the column can be moved to the new location

copy

public void copy()
Copies the selected cells to the system clipboard if access is permitted to it, otherwise, nothing is done. The copied cells can then be pasted into an Excel spreadsheet or another application.


paste

public void paste()
If access to the system clipboard is granted, this will paste the data into the table if the size of the data can fit in the cells.


cut

public void cut()
Cuts the selected cells and copies them to the system clipboard if access is permitted to it, otherwise, nothing is done. The cut cells can then be pasted into an Excel spreadsheet or another application.


setSelectionMode

public void setSelectionMode(int selectionMode)
Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.

Note: JTable provides all the methods for handling column and row selection. When setting states, such as setSelectionMode, it not only updates the mode for the row selection model but also sets similar values in the selection model of the columnModel. If you want to have the row and column selection models operating in different modes, set them both directly.

Both the row and column selection models for JTable default to using a DefaultListSelectionModel so that JTable works the same way as the JList. See the setSelectionMode method in JList for details about the modes.

Overrides:
setSelectionMode in class javax.swing.JTable
See Also:
JList.setSelectionMode(int)

getRowSelectionAllowed

public boolean getRowSelectionAllowed()
Returns true if rows can be selected.

Overrides:
getRowSelectionAllowed in class javax.swing.JTable
Returns:
true if rows can be selected, otherwise false
See Also:
setRowSelectionAllowed(boolean)

setRowSelectionAllowed

public void setRowSelectionAllowed(boolean rowSelectionAllowed)
Sets whether the rows in this model can be selected.

Overrides:
setRowSelectionAllowed in class javax.swing.JTable
Parameters:
rowSelectionAllowed - true if this model will allow row selection
See Also:
getRowSelectionAllowed()

setColumnSelectionAllowed

public void setColumnSelectionAllowed(boolean columnSelectionAllowed)
Sets whether the columns in this model can be selected.

Overrides:
setColumnSelectionAllowed in class javax.swing.JTable
Parameters:
columnSelectionAllowed - true if this model will allow column selection
See Also:
JTable.getColumnSelectionAllowed()

setCellSelectionEnabled

public void setCellSelectionEnabled(boolean cellSelectionEnabled)
Sets whether this table allows both a column selection and a row selection to exist simultaneously. When set, the table treats the intersection of the row and column selection models as the selected cells. Override isCellSelected to change this default behavior. This method is equivalent to setting both the rowSelectionAllowed property and columnSelectionAllowed property of the columnModel to the supplied value.

Overrides:
setCellSelectionEnabled in class javax.swing.JTable
Parameters:
cellSelectionEnabled - true if simultaneous row and column selection is allowed
See Also:
getCellSelectionEnabled(), isCellSelected(int, int)

getCellSelectionEnabled

public boolean getCellSelectionEnabled()
Returns true if both row and column selection models are enabled. Equivalent to getRowSelectionAllowed() && getColumnSelectionAllowed().

Overrides:
getCellSelectionEnabled in class javax.swing.JTable
Returns:
true if both row and column selection models are enabled
See Also:
setCellSelectionEnabled(boolean)

selectAll

public void selectAll()
Selects all rows, columns, and cells in the table.

Overrides:
selectAll in class javax.swing.JTable

clearSelection

public void clearSelection()
Deselects all selected columns and rows.

Overrides:
clearSelection in class javax.swing.JTable

boundRow

protected int boundRow(int row)
                throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

boundColumn

protected int boundColumn(int col)

setCellSelectionInterval

public void setCellSelectionInterval(int row0,
                                     int column0,
                                     int row1,
                                     int column1)
Selects the cells from row0, column0 to row1, column1, inclusive.

Parameters:
row0 - the first row
column0 - the first column
row1 - the last row
column1 - the last column
Throws:
java.lang.IllegalArgumentException - if row0 or row1 lie outside [0, getRowCount()-1] or if column0 or column1 lie outside [0, getColumnCount()-1]

setRowSelectionInterval

public void setRowSelectionInterval(int index0,
                                    int index1)
Selects the rows from index0 to index1, inclusive.

Overrides:
setRowSelectionInterval in class javax.swing.JTable
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
java.lang.IllegalArgumentException - if index0 or index1 lie outside [0, getRowCount()-1]

setColumnSelectionInterval

public void setColumnSelectionInterval(int index0,
                                       int index1)
Selects the columns from index0 to index1, inclusive.

Overrides:
setColumnSelectionInterval in class javax.swing.JTable
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
java.lang.IllegalArgumentException - if index0 or index1 lie outside [0, getColumnCount()-1]

addCellSelectionInterval

public void addCellSelectionInterval(int row0,
                                     int column0,
                                     int row1,
                                     int column1)
Adds the cells from row0, column0 to row1, column1, inclusive.

Parameters:
row0 - the first row
column0 - the first column
row1 - the last row
column1 - the last column
Throws:
java.lang.IllegalArgumentException - if row0 or row1 lie outside [0, getRowCount()-1] or if column0 or column1 lie outside [0, getColumnCount()-1]

addRowSelectionInterval

public void addRowSelectionInterval(int index0,
                                    int index1)
Adds the rows from index0 to index1, inclusive, to the current selection.

Overrides:
addRowSelectionInterval in class javax.swing.JTable
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
java.lang.IllegalArgumentException - if index0 or index1 lie outside [0, getRowCount()-1]

addColumnSelectionInterval

public void addColumnSelectionInterval(int index0,
                                       int index1)
Adds the columns from index0 to index1, inclusive, to the current selection.

Overrides:
addColumnSelectionInterval in class javax.swing.JTable
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
java.lang.IllegalArgumentException - if index0 or index1 lie outside [0, getColumnCount()-1]

removeCellSelectionInterval

public void removeCellSelectionInterval(int row0,
                                        int column0,
                                        int row1,
                                        int column1)
Deletes the cells from row0, column0 to row1, column1, inclusive.

Parameters:
row0 - the first row
column0 - the first column
row1 - the last row
column1 - the last column
Throws:
java.lang.IllegalArgumentException - if row0 or row1 lie outside [0, getRowCount()-1] or if column0 or column1 lie outside [0, getColumnCount()-1]

removeRowSelectionInterval

public void removeRowSelectionInterval(int index0,
                                       int index1)
Deselects the rows from index0 to index1, inclusive.

Overrides:
removeRowSelectionInterval in class javax.swing.JTable
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
java.lang.IllegalArgumentException - if index0 or index1 lie outside [0, getRowCount()-1]

removeColumnSelectionInterval

public void removeColumnSelectionInterval(int index0,
                                          int index1)
Deselects the columns from index0 to index1, inclusive.

Overrides:
removeColumnSelectionInterval in class javax.swing.JTable
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
java.lang.IllegalArgumentException - if index0 or index1 lie outside [0, getColumnCount()-1]

getSelectedRow

public int getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.

Overrides:
getSelectedRow in class javax.swing.JTable
Returns:
the index of the first selected row

getSelectedColumn

public int getSelectedColumn()
Returns the index of the first selected column, -1 if no column is selected.

Overrides:
getSelectedColumn in class javax.swing.JTable
Returns:
the index of the first selected column

getSelectedCells

public int[][] getSelectedCells()
Returns ar array of integers mapping to the row, column pairs of all selected cells. The selected cells does no not contain the cells in the selected rows or column, only the individual cells that have been selected.

Returns:
an array of an array of integers containing the row an dcolumn pair all selected cells, or an empty array if no cell is selected

getSelectedCellsForRow

public int[][] getSelectedCellsForRow(int row)
Returns the selected cells for the given row. Returns an array of integers mapping to the row, column pairs of all selected cells in the given row. If the row is selected, the does not mean the cells are selected.

Parameters:
row - the index of the row
Returns:
an array of an array of integers containing the row and column pair all selected cells for the given row.

getSelectedCellsForColumn

public int[][] getSelectedCellsForColumn(int column)
Returns the selected cells for the given column. Returns an array of integers mapping to the row, column pairs of all selected cells in the given column. If the column is selected, the does not mean the cells are selected.

Parameters:
column - the index of the column
Returns:
an array of an array of integers containing the row and column pair all selected cells for the given column.

getSelectedRows

public int[] getSelectedRows()
Returns the indices of all selected rows.

Overrides:
getSelectedRows in class javax.swing.JTable
Returns:
an array of integers containing the indices of all selected rows, or an empty array if no row is selected
See Also:
getSelectedRow()

getSelectedColumns

public int[] getSelectedColumns()
Returns the indices of all selected columns.

Overrides:
getSelectedColumns in class javax.swing.JTable
Returns:
an array of integers containing the indices of all selected columns, or an empty array if no column is selected
See Also:
getSelectedColumn()

getSelectedCellCount

public int getSelectedCellCount()
Returns the number of selected cells.

Returns:
the number of selected cells, 0 if no cells are selected

getSelectedRowCount

public int getSelectedRowCount()
Returns the number of selected rows.

Overrides:
getSelectedRowCount in class javax.swing.JTable
Returns:
the number of selected rows, 0 if no rows are selected

getSelectedColumnCount

public int getSelectedColumnCount()
Returns the number of selected columns.

Overrides:
getSelectedColumnCount in class javax.swing.JTable
Returns:
the number of selected columns, 0 if no columns are selected

isRowSelected

public boolean isRowSelected(int row)
Returns true if the row at the specified index is selected.

Overrides:
isRowSelected in class javax.swing.JTable
Returns:
true if the row at index row is selected, where 0 is the first row
Throws:
java.lang.IllegalArgumentException - if row is not in the valid range

isColumnSelected

public boolean isColumnSelected(int column)
Returns true if the column at the specified index is selected.

Overrides:
isColumnSelected in class javax.swing.JTable
Parameters:
column - the column in the column model
Returns:
true if the column at index column is selected, where 0 is the first column
Throws:
java.lang.IllegalArgumentException - if column is not in the valid range

isCellSelected

public boolean isCellSelected(int row,
                              int column)
Returns true if the cell at the specified position is selected.

Overrides:
isCellSelected in class javax.swing.JTable
Parameters:
row - the row being queried
column - the column being queried
Returns:
true if the cell at index (row, column) is selected, where the first row and first column are at index 0
Throws:
java.lang.IllegalArgumentException - if row or column are not in the valid range

changeSelection

public void changeSelection(int rowIndex,
                            int columnIndex,
                            boolean toggle,
                            boolean extend)
Updates the selection models of the table, depending on the state of the two flags: toggle and extend. All changes to the selection that are the result of keyboard or mouse events received by the UI are channeled through this method so that the behavior may be overridden by a subclass.

This implementation uses the following conventions:

Overrides:
changeSelection in class javax.swing.JTable
Parameters:
rowIndex - affects the selection at row
columnIndex - affects the selection at column
toggle - see description above
extend - if true, extend the current selection

setRowAutoResizeMode

public void setRowAutoResizeMode(int mode)
Sets the mode the rows will be sized. Valid values are AUTO_RESIZE_OFF, AUTO_RESIZE_ALL_ROWS or AUTO_RESIZE_FIRST_ROW. The default value is AUTO_RESIZE_FIRST_ROW which means that the preferred height of the first row is the row height for all rows, a call to setRowHeight is made with this value. If the mode is set to AUTO_RESIZE_OFF, the rows will be sized based on whatever the default row height is, a call to setRowHeight can change this height. If AUTO_RESIZE_ALL_ROWS is set, each individual row will get sized to its own preferred height.

Parameters:
mode - sets the mode rows get sized, the default value is AUTO_RESIZE_FIRST_ROW
See Also:
getRowAutoResizeMode()

getRowAutoResizeMode

public int getRowAutoResizeMode()
Returns the mode the rows are sized, values can be AUTO_RESIZE_OFF, AUTO_RESIZE_ALL_ROWS or AUTO_RESIZE_FIRST_ROW.

Returns:
an integer that is used to size the row heights
See Also:
setRowAutoResizeMode(int)

setColumnAutoResizeMode

public void setColumnAutoResizeMode(int mode)
Sets the mode the columns will be sized. Valid values are AUTO_RESIZE_OFF or AUTO_RESIZE_ALL_COLUMNS. The default value is AUTO_RESIZE_ALL_COLUMNS which means that each column gets sized to its calculated preferred width, not the preferred width set on the TableColumn. If the mode is set to AUTO_RESIZE_OFF, the columns will be sized based on whatever their preferred width on the TableColumn is

Parameters:
mode - sets the mode columns get sized, the default value is AUTO_RESIZE_ALL_COLUMNS
See Also:
getColumnAutoResizeMode()

getColumnAutoResizeMode

public int getColumnAutoResizeMode()
Returns the mode the columns are sized, values can be AUTO_RESIZE_OFF or AUTO_RESIZE_ALL_COLUMNS.

Returns:
an integer that is used to size the column heights
See Also:
setColumnAutoResizeMode(int)

doLayout

public void doLayout()
Overrode so that the columns will keep their preferred size if the autoResizeMode is set to AUTO_RESIZE_OFF.

Overrides:
doLayout in class javax.swing.JTable

columnSelectionChanged

public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Invoked when the selection model of the TableColumnModel is changed.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
columnSelectionChanged in interface javax.swing.event.TableColumnModelListener
Overrides:
columnSelectionChanged in class javax.swing.JTable
Parameters:
e - the event received
See Also:
TableColumnModelListener

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Invoked when the row selection changes -- repaints to show the new selection.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Overrides:
valueChanged in class javax.swing.JTable
Parameters:
e - the event received
See Also:
ListSelectionListener

repaintCurrentCell

protected void repaintCurrentCell()

repaintCells

protected void repaintCells(int oldRow,
                            int newRow,
                            int oldColumn,
                            int newColumn)

validateCurrentCell

protected void validateCurrentCell()

changeCurrentCell

public void changeCurrentCell(int row,
                              int column)
Changes the current cell (cell with focus) to the given row-column pair.

Parameters:
row - the row index to give focus to
column - the column index to give focus to

getCurrentCell

public int[] getCurrentCell()
Returns the row-columnpair of the current cell that has focus.

Returns:
an array of length 2, with index 0 being the row and index 1 being the column that has focus

getCurrentRow

public int getCurrentRow()
Returns the current row index that has the lead selection, the row that has focus when the table cell area has focus.

Returns:
the viewer row index with focus or -1 if no rows have focus or the lead selection
See Also:
setCurrentRow(int)

setCurrentRow

public void setCurrentRow(int newRow)
Sets the current row to the given index, the row will have focus.

Parameters:
newRow - the row to gain focus
See Also:
getCurrentRow()

getCurrentColumn

public int getCurrentColumn()
Returns the current column index that has the lead selection, the column that has focus when the table cell area has focus.

Returns:
the viewer column index with focus or -1 if no columns have focus or the lead selection
See Also:
setCurrentColumn(int)

setCurrentColumn

public void setCurrentColumn(int newColumn)
Sets the current column to the given index, the column will have focus.

Parameters:
newColumn - the column to gain focus
See Also:
getCurrentColumn()

getCellAreaHeight

public int getCellAreaHeight()
Returns the height in pixels that the cells are given, this may be equal to a call to getHeight().

Returns:
the height of all the cells in pixels

getCellAreaWidth

public int getCellAreaWidth()
Returns the width in pixels that the cells are given, this may be equal to a call to getWidth().

Returns:
the width of all the cells in pixels

getCellAreaRect

public java.awt.Rectangle getCellAreaRect()
Returns a rectangle the size of all the cells, this rectangle may have the same size as a call to getWith() and getHeight().

Returns:
a rectangle representing the space the cells are being painted in.

setPopupMenuEnabled

public void setPopupMenuEnabled(boolean enablePopupMenu)
Sets whether the popup menu is enabled or not. If the popup menu is disabled, the popup menu will no longer be able to be displayed.

Parameters:
enablePopupMenu - ture to enalbe the popup, false otherwise
See Also:
isPopupMenuEnabled(), showPopup(Point)

isPopupMenuEnabled

public boolean isPopupMenuEnabled()
Returns whether the popup menu is enabled or not, if so, the popup menu can be displayed, if not, a call to showPopup will do nothing.

Returns:
true if the popup menu can be displayed, false otherwise
See Also:
setPopupMenuEnabled(boolean), showPopup(Point), createPopupMenu()

createPopupMenu

public javax.swing.JPopupMenu createPopupMenu()
Creates the default popupMenu used to display the commands to preform on the table. The actions get added to the popup menu when showPopup is called. This only initializes the popup mene and provides the user with a way of subclassing the table and creating their own popup menu.

Returns:
the popup menu used to diplay actions on the table
See Also:
setPopupMenuEnabled(boolean), showPopup(Point)

showPopup

public void showPopup(int row,
                      int column)
Displays the popup menu at the bottom right corner of the cell specified.

Parameters:
row - the row coordinate in the view to display the popup menu for
column - the column coordinate in the view to display the popup menu for

showPopup

public void showPopup(java.awt.Point point)
Displays the popup menu at the given point. The point will be the top-left corner of the popup, or if not enoguh space is available for the popup menu, then the point will be the bottom-left corner of the popup menu. The context of the popupmenu will be relative for the given point that is relative to the table.

Parameters:
point - the location to display the popup menu

showPopup

protected void showPopup(int row,
                         int column,
                         java.awt.Point point)

populatePopupMenu

public void populatePopupMenu(javax.swing.JPopupMenu popup,
                              int row,
                              int column)
Populates a popup menu based on a given row and column.

Parameters:
popup - The menu to populate.
row - the row to use as the context for the popup menu
column - the column to use as the context for the popup menu
See Also:
isPopupMenuEnabled()

configureRowHeaderActionFilter

protected ActionSupportFilter configureRowHeaderActionFilter(int row,
                                                             int column)

configureColumnHeaderActionFilter

protected ActionSupportFilter configureColumnHeaderActionFilter(int row,
                                                                int column)

configureTitleActionFilter

protected ActionSupportFilter configureTitleActionFilter(int row,
                                                         int column)

configureDataCellActionFilter

protected ActionSupportFilter configureDataCellActionFilter(int row,
                                                            int column)

getPopupMenu

public javax.swing.JPopupMenu getPopupMenu()
Returns the popup menu that is used for the tableview.

Returns:
an instance of a JPopupMenu that is used to show actions for the tableview.

populateToolBar

public void populateToolBar(javax.swing.JToolBar toolbar)
Populates a toolbar based on the default actions register on the table in the ActionProvider for the TOOLBAR_AREA type.

Parameters:
toolbar - The toolbar to populate.

configureToolBarActionFilter

protected ActionSupportFilter configureToolBarActionFilter()
Configures the toolbar action filter for the ActionProvider. This is used by the populateToolBar method.


createOrdinal

protected int createOrdinal(int row,
                            int column)

setSize

public void setSize(int width,
                    int height)
Overrode this method so that rows can get sized correctly if needed.

Overrides:
setSize in class java.awt.Component
Parameters:
width - the width of the tableview
height - the height of the tableview

columnMarginChanged

public void columnMarginChanged(javax.swing.event.ChangeEvent e)
Invoked when a column is moved due to a margin change. If a cell is being edited, then editing is stopped and the cell is redrawn.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
columnMarginChanged in interface javax.swing.event.TableColumnModelListener
Overrides:
columnMarginChanged in class javax.swing.JTable
Parameters:
e - the event received
See Also:
TableColumnModelListener

resizeAndRepaint

protected void resizeAndRepaint()
Equivalent to revalidate followed by repaint

Overrides:
resizeAndRepaint in class javax.swing.JTable

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping to the view coordinate system is performed by this TableView when it receives the event.

Application code will not use these methods explicitly, they are used internally by TableView.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Overrides:
tableChanged in class javax.swing.JTable

tableRowsInserted

protected void tableRowsInserted(javax.swing.event.TableModelEvent e)

tableRowsDeleted

protected void tableRowsDeleted(javax.swing.event.TableModelEvent e)

tableRowsUpdated

protected void tableRowsUpdated(javax.swing.event.TableModelEvent e)

handlePostSortingSelections

protected void handlePostSortingSelections(javax.swing.event.TableModelEvent e)

columnMoved

public void columnMoved(javax.swing.event.TableColumnModelEvent e)
Invoked when a column is repositioned. If a cell is being edited, then editing is stopped and the cell is redrawn.

Application code will not use these methods explicitly, they are used internally by the TableView.

Specified by:
columnMoved in interface javax.swing.event.TableColumnModelListener
Overrides:
columnMoved in class javax.swing.JTable
Parameters:
e - the event received
See Also:
TableColumnModelListener

rowMoved

public void rowMoved(TableRowModelEvent e)
Tells listeners that a row was repositioned.

Specified by:
rowMoved in interface TableRowModelListener

columnRemoved

public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
Invoked when a column is removed from the table column model.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
columnRemoved in interface javax.swing.event.TableColumnModelListener
Overrides:
columnRemoved in class javax.swing.JTable
See Also:
TableColumnModelListener

rowMarginChanged

public void rowMarginChanged(javax.swing.event.ChangeEvent e)
Tells listeners that a row was moved due to a margin change.

Specified by:
rowMarginChanged in interface TableRowModelListener

rowSelectionChanged

public void rowSelectionChanged(javax.swing.event.ListSelectionEvent e)
Tells listeners that the selection model of the TableRowModel changed.

Specified by:
rowSelectionChanged in interface TableRowModelListener

contentsChanged

public void contentsChanged(com.sas.collection.ContentsChangedEvent event)
Invoked when the table receives a ContentsChangeEvent from the action provider.

Application code will not use these methods explicitly, they are used internally by TableView.

Specified by:
contentsChanged in interface com.sas.collection.ContentsChangedListener
Parameters:
event - the contents changed event

setActionProvider

public void setActionProvider(SwingActionProvider actionProvider)
Sets the ActionProvider object which is used to generate all the actions that get displayed in the popupmenu for the TableView.

Specified by:
setActionProvider in interface SwingActionProviderViewInterface
Parameters:
actionProvider - the new action provider instance
See Also:
getActionProvider()

getActionProvider

public SwingActionProvider getActionProvider()
Returns the ActionProvider object used to return actions for the TableView.

Specified by:
getActionProvider in interface SwingActionProviderViewInterface
Returns:
ActionProvider object
See Also:
SwingActionProviderViewInterface.setActionProvider(com.sas.actionprovider.SwingActionProvider)

setActionVisible

public void setActionVisible(java.lang.String actionType,
                             java.lang.String areaType,
                             boolean visible)
Sets the visible status of the specified actionType for the specified area. The actionType must be non-null. The actionType and areaType must be valid in the support class that is associated with this classes current actionSupportType attribute.

Specified by:
setActionVisible in interface ActionProviderViewInterface
Parameters:
actionType - The key that identifies the type of action.
area - The area affected by the change in visibility fort the actionType. If null, then the method call applies to all the known areaTypes.
visible - The boolean indicating whether the actionType should be hidden or unhidden.
Throws:
java.lang.IllegalArgumentException - if null or invalid actionType specified.
java.lang.IllegalArgumentException - if invalid areaType specified.
java.lang.IllegalStateException - if actionSupportType not set.
See Also:
ActionProviderViewInterface.isActionVisible(java.lang.String, java.lang.String), ActionProviderSupportTypes

isActionVisible

public boolean isActionVisible(java.lang.String actionType,
                               java.lang.String areaType)
Returns a boolean indicating if the action type is visible everywhere in the specified areaType. If the actionType is not visible anywhere anywhere in the areaType, then false is returned.

Specified by:
isActionVisible in interface ActionProviderViewInterface
Parameters:
actionType - The key that identifies the type of action as defined by the support class.
areaType - The key that identifies the type of area as defined by the support class.
Returns:
a boolean indicating if the action type is visible everywhere in the specified areaType.
See Also:
ActionProviderViewInterface.setActionVisible(java.lang.String, java.lang.String, boolean), ActionProviderSupportTypes

getUniqueId

public java.lang.Object getUniqueId()
Returns the Viewer's uniqueId

Specified by:
getUniqueId in interface ActionProviderViewInterface
Returns:
the Viewer's uniqueId
See Also:
ActionProviderViewInterface.setUniqueId(java.lang.Object)

setUniqueId

public void setUniqueId(java.lang.Object uniqueId)
Returns the Viewer's uniqueId

Specified by:
setUniqueId in interface ActionProviderViewInterface
See Also:
ActionProviderViewInterface.getUniqueId()

listAreaTypes

public java.util.Collection listAreaTypes()
Returns a Collection of String keys that define the valid areaTypes for the action support class designated by the actionSupportType attribute.

Specified by:
listAreaTypes in interface ActionProviderViewInterface
Parameters:
actionSupportType - The key associated with a support class.
Returns:
a Collection of String keys that define the valid areaTypes for the specified support class.
See Also:
ActionProviderViewInterface.listActionTypes(java.lang.String), ActionProviderViewInterface.setActionSupportType(java.lang.String)

listActionTypes

public java.util.Collection listActionTypes(java.lang.String areaType)
Returns a Collection of String keys that define the valid actionTypes for the specified area of the action support class designated the actionSupportType attribute.

Specified by:
listActionTypes in interface ActionProviderViewInterface
Parameters:
actionSupportType - The key associated with a support class.
areaType - The key associated with a defined areaType.
Returns:
a Collection of String keys that define the valid actionTypes for the specified area of the specified support class.
See Also:
ActionProviderViewInterface.listAreaTypes(), ActionProviderViewInterface.setActionSupportType(java.lang.String)

setActionSupportType

public void setActionSupportType(java.lang.String actionSupportType)
Set the key that associated with a particular support class in the ActionProvider framework.

Specified by:
setActionSupportType in interface ActionProviderViewInterface
Parameters:
actionSupportType - The key that is associated with a particular support class.
See Also:
ActionProviderViewInterface.getActionSupportType(), ActionProviderSupportTypes

getActionSupportType

public java.lang.String getActionSupportType()
Return the key that associated with a particular support class in the ActionProvider framework.

Specified by:
getActionSupportType in interface ActionProviderViewInterface
Returns:
the key that associated with a particular support class.
See Also:
ActionProviderViewInterface.setActionSupportType(java.lang.String), ActionProviderSupportTypes

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Invoked when an adjustment event is received form the scroll bars from the JScrollPane containing the TableView. This is used in case the table view needs to size its rows, depending on the rowAutoResizeMode.

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener
Parameters:
e - the adjustment event received from the scroll bars

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Prints the table, taking into account the held rows and columns. THe held rows and columns will be printed on each page.

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - The Graphics context used for printing
pageFormat - the format of the page
pageIndex - the page index of the current print
Returns:
either NO_SUCH_PAGE or PAGE_EXISTS, if NO_SUCH_PAGE is returned, that signales that all pages have been printed and none are left.
Throws:
java.awt.print.PrinterException - throws a PrinterException if a problem is encountered

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrode this method as the clipBounds needs to be modified on the Graphics due to held rows and columns, if nothing is currently being held, the clipBounds will be left untouched.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - The Graphics context used for the painting

printComponent

public void printComponent(java.awt.Graphics g)
Overrode this method so that the clipbounds will not be modified to accomate the held rows and column when printing as the clipbounds should already be set to the correct size.

Overrides:
printComponent in class javax.swing.JComponent
Parameters:
g - The Graphics context used for printing

getClipboardAdapter

public TableViewClipboardAdapter getClipboardAdapter()
Returns the clipboard adapter used by the tableView. TableViewClipboardAdapter enables Cut-Copy-Paste Clipboard functionality on com.sas.swing.visual.tableview.TableViews.

Returns:
instance of clipboard adapter
See Also:
#setClipBoardAdapter(com.sas.swing.adapters.TableViewClipboardAdapter)

setClipboardAdapter

public void setClipboardAdapter(TableViewClipboardAdapter clipboardAdapter)
Sets the clipboard adapter used by the tableView.

Parameters:
clipboardAdapter - instance of TableViewClipboardAdapter
See Also:
getClipboardAdapter()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.