|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 |
---|
void setRowSelectionAllowed(boolean rowSelectionAllowed)
rowSelectionAllowed
- true if it will allow row selectionboolean getRowSelectionAllowed()
setRowSelectionAllowed(boolean)
void setColumnSelectionAllowed(boolean columnSelectionAllowed)
columnSelectionAllowed
- true if it will allow column selectionboolean getColumnSelectionAllowed()
setColumnSelectionAllowed(boolean)
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.
cellSelectionEnabled
- true if simultaneous row and column selection is allowedgetCellSelectionEnabled()
,
isCellSelected(int, int)
boolean getCellSelectionEnabled()
getRowSelectionAllowed() &&
getColumnSelectionAllowed()
.
setCellSelectionEnabled(boolean)
int getRowCount()
int getColumnCount()
String getColumnName(int column)
column
.
column
- the column in the view being queried
column
in the view where the first column is column 0Class<?> getColumnClass(int column)
column
.
column
- the column in the view being queried
column
in the view where the first column is column 0Object getValueAt(int row, int column)
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.
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
void setValueAt(Object aValue, int row, int column)
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.
aValue
- the new valuerow
- the row of the cell to be changedcolumn
- the column of the cell to be changedgetValueAt(int, int)
boolean isCellEditable(int row, int column)
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.
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
setValueAt(java.lang.Object, int, int)
int getSelectedRow()
int getSelectedColumn()
int[] getSelectedRows()
getSelectedRow()
int[] getSelectedColumns()
getSelectedColumn()
int getSelectedRowCount()
int getSelectedColumnCount()
boolean isRowSelected(int row)
row
- the row index
row
is a valid index and the row at that index is selected (where 0 is the first
row)boolean isColumnSelected(int column)
column
- the column in the column model
column
is a valid index and the column at that index is selected (where 0 is the
first column)boolean isCellSelected(int row, int column)
row
- the row being queriedcolumn
- the column being queried
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 0void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
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: toggle
: false,
extend
: false. Clear the previous selection and ensure the new cell is selected. toggle
: false, extend
: true. Extend the previous selection from the
anchor to the specified cell, clearing all other selections. toggle
: true,
extend
: false. If the specified cell is selected, deselect it. If it is not selected,
select it. toggle
: true, extend
: true. Apply the selection state
of the anchor to all cells between it and the specified cell.
rowIndex
- affects the selection at row
columnIndex
- affects the selection at column
toggle
- see description aboveextend
- if true, extend the current selection
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |