- java.lang.Object
-
- javax.swing.DefaultRowSorter.ModelWrapper<M,I>
-
- Type Parameters:
M
- the type of the underlying modelI
- the identifier supplied to the filter
- Enclosing class:
- DefaultRowSorter<M,I>
protected abstract static class DefaultRowSorter.ModelWrapper<M,I> extends Object
DefaultRowSorter.ModelWrapper
is responsible for providing the data that gets sorted byDefaultRowSorter
. You normally do not interact directly withModelWrapper
. Subclasses ofDefaultRowSorter
provide an implementation ofModelWrapper
wrapping another model. For example,TableRowSorter
provides aModelWrapper
that wraps aTableModel
.ModelWrapper
makes a distinction between values asObject
s andString
s. This allows implementations to provide a custom string converter to be used instead of invokingtoString
on the object.- Since:
- 1.6
- See Also:
RowFilter
,RowFilter.Entry
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
DefaultRowSorter.ModelWrapper()
Creates a newModelWrapper
.
-
Method Summary
Methods Modifier and Type Method and Description abstract int
getColumnCount()
Returns the number of columns in the model.abstract I
getIdentifier(int row)
Returns the identifier for the specified row.abstract M
getModel()
Returns the underlying model that thisModel
is wrapping.abstract int
getRowCount()
Returns the number of rows in the model.String
getStringValueAt(int row, int column)
Returns the value as aString
at the specified index.abstract Object
getValueAt(int row, int column)
Returns the value at the specified index.
-
-
-
Constructor Detail
-
DefaultRowSorter.ModelWrapper
protected DefaultRowSorter.ModelWrapper()
Creates a newModelWrapper
.
-
-
Method Detail
-
getModel
public abstract M getModel()
Returns the underlying model that thisModel
is wrapping.- Returns:
- the underlying model
-
getColumnCount
public abstract int getColumnCount()
Returns the number of columns in the model.- Returns:
- the number of columns in the model
-
getRowCount
public abstract int getRowCount()
Returns the number of rows in the model.- Returns:
- the number of rows in the model
-
getValueAt
public abstract Object getValueAt(int row, int column)
Returns the value at the specified index.- Parameters:
row
- the row indexcolumn
- the column index- Returns:
- the value at the specified index
- Throws:
IndexOutOfBoundsException
- if the indices are outside the range of the model
-
getStringValueAt
public String getStringValueAt(int row, int column)
Returns the value as aString
at the specified index. This implementation usestoString
on the result fromgetValueAt
(making sure to return an empty string for null values). Subclasses that override this method should never return null.- Parameters:
row
- the row indexcolumn
- the column index- Returns:
- the value at the specified index as a
String
- Throws:
IndexOutOfBoundsException
- if the indices are outside the range of the model
-
getIdentifier
public abstract I getIdentifier(int row)
Returns the identifier for the specified row. The return value of this is used as the identifier for theRowFilter.Entry
that is passed to theRowFilter
.- Parameters:
row
- the row to return the identifier for, in terms of the underlying model- Returns:
- the identifier
- See Also:
RowFilter.Entry.getIdentifier()
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/DefaultRowSorter.ModelWrapper.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.