public class IlpListModelFilter extends AbstractListModel implements ListModel
It encapsulates the ListModel
to be filtered,
as described in the decoration design pattern.
IlpListModelFilter
listens to the model it encapsulates and
forwards the model changes to its own listeners according to the filter criteria.
This model can be set between a "real" list model and its user to do some filtering, as described in the decoration design pattern.
listenerList
Constructor and Description |
---|
IlpListModelFilter()
Default constructor.
|
IlpListModelFilter(ListModel model)
Creates a model filter using the specified model.
|
Modifier and Type | Method and Description |
---|---|
Object |
getElementAt(int index)
Returns the value at the specified index.
|
IlpFilter |
getFilter()
Returns the filter used to filter the underlying model.
|
ListModel |
getModel()
Retrieves the underlying list model filtered by the model filter.
|
int |
getSize()
Returns the length of the list.
|
void |
refilter()
Reapplies the filter to the current objects.
|
void |
setFilter(IlpFilter filter)
Sets the filter to use to filter the underlying model.
|
void |
setModel(ListModel model)
Sets the underlying list model to be filtered.
|
String |
toString()
Converts the object into a human-readable format.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListDataListener, removeListDataListener
public IlpListModelFilter()
public IlpListModelFilter(ListModel model)
model
- The list model this filter uses. Cannot be null
.public ListModel getModel()
ListModel
encapsulated by the model filter.public void setModel(ListModel model)
model
- The list model to be filtered.public void setFilter(IlpFilter filter)
filter
- The filter. May be null
. In this case, the
underlying model is not filtered, that is, this model will provide all the
data from the underlying model.public IlpFilter getFilter()
null
.setFilter(IlpFilter)
public int getSize()
public Object getElementAt(int index)
getElementAt
in interface ListModel
IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getSize()).public void refilter()
This is a convenience method that allows you to reapply the current filter to objects when filter properties have changed. There is no need to have to to set a new filter instance.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.