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
Object
s and String
s. 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 int
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
Returns the number of rows in the model.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.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
ModelWrapper
protected ModelWrapper()Creates a newModelWrapper
.
-
-
Method Details
-
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
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 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
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:
-