JIDE 3.5.15

com.jidesoft.grid
Interface TableAdapter

All Known Implementing Classes:
AggregateTable, AggregateTablePane, AutoFilterUtils.AutoFilterRowTable, CategorizedTable, CellSpanTable, CellStyleTable, ContextSensitiveTable, DataTable, FeedTable, GroupTable, HeaderTable, HierarchicalTable, JideTable, NavigableTable, NavigationHierarchicalTable, NavigationSortableTable, NavigationTreeTable, PagedTablePane, PropertyTable, SortableTable, TableScrollPane, TreeTable

public interface TableAdapter

This interface includes many important operations for a JTable. Since TableScrollPane tries to mimic JTable in many aspects, it implements this interface so that the code who uses JTable can switch to TableScrollPane without any or very little code changes.


Method Summary
 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.
 boolean getCellSelectionEnabled()
          Returns true if both row and column selection models are enabled.
 Class<?> getColumnClass(int column)
          Returns the type of the column appearing in the view at column position column.
 int getColumnCount()
          Gets the total column count of TableScrollPane.
 String getColumnName(int column)
          Returns the name of the column appearing in the view at column position column.
 boolean getColumnSelectionAllowed()
          Returns true if columns can be selected.
 int getRowCount()
          Gets the total row count of TableScrollPane.
 boolean getRowSelectionAllowed()
          Returns true if rows can be selected.
 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.
 Object getValueAt(int row, int column)
          Returns the cell value at row and column.
 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 specified indices are in the valid range of rows and columns and the cell at the specified position is selected.
 boolean isColumnSelected(int column)
          Returns true if the specified index is in the valid range of columns, and the column at that index is selected.
 boolean isRowSelected(int row)
          Returns true if the specified index is in the valid range of rows, and the row at that index is selected.
 void setCellSelectionEnabled(boolean cellSelectionEnabled)
          Sets whether this table allows both a column selection and a row selection to exist simultaneously.
 void setColumnSelectionAllowed(boolean columnSelectionAllowed)
          Sets whether the columns can be selected.
 void setRowSelectionAllowed(boolean rowSelectionAllowed)
          Sets whether the rows can be selected.
 void setValueAt(Object aValue, int row, int column)
          Sets the value for the cell in the table model at row and column.
 

Method Detail

setRowSelectionAllowed

void setRowSelectionAllowed(boolean rowSelectionAllowed)
Sets whether the rows can be selected.

Parameters:
rowSelectionAllowed - true if it will allow row selection

getRowSelectionAllowed

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

Returns:
true if rows can be selected, otherwise false
See Also:
setRowSelectionAllowed(boolean)

setColumnSelectionAllowed

void setColumnSelectionAllowed(boolean columnSelectionAllowed)
Sets whether the columns can be selected.

Parameters:
columnSelectionAllowed - true if it will allow column selection

getColumnSelectionAllowed

boolean getColumnSelectionAllowed()
Returns true if columns can be selected.

Returns:
true if columns can be selected, otherwise false
See Also:
setColumnSelectionAllowed(boolean)

setCellSelectionEnabled

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.

Parameters:
cellSelectionEnabled - true if simultaneous row and column selection is allowed
See Also:
getCellSelectionEnabled(), isCellSelected(int, int)

getCellSelectionEnabled

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

Returns:
true if both row and column selection models are enabled
See Also:
setCellSelectionEnabled(boolean)

getRowCount

int getRowCount()
Gets the total row count of TableScrollPane.

Returns:
the total row count of TableScrollPane.

getColumnCount

int getColumnCount()
Gets the total column count of TableScrollPane.

Returns:
the total column count of TableScrollPane.

getColumnName

String getColumnName(int column)
Returns the name of the column appearing in the view at column position column.

Parameters:
column - the column in the view being queried
Returns:
the name of the column at position column in the view where the first column is column 0

getColumnClass

Class<?> getColumnClass(int column)
Returns the type of the column appearing in the view at column position column.

Parameters:
column - the column in the view being queried
Returns:
the type of the column at position column in the view where the first column is column 0

getValueAt

Object getValueAt(int row,
                  int column)
Returns the cell value at row and column.

Note: The column is specified in the table view's display order, and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column 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

setValueAt

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

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

aValue is the new value.

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

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.

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

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(java.lang.Object, int, int)

getSelectedRow

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

Returns:
the index of the first selected row

getSelectedColumn

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

Returns:
the index of the first selected column

getSelectedRows

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

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

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

Returns:
an array of integers containing the indices of all selected columns, or an empty array if no column is selected
See Also:
getSelectedColumn()

getSelectedRowCount

int getSelectedRowCount()
Returns the number of selected rows.

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

getSelectedColumnCount

int getSelectedColumnCount()
Returns the number of selected columns.

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

isRowSelected

boolean isRowSelected(int row)
Returns true if the specified index is in the valid range of rows, and the row at that index is selected.

Parameters:
row - the row index
Returns:
true if row is a valid index and the row at that index is selected (where 0 is the first row)

isColumnSelected

boolean isColumnSelected(int column)
Returns true if the specified index is in the valid range of columns, and the column at that index is selected.

Parameters:
column - the column in the column model
Returns:
true if column is a valid index and the column at that index is selected (where 0 is the first column)

isCellSelected

boolean isCellSelected(int row,
                       int column)
Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.

Parameters:
row - the row being queried
column - the column being queried
Returns:
true if row and column are valid indices and the cell at index (row, column) is selected, where the first row and first column are at index 0

changeSelection

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. Most 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. Some UIs may need more functionality than this method provides, such as when manipulating the lead for discontiguous selection, and may not call into this method for some selection changes.

This implementation uses the following conventions:

Parameters:
rowIndex - affects the selection at row
columnIndex - affects the selection at column
toggle - see description above
extend - if true, extend the current selection

JIDE 3.5.15