|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
javax.swing
|
Nested Class Summary | |
---|---|
static class |
RowSorter.SortKey
SortKey describes the sort order for a particular column. |
Constructor Summary | |
---|---|
RowSorter()
Creates a RowSorter . |
Method Summary | |
---|---|
void |
addRowSorterListener(RowSorterListener l)
Adds a RowSorterListener to receive notification
about this RowSorter . |
abstract void |
allRowsChanged()
Invoked when the contents of the underlying model have completely changed. |
abstract int |
convertRowIndexToModel(int index)
Returns the location of index in terms of the
underlying model. |
abstract int |
convertRowIndexToView(int index)
Returns the location of index in terms of the
view. |
protected void |
fireRowSorterChanged(int[] lastRowIndexToModel)
Notifies listener that the mapping has changed. |
protected void |
fireSortOrderChanged()
Notifies listener that the sort order has changed. |
abstract M |
getModel()
Returns the underlying model. |
abstract int |
getModelRowCount()
Returns the number of rows in the underlying model. |
abstract List<? extends RowSorter.SortKey> |
getSortKeys()
Returns the current sort keys. |
abstract int |
getViewRowCount()
Returns the number of rows in the view. |
abstract void |
modelStructureChanged()
Invoked when the underlying model structure has completely changed. |
void |
removeRowSorterListener(RowSorterListener l)
Removes a RowSorterListener . |
abstract void |
rowsDeleted(int firstRow,
int endRow)
Invoked when rows have been deleted from the underlying model in the specified range (inclusive). |
abstract void |
rowsInserted(int firstRow,
int endRow)
Invoked when rows have been inserted into the underlying model in the specified range (inclusive). |
abstract void |
rowsUpdated(int firstRow,
int endRow)
Invoked when rows have been changed in the underlying model between the specified range (inclusive). |
abstract void |
rowsUpdated(int firstRow,
int endRow,
int column)
Invoked when the column in the rows have been updated in the underlying model between the specified range. |
abstract void |
setSortKeys(List<? extends RowSorter.SortKey> keys)
Sets the current sort keys. |
abstract void |
toggleSortOrder(int column)
Reverses the sort order of the specified column. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RowSorter()
RowSorter
.
Method Detail |
---|
public abstract M getModel()
public abstract void toggleSortOrder(int column)
If this results in changing the sort order and sorting, the
appropriate RowSorterListener
notification will be
sent.
column
- the column to toggle the sort ordering of, in
terms of the underlying model
IndexOutOfBoundsException
- if column is outside the range of
the underlying modelpublic abstract int convertRowIndexToModel(int index)
index
in terms of the
underlying model. That is, for the row index
in
the coordinates of the view this returns the row index in terms
of the underlying model.
index
- the row index in terms of the underlying view
IndexOutOfBoundsException
- if index
is outside the
range of the viewpublic abstract int convertRowIndexToView(int index)
index
in terms of the
view. That is, for the row index
in the
coordinates of the underlying model this returns the row index
in terms of the view.
index
- the row index in terms of the underlying model
IndexOutOfBoundsException
- if index
is outside
the range of the modelpublic abstract void setSortKeys(List<? extends RowSorter.SortKey> keys)
keys
- the new SortKeys
; null
is a shorthand for specifying an empty list,
indicating that the view should be unsortedpublic abstract List<? extends RowSorter.SortKey> getSortKeys()
non-null List
and may return an unmodifiable List
. If
you need to change the sort keys, make a copy of the returned
List
, mutate the copy and invoke setSortKeys
with the new list.
public abstract int getViewRowCount()
getModelRowCount()
public abstract int getModelRowCount()
getViewRowCount()
public abstract void modelStructureChanged()
TableModel
changed, this method would be invoked.
You normally do not call this method. This method is public to allow view classes to call it.
public abstract void allRowsChanged()
You normally do not call this method. This method is public to allow view classes to call it.
public abstract void rowsInserted(int firstRow, int endRow)
The arguments give the indices of the effected range. The first argument is in terms of the model before the change, and must be less than or equal to the size of the model before the change. The second argument is in terms of the model after the change and must be less than the size of the model after the change. For example, if you have a 5-row model and add 3 items to the end of the model the indices are 5, 7.
You normally do not call this method. This method is public to allow view classes to call it.
firstRow
- the first rowendRow
- the last row
IndexOutOfBoundsException
- if either argument is invalid, or
firstRow
> endRow
public abstract void rowsDeleted(int firstRow, int endRow)
The arguments give the indices of the effected range and are in terms of the model before the change. For example, if you have a 5-row model and delete 3 items from the end of the model the indices are 2, 4.
You normally do not call this method. This method is public to allow view classes to call it.
firstRow
- the first rowendRow
- the last row
IndexOutOfBoundsException
- if either argument is outside
the range of the model before the change, or
firstRow
> endRow
public abstract void rowsUpdated(int firstRow, int endRow)
You normally do not call this method. This method is public to allow view classes to call it.
firstRow
- the first row, in terms of the underlying modelendRow
- the last row, in terms of the underlying model
IndexOutOfBoundsException
- if either argument is outside
the range of the underlying model, or
firstRow
> endRow
public abstract void rowsUpdated(int firstRow, int endRow, int column)
You normally do not call this method. This method is public to allow view classes to call it.
firstRow
- the first row, in terms of the underlying modelendRow
- the last row, in terms of the underlying modelcolumn
- the column that has changed, in terms of the underlying
model
IndexOutOfBoundsException
- if either argument is outside
the range of the underlying model after the change,
firstRow
> endRow
, or
column
is outside the range of the underlying
modelpublic void addRowSorterListener(RowSorterListener l)
RowSorterListener
to receive notification
about this RowSorter
. If the same
listener is added more than once it will receive multiple
notifications. If l
is null
nothing
is done.
l
- the RowSorterListener
public void removeRowSorterListener(RowSorterListener l)
RowSorterListener
. If
l
is null
nothing is done.
l
- the RowSorterListener
protected void fireSortOrderChanged()
protected void fireRowSorterChanged(int[] lastRowIndexToModel)
lastRowIndexToModel
- the mapping from model indices to
view indices prior to the sort, may be null