|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.visuals.tableview.TableView
public class TableView
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:
TableView requires a model that implements TableModel
.
If available, it will also utilize the following:
FormattedInterface
InsertRowInterface
MoveColumnInterface
SortableInterface
DeleteRowInterface
UpdateRowInterface
StaticRowLabelInterface
To attach a model to TableView:
setModel (your-model);
[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 .
JTable
,
Serialized FormConstructor 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 |
---|
public static final java.lang.String RB_KEY
public static final int LASTROW
protected static final java.lang.String uiClassID
getUIClassID()
,
Constant Field Valuesprotected javax.swing.SizeSequence rowHeightModel
protected boolean changingCurrentCell
protected SwingViewerSupport viewerSupport
protected ActionSupportFilter dataCellFilter
protected ActionSupportFilter rowHeaderFilter
protected ActionSupportFilter columnHeaderFilter
protected ActionSupportFilter titleFilter
protected ActionSupportFilter toolbarFilter
protected boolean columnsSized
protected int rowAutoResizeMode
protected int columnAutoResizeMode
protected GenericErrorHandlerInterface genericErrorHandler
protected ActionUIFactory factory
protected boolean tableInitialized
public static final int AUTO_RESIZE_FIRST_ROW
public static final int AUTO_RESIZE_ALL_ROWS
public boolean printing
protected java.lang.String[] lastSortedColumns
protected int[] lastSortDirections
protected boolean clearRowSelectionAfterSorting
Constructor Detail |
---|
public TableView()
TableView
that is initialized with a default
data model, a default column model, a default row model, and default selection models.
JTable.createDefaultDataModel()
,
JTable.createDefaultColumnModel()
,
createDefaultSelectionModel()
,
createDefaultRowModel()
public TableView(javax.swing.table.TableModel tableModel)
TableView
that is initialized with
tableModel
as the data model, a default column model, a default row model,
and default selection models.
tableModel
- the data model for the tableJTable.createDefaultColumnModel()
,
createDefaultSelectionModel()
,
createDefaultRowModel()
public TableView(javax.swing.table.TableModel tableModel, javax.swing.table.TableColumnModel columnModel)
TableView
that is initialized with
tableModel
as the data model, columnModel
as the column model, a default row model, and default selection models.
tableModel
- the data model for the tablecolumnModel
- the column model for the tablecreateDefaultSelectionModel()
,
createDefaultRowModel()
public TableView(javax.swing.table.TableModel tableModel, javax.swing.table.TableColumnModel columnModel, javax.swing.ListSelectionModel selectionModel)
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
.
tableModel
- the data model for the tablecolumnModel
- the column model for the tableselectionModel
- the row selection model for the tableJTable.createDefaultDataModel()
,
JTable.createDefaultColumnModel()
,
createDefaultSelectionModel()
,
createDefaultRowModel()
public TableView(int numRows, int numColumns)
TableView
with numRows
and numColumns
of empty cells using
DefaultTableModel
. The columns will have
names of the form "A", "B", "C", etc.
numRows
- the number of rows the table holdsnumColumns
- the number of columns the table holdsDefaultTableModel
public TableView(java.util.Vector rowData, java.util.Vector columnNames)
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);
rowData
- the data for the new tablecolumnNames
- names of each columnpublic TableView(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
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
.
rowData
- the data for the new tablecolumnNames
- names of each columnMethod Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
com.sas.beans.Introspector
to
augment the automatically introspected information about this TableView.
public int rowAtPoint(java.awt.Point point)
point
lies in,
or -1 if the result is not in the range
[0, getRowCount()
- 1].
rowAtPoint
in class javax.swing.JTable
point
- the location of interest
point
lies in,
or -1 if the result is not in the range
[0, getRowCount()
- 1]columnAtPoint(java.awt.Point)
public int rowAtPoint(java.awt.Point point, boolean accountForHolds)
point
lies in,
or -1 if the result is not in the range
[0, getRowCount()
- 1].
point
- the location of interestaccountForHolds
- 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.
point
lies in,
or -1 if the result is not in the range
[0, getRowCount()
- 1]columnAtPoint(java.awt.Point)
public int columnAtPoint(java.awt.Point point)
point
lies in,
or -1 if the result is not in the range
[0, getColumnCount()
- 1].
columnAtPoint
in class javax.swing.JTable
point
- the location of interest
point
lies in,
or -1 if the result is not in the range
[0, getColumnCount()
- 1]rowAtPoint(java.awt.Point)
public int columnAtPoint(java.awt.Point point, boolean accountForHolds)
point
lies in,
or -1 if the result is not in the range
[0, getColumnCount()
- 1].
point
- the location of interestaccountForHolds
- 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.
point
lies in,
or -1 if the result is not in the range
[0, getColumnCount()
- 1]rowAtPoint(java.awt.Point)
public java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing, boolean accountForHolds)
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.
includeSpacing
- if false, return the true cell bounds -
computed by subtracting the intercell
spacing from the height and widths of
the column and row modelsaccountForHolds
- 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
row
, column
public java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing)
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.
getCellRect
in class javax.swing.JTable
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
row
, column
getCellRect(int, int, boolean, boolean)
public int getFirstVisibleRow()
public int getLastVisibleRow()
public int getFirstVisibleColumn()
public int getLastVisibleColumn()
public void setRowMargin(int rowMargin)
setRowMargin
in class javax.swing.JTable
rowMargin
- the number of pixels between cells in a rowgetRowMargin()
public int getRowMargin()
getIntercellSpacing().height
.
getRowMargin
in class javax.swing.JTable
setRowMargin(int)
public java.awt.Dimension getIntercellSpacing()
getIntercellSpacing
in class javax.swing.JTable
JTable.setIntercellSpacing(java.awt.Dimension)
public int getGridWidth()
setGridWidth(int)
public void setGridWidth(int newWidth)
newWidth
- The new size the draw the grid linesgetGridWidth()
public java.awt.Point getViewPosition()
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
.
public java.lang.Object getValueAt(int row, int column)
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.
getValueAt
in class javax.swing.JTable
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
getUnformattedColumnClass(int)
,
String.trim()
public java.lang.Object getUnformattedValueAt(int row, int column)
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.
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
getValueAt(int, int)
,
FormattedInterface
public void setValueAt(java.lang.Object aValue, int row, int column)
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.
setValueAt
in class javax.swing.JTable
aValue
- the new valuerow
- the row of the cell to be changedcolumn
- the column of the cell to be changedgetValueAt(int, int)
public boolean isCellEditable(int row, int column)
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.
isCellEditable
in class javax.swing.JTable
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
setValueAt(Object, int, int)
public int convertRowIndexToModel(int viewRowIndex)
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
.
convertRowIndexToModel
in class javax.swing.JTable
viewRowIndex
- the index of the row in the view
convertRowIndexToView(int)
public int convertRowIndexToView(int modelRowIndex)
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
.
convertRowIndexToView
in class javax.swing.JTable
modelRowIndex
- the index of the row in the model
convertRowIndexToModel(int)
protected javax.swing.ListSelectionModel createDefaultSelectionModel()
CellSelectionModel
. A subclass can override this
method to return a different selection model object.
createDefaultSelectionModel
in class javax.swing.JTable
CellSelectionModel
protected javax.swing.table.JTableHeader createDefaultTableHeader()
ColumnHeader
. A subclass can override this
method to return a different table header object.
createDefaultTableHeader
in class javax.swing.JTable
TableView
JTableHeader
,
ColumnHeader
public javax.swing.JScrollPane getScrollPane()
JScrollPane
that the table resides in if there
is a scroll pane.
JScrollPane
protected void configureEnclosingScrollPane()
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.
configureEnclosingScrollPane
in class javax.swing.JTable
JTable.addNotify()
protected void unconfigureEnclosingScrollPane()
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.
unconfigureEnclosingScrollPane
in class javax.swing.JTable
JTable.removeNotify()
,
configureEnclosingScrollPane()
public void setRowHeaderVisible(boolean b)
JScrollPane
for this to work.
b
- true to show the row header, false to hide the headerisRowHeaderVisible()
public boolean isRowHeaderVisible()
setRowHeaderVisible(boolean)
public void setRowsReorderable(boolean newValue)
newValue
- true to makes the rows reorderable, false otherwiseisRowsReorderable()
public boolean isRowsReorderable()
setRowsReorderable(boolean)
public void setColumnHeaderVisible(boolean b)
JScrollPane
for this to work.
b
- true to show the column header, false to hide the headerisColumnHeaderVisible()
public boolean isColumnHeaderVisible()
setColumnHeaderVisible(boolean)
public void setEditController(com.sas.table.EditControllerInterface newEditController)
controller
- the new edit controllerEditControllerInterface
public com.sas.table.EditControllerInterface getEditController()
EditControllerInterface
protected void initializeLocalVars()
initializeLocalVars
in class javax.swing.JTable
public void createDefaultViewerSupport()
com.sas.actionprovider.support.SwingViewerSupport
. The action
support type is set to com.sas.actionprovider.support.ActionProviderSupportTypes.TABLEVIEW_SUPPORT
public void createDefaultActionProviderFilters()
protected boolean processKeyBinding(javax.swing.KeyStroke ks, java.awt.event.KeyEvent e, int condition, boolean pressed)
processKeyBinding
in class javax.swing.JTable
public java.lang.Class getUnformattedColumnClass(int column)
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.
column
- the column in the view being queried
column
in the view where the first column is column 0FormattedInterface.getUnformattedColumnClass(int)
,
getCellRenderer(int, int)
protected void createDefaultRenderers()
createDefaultRenderers
in class javax.swing.JTable
DefaultTableCellRenderer
protected void createDefaultEditors()
createDefaultEditors
in class javax.swing.JTable
DefaultTableCellEditor
public void setCellRenderer(int row, int column, javax.swing.table.TableCellRenderer renderer)
row
- the row to set the renderer on, -1 if setting the renderer
on the entire column is desiredcolumn
- the column to set the renderer on, -1 if setting the renderer
on the entire row is desiredrenderer
- the renderer to use for the row and column, null to remove
the renderer if previously setsetCellRenderer(int, int, int, int, int, int, TableCellRenderer)
,
getCellRenderer(int, int)
public void setCellRenderer(int startRow, int endRow, int repeatRowFactor, int startColumn, int endColumn, int repeatColumnFactor, javax.swing.table.TableCellRenderer renderer)
The valid values for startRow and startColumn are:
start >= 1The valid values for endRow and endColumn are:
end >= start, or end == -1 for all rows/columnsThe 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.
startRow
- the first row in the specified area to set the renderer onendRow
- the last row in the specified area to set the renderer on or
-1 for all rows after startRowrepeatRowFactor
- specifies every nth row after the startRow to set the
renderer onstartColumn
- the first column in the specified area to set the renderer onendRow
- the last column in the specified area to set the renderer on or
-1 for all columns after startColumnrepeatColumnFactor
- specifies every nth column after the startColumn to set the
renderer onrenderer
- the renderer to use for specified area or null to remove the
renderer for the specified areasetCellRenderer(int, int, TableCellRenderer)
,
getCellRenderer(int, int)
public javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
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.
getCellRenderer
in class javax.swing.JTable
row
- the row of the cell to render, where 0 is the first rowcolumn
- the column of the cell to render,
where 0 is the first column
null
returns the default renderer
for this type of objectgetUnformattedColumnClass(int)
,
setCellRenderer(int, int, TableCellRenderer)
,
setCellRenderer(int, int, int, int, int, int, TableCellRenderer)
,
DefaultTableCellRenderer
,
TableColumn.setCellRenderer(javax.swing.table.TableCellRenderer)
,
JTable.setDefaultRenderer(Class, TableCellRenderer)
public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int row, int column)
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.
prepareRenderer
in class javax.swing.JTable
renderer
- the TableCellRenderer
to preparerow
- the row of the cell to render, where 0 is the first rowcolumn
- the column of the cell to render,
where 0 is the first columnpublic java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor, int row, int column)
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.
prepareEditor
in class javax.swing.JTable
editor
- the TableCellEditor
to set uprow
- the row of the cell to edit,
where 0 is the first rowcolumn
- the column of the cell to edit,
where 0 is the first column
Component
being editedpublic void setCellEditor(int row, int column, javax.swing.table.TableCellEditor editor)
row
- the row to set the editor on, -1 if setting the editor
on the entire column is desiredcolumn
- the column to set the editor on, -1 if setting the editor
on the entire row is desirededitor
- the editor to use for the row and column, null to remove
the editor if previously setsetCellEditor(int, int, int, int, int, int, TableCellEditor)
,
getCellEditor(int, int)
public void setCellEditor(int startRow, int endRow, int repeatRowFactor, int startColumn, int endColumn, int repeatColumnFactor, javax.swing.table.TableCellEditor editor)
The valid values for startRow and startColumn are:
start >= 1The valid values for endRow and endColumn are:
end >= start, or end == -1 for all rows/columnsThe 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.
startRow
- the first row in the specified area to set the editor onendRow
- the last row in the specified area to set the editor on or
-1 for all rows after startRowrepeatRowFactor
- specifies every nth row after the startRow to set the
editor onstartColumn
- the first column in the specified area to set the editor onendRow
- the last column in the specified area to set the editor on or
-1 for all columns after startColumnrepeatColumnFactor
- specifies every nth column after the startColumn to set the
editor oneditor
- the editor to use for specified area or null to remove the
editor for the specified areasetCellEditor(int, int, TableCellEditor)
,
getCellEditor(int, int)
public javax.swing.table.TableCellEditor getCellEditor(int row, int column)
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.
getCellEditor
in class javax.swing.JTable
row
- the row of the cell to edit, where 0 is the first rowcolumn
- the column of the cell to edit,
where 0 is the first column
null
return the default editor for
this type of cellDefaultCellEditor
,
setCellEditor(int, int, TableCellEditor)
,
setCellEditor(int, int, int, int, int, int, TableCellEditor)
public GenericErrorHandlerInterface getGenericErrorHandler()
getGenericErrorHandler
in interface SupportsGenericErrorHandlerInterface
setGenericErrorHandler(GenericErrorHandlerInterface)
public void setGenericErrorHandler(GenericErrorHandlerInterface errorHandler)
setGenericErrorHandler
in interface SupportsGenericErrorHandlerInterface
errorHandler
- the new error handler interface to use to handle errors or null to remove
the current error handlergetGenericErrorHandler()
public void updateUI()
UIManager
that the look and feel
(L&F) has changed.
Replaces the current UI object with the latest version from the
UIManager
.
updateUI
in class javax.swing.JTable
JComponent.updateUI()
public java.lang.String getUIClassID()
getUIClassID
in class javax.swing.JTable
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected TableRowModel createDefaultRowModel()
DefaultTableRowModel
. A subclass can override this
method to return a different row model object.
DefaultTableRowModel
protected RowHeader createDefaultRowHeader()
RowHeader
. A subclass can override this
method to return a different row header object.
RowHeader
protected javax.swing.JComponent createDefaultOriginComponent()
public void setRowHeader(RowHeader newHeader)
rowHeader
working with this TableView
to newHeader
.
It is legal to have a null
rowHeader
.
newHeader
- new row headergetRowHeader()
public RowHeader getRowHeader()
rowHeader
used by this TableView
.
rowHeader
used by this tablesetRowHeader(RowHeader)
public void setColumnHeader(ColumnHeader columnHeader)
setTableHeader(JTableHeader)
.
columnHeader
- the new column header to use on the table, calls setTableHeader(columnHeader)getColumnHeader()
public ColumnHeader getColumnHeader()
getTableHeader()
and casts the header to a ColumnHeader
. Will return null if the tableHeader
is not an instance of a ColumnHeader.
setColumnHeader(ColumnHeader)
public void setOriginComponent(javax.swing.JComponent newOriginComponent)
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.
newOriginComponent
- the new component to display in the top left corner of the tablegetOriginComponent()
public javax.swing.JComponent getOriginComponent()
setOriginComponent(JComponent)
public void setRowHeight(int rowHeight)
rowHeight
,
revalidates, and repaints.
The height of the cells in this row will be equal to the row height minus
the row margin.
setRowHeight
in class javax.swing.JTable
rowHeight
- new row heightJTable.getRowHeight()
public void setRowHeight(int row, int rowHeight)
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.
setRowHeight
in class javax.swing.JTable
row
- the row whose height is being
changedrowHeight
- new row height, in pixels
java.lang.IllegalArgumentException
- if rowHeight
is
less than 1public int getRowHeight(int row)
row
.
getRowHeight
in class javax.swing.JTable
row
- the row whose height is to be returned
public void setRowModel(TableRowModel rowModel)
newModel
and registers
for listener notifications from the new row model. Also sets
the row model of the RowHeader
to rowModel
.
rowModel
- the new data source for this table
java.lang.IllegalArgumentException
- if rowModel
is null
getRowModel()
public TableRowModel getRowModel()
TableRowModel
that contains all row information
of this table.
setRowModel(com.sas.swing.visuals.tableview.TableRowModel)
public void hideColumn(int columnModelIndex)
columnModelIndex
invisible to the table.
columnModelIndex
- the column to hide. The index should be
a data model index.showColumn(int)
public void showColumn(int columnModelIndex)
columnModelIndex
visible to the table again.
The new column will be added back to the table where the column was previously.
columnModelIndex
- the index of the column to unhide. The index
should be a data model index.hideColumn(int)
public void showAllColumns()
hideColumn(int)
public java.util.List getHiddenColumns()
public void moveRow(int fromIndex, int toIndex)
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.
rowIndex
- the view index of row to be movednewIndex
- the new view index of the rowpublic boolean isColumnMoveAllowed(int columnIndex, int newIndex)
isColumnMoveAllowed
in interface com.sas.table.MoveColumnInterface
columnIndex
- The index of the column to be moved.newIndex
- The index of the column's new location.
public void copy()
public void paste()
public void cut()
public void setSelectionMode(int selectionMode)
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.
setSelectionMode
in class javax.swing.JTable
JList.setSelectionMode(int)
public boolean getRowSelectionAllowed()
getRowSelectionAllowed
in class javax.swing.JTable
setRowSelectionAllowed(boolean)
public void setRowSelectionAllowed(boolean rowSelectionAllowed)
setRowSelectionAllowed
in class javax.swing.JTable
rowSelectionAllowed
- true if this model will allow row selectiongetRowSelectionAllowed()
public void setColumnSelectionAllowed(boolean columnSelectionAllowed)
setColumnSelectionAllowed
in class javax.swing.JTable
columnSelectionAllowed
- true if this model will allow column selectionJTable.getColumnSelectionAllowed()
public void setCellSelectionEnabled(boolean cellSelectionEnabled)
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.
setCellSelectionEnabled
in class javax.swing.JTable
cellSelectionEnabled
- true if simultaneous row and column
selection is allowedgetCellSelectionEnabled()
,
isCellSelected(int, int)
public boolean getCellSelectionEnabled()
getRowSelectionAllowed() &&
getColumnSelectionAllowed()
.
getCellSelectionEnabled
in class javax.swing.JTable
setCellSelectionEnabled(boolean)
public void selectAll()
selectAll
in class javax.swing.JTable
public void clearSelection()
clearSelection
in class javax.swing.JTable
protected int boundRow(int row) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
protected int boundColumn(int col)
public void setCellSelectionInterval(int row0, int column0, int row1, int column1)
row0
, column0
to row1
, column1
,
inclusive.
row0
- the first rowcolumn0
- the first columnrow1
- the last rowcolumn1
- the last column
java.lang.IllegalArgumentException
- if row0
or
row1
lie outside [0, getRowCount()
-1] or
if column0
or column1
lie outside
[0, getColumnCount()
-1]public void setRowSelectionInterval(int index0, int index1)
index0
to index1
,
inclusive.
setRowSelectionInterval
in class javax.swing.JTable
index0
- one end of the intervalindex1
- the other end of the interval
java.lang.IllegalArgumentException
- if index0
or
index1
lie outside
[0, getRowCount()
-1]public void setColumnSelectionInterval(int index0, int index1)
index0
to index1
,
inclusive.
setColumnSelectionInterval
in class javax.swing.JTable
index0
- one end of the intervalindex1
- the other end of the interval
java.lang.IllegalArgumentException
- if index0
or
index1
lie outside
[0, getColumnCount()
-1]public void addCellSelectionInterval(int row0, int column0, int row1, int column1)
row0
, column0
to row1
, column1
,
inclusive.
row0
- the first rowcolumn0
- the first columnrow1
- the last rowcolumn1
- the last column
java.lang.IllegalArgumentException
- if row0
or
row1
lie outside [0, getRowCount()
-1] or
if column0
or column1
lie outside
[0, getColumnCount()
-1]public void addRowSelectionInterval(int index0, int index1)
index0
to index1
, inclusive, to
the current selection.
addRowSelectionInterval
in class javax.swing.JTable
index0
- one end of the intervalindex1
- the other end of the interval
java.lang.IllegalArgumentException
- if index0
or index1
lie outside [0, getRowCount()
-1]public void addColumnSelectionInterval(int index0, int index1)
index0
to index1
,
inclusive, to the current selection.
addColumnSelectionInterval
in class javax.swing.JTable
index0
- one end of the intervalindex1
- the other end of the interval
java.lang.IllegalArgumentException
- if index0
or
index1
lie outside
[0, getColumnCount()
-1]public void removeCellSelectionInterval(int row0, int column0, int row1, int column1)
row0
, column0
to row1
, column1
,
inclusive.
row0
- the first rowcolumn0
- the first columnrow1
- the last rowcolumn1
- the last column
java.lang.IllegalArgumentException
- if row0
or
row1
lie outside [0, getRowCount()
-1] or
if column0
or column1
lie outside
[0, getColumnCount()
-1]public void removeRowSelectionInterval(int index0, int index1)
index0
to index1
, inclusive.
removeRowSelectionInterval
in class javax.swing.JTable
index0
- one end of the intervalindex1
- the other end of the interval
java.lang.IllegalArgumentException
- if index0
or
index1
lie outside
[0, getRowCount()
-1]public void removeColumnSelectionInterval(int index0, int index1)
index0
to index1
, inclusive.
removeColumnSelectionInterval
in class javax.swing.JTable
index0
- one end of the intervalindex1
- the other end of the interval
java.lang.IllegalArgumentException
- if index0
or
index1
lie outside
[0, getColumnCount()
-1]public int getSelectedRow()
getSelectedRow
in class javax.swing.JTable
public int getSelectedColumn()
getSelectedColumn
in class javax.swing.JTable
public int[][] getSelectedCells()
public int[][] getSelectedCellsForRow(int row)
row
- the index of the row
public int[][] getSelectedCellsForColumn(int column)
column
- the index of the column
public int[] getSelectedRows()
getSelectedRows
in class javax.swing.JTable
getSelectedRow()
public int[] getSelectedColumns()
getSelectedColumns
in class javax.swing.JTable
getSelectedColumn()
public int getSelectedCellCount()
public int getSelectedRowCount()
getSelectedRowCount
in class javax.swing.JTable
public int getSelectedColumnCount()
getSelectedColumnCount
in class javax.swing.JTable
public boolean isRowSelected(int row)
isRowSelected
in class javax.swing.JTable
row
is selected, where 0 is the
first row
java.lang.IllegalArgumentException
- if row
is not in the
valid rangepublic boolean isColumnSelected(int column)
isColumnSelected
in class javax.swing.JTable
column
- the column in the column model
column
is selected, where
0 is the first column
java.lang.IllegalArgumentException
- if column
is not in the
valid rangepublic boolean isCellSelected(int row, int column)
isCellSelected
in class javax.swing.JTable
row
- the row being queriedcolumn
- the column being queried
(row, column)
is selected,
where the first row and first column are at index 0
java.lang.IllegalArgumentException
- if row
or column
are not in the valid rangepublic void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
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:
toggle
: false, extend
: false.
Clear the previous selection and ensure the new cell is selected.
toggle
: false, extend
: true.
Extend the previous selection to include the specified cell.
toggle
: true, extend
: false.
If the specified cell is selected, deselect it. If it is not selected, select it.
toggle
: true, extend
: true.
Leave the selection state as it is, but move the anchor index to the specified location.
changeSelection
in class javax.swing.JTable
rowIndex
- affects the selection at row
columnIndex
- affects the selection at column
toggle
- see description aboveextend
- if true, extend the current selectionpublic void setRowAutoResizeMode(int mode)
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.
mode
- sets the mode rows get sized, the default value is AUTO_RESIZE_FIRST_ROW
getRowAutoResizeMode()
public int getRowAutoResizeMode()
AUTO_RESIZE_OFF
, AUTO_RESIZE_ALL_ROWS
or AUTO_RESIZE_FIRST_ROW
.
setRowAutoResizeMode(int)
public void setColumnAutoResizeMode(int mode)
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
mode
- sets the mode columns get sized, the default value is AUTO_RESIZE_ALL_COLUMNS
getColumnAutoResizeMode()
public int getColumnAutoResizeMode()
AUTO_RESIZE_OFF
or AUTO_RESIZE_ALL_COLUMNS
.
setColumnAutoResizeMode(int)
public void doLayout()
doLayout
in class javax.swing.JTable
public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
TableColumnModel
is changed.
Application code will not use these methods explicitly, they are used internally by JTable.
columnSelectionChanged
in interface javax.swing.event.TableColumnModelListener
columnSelectionChanged
in class javax.swing.JTable
e
- the event receivedTableColumnModelListener
public void valueChanged(javax.swing.event.ListSelectionEvent e)
Application code will not use these methods explicitly, they are used internally by JTable.
valueChanged
in interface javax.swing.event.ListSelectionListener
valueChanged
in class javax.swing.JTable
e
- the event receivedListSelectionListener
protected void repaintCurrentCell()
protected void repaintCells(int oldRow, int newRow, int oldColumn, int newColumn)
protected void validateCurrentCell()
public void changeCurrentCell(int row, int column)
row
- the row index to give focus tocolumn
- the column index to give focus topublic int[] getCurrentCell()
public int getCurrentRow()
setCurrentRow(int)
public void setCurrentRow(int newRow)
newRow
- the row to gain focusgetCurrentRow()
public int getCurrentColumn()
setCurrentColumn(int)
public void setCurrentColumn(int newColumn)
newColumn
- the column to gain focusgetCurrentColumn()
public int getCellAreaHeight()
public int getCellAreaWidth()
public java.awt.Rectangle getCellAreaRect()
public void setPopupMenuEnabled(boolean enablePopupMenu)
enablePopupMenu
- ture to enalbe the popup, false otherwiseisPopupMenuEnabled()
,
showPopup(Point)
public boolean isPopupMenuEnabled()
showPopup
will do nothing.
setPopupMenuEnabled(boolean)
,
showPopup(Point)
,
createPopupMenu()
public javax.swing.JPopupMenu createPopupMenu()
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.
setPopupMenuEnabled(boolean)
,
showPopup(Point)
public void showPopup(int row, int column)
row
- the row coordinate in the view to display the popup menu forcolumn
- the column coordinate in the view to display the popup menu forpublic void showPopup(java.awt.Point point)
point
- the location to display the popup menuprotected void showPopup(int row, int column, java.awt.Point point)
public void populatePopupMenu(javax.swing.JPopupMenu popup, int row, int column)
popup
- The menu to populate.row
- the row to use as the context for the popup menucolumn
- the column to use as the context for the popup menuisPopupMenuEnabled()
protected ActionSupportFilter configureRowHeaderActionFilter(int row, int column)
protected ActionSupportFilter configureColumnHeaderActionFilter(int row, int column)
protected ActionSupportFilter configureTitleActionFilter(int row, int column)
protected ActionSupportFilter configureDataCellActionFilter(int row, int column)
public javax.swing.JPopupMenu getPopupMenu()
public void populateToolBar(javax.swing.JToolBar toolbar)
toolbar
- The toolbar to populate.protected ActionSupportFilter configureToolBarActionFilter()
protected int createOrdinal(int row, int column)
public void setSize(int width, int height)
setSize
in class java.awt.Component
width
- the width of the tableviewheight
- the height of the tableviewpublic void columnMarginChanged(javax.swing.event.ChangeEvent e)
Application code will not use these methods explicitly, they are used internally by JTable.
columnMarginChanged
in interface javax.swing.event.TableColumnModelListener
columnMarginChanged
in class javax.swing.JTable
e
- the event receivedTableColumnModelListener
protected void resizeAndRepaint()
resizeAndRepaint
in class javax.swing.JTable
public void tableChanged(javax.swing.event.TableModelEvent e)
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
.
tableChanged
in interface javax.swing.event.TableModelListener
tableChanged
in class javax.swing.JTable
protected void tableRowsInserted(javax.swing.event.TableModelEvent e)
protected void tableRowsDeleted(javax.swing.event.TableModelEvent e)
protected void tableRowsUpdated(javax.swing.event.TableModelEvent e)
protected void handlePostSortingSelections(javax.swing.event.TableModelEvent e)
public void columnMoved(javax.swing.event.TableColumnModelEvent e)
Application code will not use these methods explicitly, they are used internally by the TableView.
columnMoved
in interface javax.swing.event.TableColumnModelListener
columnMoved
in class javax.swing.JTable
e
- the event receivedTableColumnModelListener
public void rowMoved(TableRowModelEvent e)
rowMoved
in interface TableRowModelListener
public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
Application code will not use these methods explicitly, they are used internally by JTable.
columnRemoved
in interface javax.swing.event.TableColumnModelListener
columnRemoved
in class javax.swing.JTable
TableColumnModelListener
public void rowMarginChanged(javax.swing.event.ChangeEvent e)
rowMarginChanged
in interface TableRowModelListener
public void rowSelectionChanged(javax.swing.event.ListSelectionEvent e)
rowSelectionChanged
in interface TableRowModelListener
public void contentsChanged(com.sas.collection.ContentsChangedEvent event)
ContentsChangeEvent
from the action provider.
Application code will not use these methods explicitly, they
are used internally by TableView
.
contentsChanged
in interface com.sas.collection.ContentsChangedListener
event
- the contents changed eventpublic void setActionProvider(SwingActionProvider actionProvider)
setActionProvider
in interface SwingActionProviderViewInterface
actionProvider
- the new action provider instancegetActionProvider()
public SwingActionProvider getActionProvider()
getActionProvider
in interface SwingActionProviderViewInterface
SwingActionProviderViewInterface.setActionProvider(com.sas.actionprovider.SwingActionProvider)
public void setActionVisible(java.lang.String actionType, java.lang.String areaType, boolean visible)
setActionVisible
in interface ActionProviderViewInterface
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.
java.lang.IllegalArgumentException
- if null or invalid actionType specified.
java.lang.IllegalArgumentException
- if invalid areaType specified.
java.lang.IllegalStateException
- if actionSupportType not set.ActionProviderViewInterface.isActionVisible(java.lang.String, java.lang.String)
,
ActionProviderSupportTypes
public boolean isActionVisible(java.lang.String actionType, java.lang.String areaType)
isActionVisible
in interface ActionProviderViewInterface
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.
ActionProviderViewInterface.setActionVisible(java.lang.String, java.lang.String, boolean)
,
ActionProviderSupportTypes
public java.lang.Object getUniqueId()
getUniqueId
in interface ActionProviderViewInterface
ActionProviderViewInterface.setUniqueId(java.lang.Object)
public void setUniqueId(java.lang.Object uniqueId)
setUniqueId
in interface ActionProviderViewInterface
ActionProviderViewInterface.getUniqueId()
public java.util.Collection listAreaTypes()
listAreaTypes
in interface ActionProviderViewInterface
actionSupportType
- The key associated with a support class.
ActionProviderViewInterface.listActionTypes(java.lang.String)
,
ActionProviderViewInterface.setActionSupportType(java.lang.String)
public java.util.Collection listActionTypes(java.lang.String areaType)
listActionTypes
in interface ActionProviderViewInterface
actionSupportType
- The key associated with a support class.areaType
- The key associated with a defined areaType.
ActionProviderViewInterface.listAreaTypes()
,
ActionProviderViewInterface.setActionSupportType(java.lang.String)
public void setActionSupportType(java.lang.String actionSupportType)
setActionSupportType
in interface ActionProviderViewInterface
actionSupportType
- The key that is associated with a particular support class.ActionProviderViewInterface.getActionSupportType()
,
ActionProviderSupportTypes
public java.lang.String getActionSupportType()
getActionSupportType
in interface ActionProviderViewInterface
ActionProviderViewInterface.setActionSupportType(java.lang.String)
,
ActionProviderSupportTypes
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged
in interface java.awt.event.AdjustmentListener
e
- the adjustment event received from the scroll barspublic int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
g
- The Graphics context used for printingpageFormat
- the format of the pagepageIndex
- the page index of the current print
java.awt.print.PrinterException
- throws a PrinterException if a problem is encounteredpublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- The Graphics context used for the paintingpublic void printComponent(java.awt.Graphics g)
printComponent
in class javax.swing.JComponent
g
- The Graphics context used for printingpublic TableViewClipboardAdapter getClipboardAdapter()
#setClipBoardAdapter(com.sas.swing.adapters.TableViewClipboardAdapter)
public void setClipboardAdapter(TableViewClipboardAdapter clipboardAdapter)
clipboardAdapter
- instance of TableViewClipboardAdaptergetClipboardAdapter()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |