JIDE 3.5.15

com.jidesoft.grid
Interface TableSelectionModel

All Superinterfaces:
EventListener, PropertyChangeListener, Serializable, TableColumnModelListener, TableModelListener
All Known Implementing Classes:
DefaultTableSelectionModel

public interface TableSelectionModel
extends PropertyChangeListener, TableModelListener, TableColumnModelListener, Serializable

This is a selection model that can represents non-contiguous cell selection in JideTable when setNonConfiguous is set to true.


Method Summary
 void addSelection(int row, int column)
          Adds the cell specified by row and column to the selection.
 void addTableSelectionListener(TableSelectionListener l)
          Add a listener to the list that's notified each time a change to the selection occurs.
 void clearSelection()
          Clears all the selections.
 void columnAdded(int columnIndex)
          Notifies the selection model that a column is added to TableColumnModel.
 void columnMoved(int fromColumnIndex, int toColumnIndex)
          Notifies the selection model that a column is added to TableColumnModel.
 void columnRemoved(int columnIndex)
          Notifies the selection model that a column is removed from TableColumnModel.
 int getAnchorColumnIndex()
          Gets the anchor column index.
 int getAnchorRowIndex()
          Gets the anchor row index.
 int getLeadColumnIndex()
          Gets the lead column index.
 int getLeadRowIndex()
          Gets the lead row index.
 int getMaxSelectedColumnIndex()
          Returns the last selected column index or -1 if the selection is empty.
 int getMaxSelectedRowIndex()
          Returns the last selected row index or -1 if the selection is empty.
 int getMinSelectedColumnIndex()
          Returns the first selected column index or -1 if the selection is empty.
 int getMinSelectedRowIndex()
          Returns the first selected row index or -1 if the selection is empty.
 int getSelectedColumnCount()
          Returns the number of selected columns.
 int[] getSelectedColumns()
          Returns an array of indices of all selected columns.
 int getSelectedRowCount()
          Returns the number of selected rows.
 int[] getSelectedRows()
          Returns an array of indices of all selected rows.
 boolean isColumnSelected(int columnIndex)
          Checks if the column at column index has any selected cells.
 boolean isRowSelected(int rowIndex)
          Checks if the row at row index has any selected cells.
 boolean isSelected(int row, int column)
          Checks if the specified cell is selected.
 boolean isSelectionEmpty()
          Checks if there is any selection in the selection model.
 boolean isValueAdjusting()
          Checks if the value is adjusting.
 void moveLeadSelection(int row, int column)
          Sets the lead selection at the cell specified by row and column.
 void removeSelection(int row, int column)
          Removes the cell specified by row and column from the selection.
 void removeTableSelectionListener(TableSelectionListener l)
          Remove a listener from the list that's notified each time a change to the selection occurs.
 void selectAll(int rowCount, int columnCount)
          Selects all the cells.
 void setAnchorSelection(int row, int column)
          Sets the anchor selection at the cell specified by row and column.
 void setColumns(int count)
          Set the number of columns.
 void setLeadSelection(int row, int column)
          Sets the lead selection at the cell specified by row and column.
 void setSelection(int row, int column)
          Adds the cell specified by row and column to the selection.
 void setSelectionInterval(int row1, int row2, int column)
          Adds the cells of the specified column between row1 and row2 to the selection.
 void setValueAdjusting(boolean valueAdjusting)
          Sets the value adjusting flag.
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface javax.swing.event.TableModelListener
tableChanged
 
Methods inherited from interface javax.swing.event.TableColumnModelListener
columnAdded, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged
 

Method Detail

addSelection

void addSelection(int row,
                  int column)
Adds the cell specified by row and column to the selection.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row - the row index
column - the column index

removeSelection

void removeSelection(int row,
                     int column)
Removes the cell specified by row and column from the selection.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row - the row index
column - the column index

setSelection

void setSelection(int row,
                  int column)
Adds the cell specified by row and column to the selection. It will clear out other selections in the same column.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row - the row index
column - the column index

setSelectionInterval

void setSelectionInterval(int row1,
                          int row2,
                          int column)
Adds the cells of the specified column between row1 and row2 to the selection. It will clear out other selections in the same column.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row1 - the start row index
row2 - the end row index
column - the column index

setAnchorSelection

void setAnchorSelection(int row,
                        int column)
Sets the anchor selection at the cell specified by row and column. This call will clear out the lead selection.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row - the row index
column - the column index

setLeadSelection

void setLeadSelection(int row,
                      int column)
Sets the lead selection at the cell specified by row and column. All cells in the range of anchor cell and lead cell will be selected after this call.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row - the new lead selection row index
column - the new lead selection column index

moveLeadSelection

void moveLeadSelection(int row,
                       int column)
Sets the lead selection at the cell specified by row and column. All cells in the range of anchor cell and lead cell will be selected after this call.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
row - the new lead selection row index
column - the new lead selection column index

clearSelection

void clearSelection()
Clears all the selections.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.


isSelected

boolean isSelected(int row,
                   int column)
Checks if the specified cell is selected.

Parameters:
row - the row index
column - the column index
Returns:
true if the specified cell is selected. Otherwise false.

getAnchorRowIndex

int getAnchorRowIndex()
Gets the anchor row index.

Returns:
the anchor row index.

getAnchorColumnIndex

int getAnchorColumnIndex()
Gets the anchor column index.

Returns:
the anchor column index.

getLeadRowIndex

int getLeadRowIndex()
Gets the lead row index.

Returns:
the lead row index.

getLeadColumnIndex

int getLeadColumnIndex()
Gets the lead column index.

Returns:
the lead column index.

addTableSelectionListener

void addTableSelectionListener(TableSelectionListener l)
Add a listener to the list that's notified each time a change to the selection occurs.

Parameters:
l - the listener

removeTableSelectionListener

void removeTableSelectionListener(TableSelectionListener l)
Remove a listener from the list that's notified each time a change to the selection occurs.

Parameters:
l - the listener

selectAll

void selectAll(int rowCount,
               int columnCount)
Selects all the cells.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
rowCount - the row count
columnCount - the column count

getSelectedColumns

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

Returns:
an array of integers containing the indices of all selected columns; or an empty array if nothing is selected

getSelectedColumnCount

int getSelectedColumnCount()
Returns the number of selected columns.

Returns:
the number of selected columns; or 0 if no columns are selected

getSelectedRows

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

Returns:
an array of integers containing the indices of all selected rows; or an empty array if nothing is selected

getSelectedRowCount

int getSelectedRowCount()
Returns the number of selected rows.

Returns:
the number of selected rows; or 0 if no rows are selected

isRowSelected

boolean isRowSelected(int rowIndex)
Checks if the row at row index has any selected cells.

Parameters:
rowIndex - the row index
Returns:
true if the row at row index has any selected cells.

isColumnSelected

boolean isColumnSelected(int columnIndex)
Checks if the column at column index has any selected cells.

Parameters:
columnIndex - the column index
Returns:
true if the column at column index has any selected cells.

getMinSelectedRowIndex

int getMinSelectedRowIndex()
Returns the first selected row index or -1 if the selection is empty.

Returns:
the first selected row index or -1 if the selection is empty.

getMaxSelectedRowIndex

int getMaxSelectedRowIndex()
Returns the last selected row index or -1 if the selection is empty.

Returns:
the last selected row index or -1 if the selection is empty.

getMinSelectedColumnIndex

int getMinSelectedColumnIndex()
Returns the first selected column index or -1 if the selection is empty.

Returns:
the first selected column index or -1 if the selection is empty.

getMaxSelectedColumnIndex

int getMaxSelectedColumnIndex()
Returns the last selected column index or -1 if the selection is empty.

Returns:
the last selected column index or -1 if the selection is empty.

setColumns

void setColumns(int count)
Set the number of columns.

Parameters:
count - the number of columns

isValueAdjusting

boolean isValueAdjusting()
Checks if the value is adjusting. If so, no event will be fired till this flag is set to false.

Returns:
true or false.

setValueAdjusting

void setValueAdjusting(boolean valueAdjusting)
Sets the value adjusting flag. If true, no event will be fired till this flag is set to false.

This method has to be sync with JTable#getSelectionModel() and JTable#getColumnModel()#getSelectionModel() if you choose to invoke this method directly.

Parameters:
valueAdjusting - true or false.

isSelectionEmpty

boolean isSelectionEmpty()
Checks if there is any selection in the selection model.

Returns:
true if there is no selection. Otherwise false.

columnAdded

void columnAdded(int columnIndex)
Notifies the selection model that a column is added to TableColumnModel.

Parameters:
columnIndex - the added column index.

columnRemoved

void columnRemoved(int columnIndex)
Notifies the selection model that a column is removed from TableColumnModel.

Parameters:
columnIndex - the removed column index.

columnMoved

void columnMoved(int fromColumnIndex,
                 int toColumnIndex)
Notifies the selection model that a column is added to TableColumnModel.

Parameters:
fromColumnIndex - the column index which is moved.
toColumnIndex - the column index where the column is moved.

JIDE 3.5.15