DefaultRowSorter.ModelWrapper (Java Platform SE 6) (original) (raw)
javax.swing
Class DefaultRowSorter.ModelWrapper<M,I>
java.lang.Object
javax.swing.DefaultRowSorter.ModelWrapper<M,I>
Type Parameters:
M
- the type of the underlying model
I
- the identifier supplied to the filter
Enclosing class:
protected abstract static class DefaultRowSorter.ModelWrapper<M,I>
extends Object
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 asObject
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 | |
---|---|
protected | DefaultRowSorter.ModelWrapper() Creates a new ModelWrapper. |
Method Summary | |
---|---|
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 this Model is wrapping. |
abstract int | getRowCount() Returns the number of rows in the model. |
String | [getStringValueAt](../../javax/swing/DefaultRowSorter.ModelWrapper.html#getStringValueAt%28int, int%29)(int row, int column) Returns the value as a String at the specified index. |
abstract Object | [getValueAt](../../javax/swing/DefaultRowSorter.ModelWrapper.html#getValueAt%28int, int%29)(int row, int column) Returns the value at the specified index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, [wait](../../java/lang/Object.html#wait%28long, int%29) |
Constructor Detail |
---|
DefaultRowSorter.ModelWrapper
protected DefaultRowSorter.ModelWrapper()
Creates a new ModelWrapper
.
Method Detail |
---|
getModel
public abstract M getModel()
Returns the underlying model that this Model
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 index
column
- the column index
Returns:
the value at the specified index
Throws:
[IndexOutOfBoundsException](../../java/lang/IndexOutOfBoundsException.html "class in java.lang")
- if the indices are outside the range of the model
getStringValueAt
public String getStringValueAt(int row, int column)
Returns the value as a String
at the specified index. This implementation uses toString
on the result from getValueAt
(making sure to return an empty string for null values). Subclasses that override this method should never return null.
Parameters:
row
- the row index
column
- the column index
Returns:
the value at the specified index as a String
Throws:
[IndexOutOfBoundsException](../../java/lang/IndexOutOfBoundsException.html "class in java.lang")
- 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()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
Scripting on this page tracks web page traffic, but does not change the content in any way.