ilog.cpl.list
Class IlpListModelFilter

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by ilog.cpl.list.IlpListModelFilter
All Implemented Interfaces:
Serializable, ListModel

public class IlpListModelFilter
extends AbstractListModel
implements ListModel

Filtering list model to be used as a decoration.

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.

Since:
JTGO 3.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
IlpListModelFilter()
          Default constructor.
IlpListModelFilter(ListModel model)
          Creates a model filter using the specified model.
 
Method Summary
 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()
           
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Constructor Detail

IlpListModelFilter

public IlpListModelFilter()
Default constructor.


IlpListModelFilter

public IlpListModelFilter(ListModel model)
Creates a model filter using the specified model. The model filter listens to this model.

Parameters:
model - The list model this filter uses. Cannot be null.
Method Detail

getModel

public ListModel getModel()
Retrieves the underlying list model filtered by the model filter.

Returns:
The ListModel encapsulated by the model filter.

setModel

public void setModel(ListModel model)
Sets the underlying list model to be filtered.

Parameters:
model - The list model to be filtered.

setFilter

public void setFilter(IlpFilter filter)
Sets the filter to use to filter the underlying model.

Parameters:
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.

getFilter

public IlpFilter getFilter()
Returns the filter used to filter the underlying model.

Returns:
The filter. May be null.
See Also:
setFilter(IlpFilter)

getSize

public int getSize()
Returns the length of the list.

Specified by:
getSize in interface ListModel

getElementAt

public Object getElementAt(int index)
Returns the value at the specified index.

Specified by:
getElementAt in interface ListModel
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > getSize()).

refilter

public void refilter()
Reapplies the filter to the current objects.

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.

Since:
JTGO 4.0

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.