|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.grid.DefaultTableSelectionModel
public class DefaultTableSelectionModel
TableSelectionModel
is a table selection model that can support non-contiguous selection. It is used by
JideTable when JideTable.setNonContiguousCellSelection(boolean)
is set to true.
Field Summary | |
---|---|
protected int |
_anchorColumnIndex
|
protected int |
_anchorRowIndex
|
protected boolean |
_isValueAdjusting
|
protected int |
_leadColumnIndex
|
protected int |
_leadRowIndex
|
protected Vector<ListSelectionModel> |
_listSelectionModels
contains a ListSelectionModel for each column |
protected int |
_maxColumnIndex
|
protected int |
_maxRowIndex
|
protected int |
_minColumnIndex
|
protected int |
_minRowIndex
|
protected boolean |
_withinOneSelection
|
protected EventListenerList |
listenerList
List of Listeners which will be notified when the selection value changes |
Constructor Summary | |
---|---|
DefaultTableSelectionModel()
|
Method Summary | |
---|---|
protected void |
addColumn()
Adds a column to the end of the model. |
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 |
columnAdded(TableColumnModelEvent e)
The event listener to handle the column added event |
void |
columnMarginChanged(ChangeEvent e)
The event listener to handle the column margin changed event. |
void |
columnMoved(int fromColumnIndex,
int toColumnIndex)
Notifies the selection model that a column is added to TableColumnModel. |
void |
columnMoved(TableColumnModelEvent e)
The event listener to handle the column moved event. |
void |
columnRemoved(int columnIndex)
Notifies the selection model that a column is removed from TableColumnModel. |
void |
columnRemoved(TableColumnModelEvent e)
The event listener to handle the column removed event. |
void |
columnSelectionChanged(ListSelectionEvent e)
The event listener to handle the column selection changed event. |
protected void |
fireValueChanged()
|
protected void |
fireValueChanged(boolean isAdjusting)
Notifies listeners that we have ended a series of adjustments. |
protected void |
fireValueChanged(Object source,
int firstIndex,
int lastIndex,
int columnIndex,
boolean isAdjusting)
Notify listeners that we have ended a series of adjustments. |
protected void |
fireValueChanged(Object source,
int firstIndex,
int lastIndex,
int firstColumnIndex,
int lastColumnIndex,
boolean isAdjusting)
Notify listeners that we have ended a series of adjustments. |
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. |
ListSelectionModel |
getListSelectionModelAt(int columnIndex)
Returns the ListSelectionModel at the specified column. |
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. |
protected void |
insertColumn(int index)
Inserts a column at the specified index of the model. |
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 |
markAsDirty(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
|
void |
moveLeadSelection(int row,
int column)
Moves the lead selection at the cell specified by row and column and leaving all selection values unchanged. |
void |
propertyChange(PropertyChangeEvent evt)
When the TableModel changes, the TableSelectionModel has to adapt to the new Model. |
protected void |
removeColumn()
Removes last column from model. |
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. |
void |
tableChanged(TableModelEvent e)
Is called when the TableModel changes. |
String |
toString()
|
void |
valueChanged(ListSelectionEvent e)
Is called when the selection of a ListSelectionModel of a column has changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected EventListenerList listenerList
protected Vector<ListSelectionModel> _listSelectionModels
protected boolean _withinOneSelection
protected int _anchorRowIndex
protected int _anchorColumnIndex
protected int _leadRowIndex
protected int _leadColumnIndex
protected int _minRowIndex
protected int _minColumnIndex
protected int _maxRowIndex
protected int _maxColumnIndex
protected boolean _isValueAdjusting
Constructor Detail |
---|
public DefaultTableSelectionModel()
Method Detail |
---|
public boolean isValueAdjusting()
TableSelectionModel
isValueAdjusting
in interface TableSelectionModel
public void setValueAdjusting(boolean valueAdjusting)
TableSelectionModel
setValueAdjusting
in interface TableSelectionModel
valueAdjusting
- true or false.public void markAsDirty(int firstRow, int lastRow, int firstColumn, int lastColumn)
public void addSelection(int row, int column)
addSelection
in interface TableSelectionModel
row
- the row indexcolumn
- the column indexpublic void removeSelection(int row, int column)
removeSelection
in interface TableSelectionModel
row
- the row indexcolumn
- the column indexpublic void setSelection(int row, int column)
setSelection
in interface TableSelectionModel
row
- the row indexcolumn
- the column indexpublic void setSelectionInterval(int row1, int row2, int column)
setSelectionInterval
in interface TableSelectionModel
row1
- the start row indexrow2
- the end row indexcolumn
- the column indexpublic void setAnchorSelection(int row, int column)
setAnchorSelection
in interface TableSelectionModel
row
- the row indexcolumn
- the column indexpublic void setLeadSelection(int row, int column)
setLeadSelection
in interface TableSelectionModel
row
- the new lead selection row indexcolumn
- the new lead selection column indexpublic void moveLeadSelection(int row, int column)
moveLeadSelection
in interface TableSelectionModel
row
- the new lead selection row indexcolumn
- the new lead selection column indexpublic void clearSelection()
clearSelection
in interface TableSelectionModel
public void selectAll(int rowCount, int columnCount)
selectAll
in interface TableSelectionModel
rowCount
- the row countcolumnCount
- the column countpublic boolean isSelected(int row, int column)
isSelected
in interface TableSelectionModel
row
- the row indexcolumn
- the column index
public ListSelectionModel getListSelectionModelAt(int columnIndex)
columnIndex
- the column
public void setColumns(int count)
setColumns
in interface TableSelectionModel
count
- the number of columnsprotected void addColumn()
protected void insertColumn(int index)
index
- the column index.protected void removeColumn()
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public void addTableSelectionListener(TableSelectionListener l)
addTableSelectionListener
in interface TableSelectionModel
l
- the listenerpublic void removeTableSelectionListener(TableSelectionListener l)
removeTableSelectionListener
in interface TableSelectionModel
l
- the listenerpublic void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
protected void fireValueChanged(boolean isAdjusting)
isAdjusting
- true or false.protected void fireValueChanged(Object source, int firstIndex, int lastIndex, int columnIndex, boolean isAdjusting)
source
- the source to fire the eventfirstIndex
- the first row indexlastIndex
- the last row indexcolumnIndex
- the column indexisAdjusting
- the flag indicating if the selection is adjustingprotected void fireValueChanged()
protected void fireValueChanged(Object source, int firstIndex, int lastIndex, int firstColumnIndex, int lastColumnIndex, boolean isAdjusting)
source
- the source to fire the eventfirstIndex
- the first row indexlastIndex
- the last row indexfirstColumnIndex
- the first column indexlastColumnIndex
- the last column indexisAdjusting
- the flag indicating if the selection is adjustingpublic String toString()
toString
in class Object
public int getAnchorRowIndex()
getAnchorRowIndex
in interface TableSelectionModel
public int getAnchorColumnIndex()
getAnchorColumnIndex
in interface TableSelectionModel
public int getLeadRowIndex()
getLeadRowIndex
in interface TableSelectionModel
public int getLeadColumnIndex()
getLeadColumnIndex
in interface TableSelectionModel
public boolean isSelectionEmpty()
isSelectionEmpty
in interface TableSelectionModel
public int[] getSelectedColumns()
TableSelectionModel
getSelectedColumns
in interface TableSelectionModel
public int getSelectedColumnCount()
TableSelectionModel
getSelectedColumnCount
in interface TableSelectionModel
public int[] getSelectedRows()
TableSelectionModel
getSelectedRows
in interface TableSelectionModel
public int getSelectedRowCount()
TableSelectionModel
getSelectedRowCount
in interface TableSelectionModel
public boolean isRowSelected(int rowIndex)
TableSelectionModel
isRowSelected
in interface TableSelectionModel
rowIndex
- the row index
public boolean isColumnSelected(int columnIndex)
TableSelectionModel
isColumnSelected
in interface TableSelectionModel
columnIndex
- the column index
public int getMinSelectedRowIndex()
TableSelectionModel
getMinSelectedRowIndex
in interface TableSelectionModel
public int getMaxSelectedRowIndex()
TableSelectionModel
getMaxSelectedRowIndex
in interface TableSelectionModel
public int getMinSelectedColumnIndex()
TableSelectionModel
getMinSelectedColumnIndex
in interface TableSelectionModel
public int getMaxSelectedColumnIndex()
TableSelectionModel
getMaxSelectedColumnIndex
in interface TableSelectionModel
public void columnAdded(int columnIndex)
TableSelectionModel
columnAdded
in interface TableSelectionModel
columnIndex
- the added column index.public void columnRemoved(int columnIndex)
TableSelectionModel
columnRemoved
in interface TableSelectionModel
columnIndex
- the removed column index.public void columnMoved(int fromColumnIndex, int toColumnIndex)
TableSelectionModel
columnMoved
in interface TableSelectionModel
fromColumnIndex
- the column index which is moved.toColumnIndex
- the column index where the column is moved.public void columnAdded(TableColumnModelEvent e)
columnAdded
in interface TableColumnModelListener
e
- the eventpublic void columnRemoved(TableColumnModelEvent e)
columnRemoved
in interface TableColumnModelListener
e
- the eventpublic void columnMoved(TableColumnModelEvent e)
columnMoved
in interface TableColumnModelListener
e
- the eventpublic void columnMarginChanged(ChangeEvent e)
columnMarginChanged
in interface TableColumnModelListener
e
- the eventpublic void columnSelectionChanged(ListSelectionEvent e)
columnSelectionChanged
in interface TableColumnModelListener
e
- the event
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |