- 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.ModelWrapperis responsible for providing the data that gets sorted byDefaultRowSorter. You normally do not interact directly withModelWrapper. Subclasses ofDefaultRowSorterprovide an implementation ofModelWrapperwrapping another model. For example,TableRowSorterprovides aModelWrapperthat wraps aTableModel.ModelWrappermakes a distinction between values asObjects andStrings. This allows implementations to provide a custom string converter to be used instead of invokingtoStringon the object.- Since:
- 1.6
- See Also:
RowFilter,RowFilter.Entry
-
-
Constructor Summary
Constructors Modifier Constructor and Description protectedDefaultRowSorter.ModelWrapper()Creates a newModelWrapper.
-
Method Summary
Methods Modifier and Type Method and Description abstract intgetColumnCount()Returns the number of columns in the model.abstract IgetIdentifier(int row)Returns the identifier for the specified row.abstract MgetModel()Returns the underlying model that thisModelis wrapping.abstract intgetRowCount()Returns the number of rows in the model.StringgetStringValueAt(int row, int column)Returns the value as aStringat the specified index.abstract ObjectgetValueAt(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 thisModelis 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 aStringat the specified index. This implementation usestoStringon 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.Entrythat 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()
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
18/10/2025 03:59:27 Cette version de la page est en cache (à la date du 18/10/2025 03:59:27) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 11/06/2005, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/defaultrowsorter.modelwrapper.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.