Class DefaultRowSorter.ModelWrapper<M,I>
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>
DefaultRowSorter.ModelWrapper is responsible for providing
the data that gets sorted by DefaultRowSorter. You
normally do not interact directly with ModelWrapper.
Subclasses of DefaultRowSorter provide an
implementation of ModelWrapper wrapping another model.
For example,
TableRowSorter provides a ModelWrapper that
wraps a TableModel.
ModelWrapper makes a distinction between values as
Objects and Strings. This allows
implementations to provide a custom string
converter to be used instead of invoking toString on the
object.
- Since:
- 1.6
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intReturns 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 intReturns the number of rows in the model.getStringValueAt(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.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
ModelWrapper
protected ModelWrapper()Creates a newModelWrapper.
-
-
Method Details
-
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
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
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
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:
-