Package com.luciad.lucy.util
Class TLcyModelObjectFilter
java.lang.Object
com.luciad.lucy.util.TLcyModelObjectFilter
- All Implemented Interfaces:
ILcdChangeSource
,ILcdDynamicFilter
,ILcdFilter
,Serializable
,Predicate
An implementation of ILcdFilter that is able to filter out specific objects of an
ILcdIntegerIndexed
. The set of accepted objects can be changed using changeFilter(Object, boolean)
or changeFilterAllObjects(boolean)
.
This filter is used by default by the table view. Setting such a filter on your layer will allow the TableView to directly adjust your filter.
- Since:
- 11.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Tests if a given object passes the filter or not.void
addChangeListener
(ILcdChangeListener aChangeListener) Adds the given ILcdChangeListener.void
changeFilter
(Object aObject, boolean aAccept) Sets whether or not an object should be accepted (e.g., visible) by this ILcdFilter.void
changeFilter
(List<Object> aObjectList, boolean aAccept) Sets whether or not an object/multiple objects should be accepted (e.g., visible) by this ILcdFiltervoid
changeFilterAllObjects
(boolean aAccept) Changes the accepted state (e.g., the visibility) of all the objects in the ILcdModel.protected void
fireChangeEvent
(TLcdChangeEvent aEvent) Fires the given TLcdChangeEvent to all listeners.getModel()
Returns the associated ILcdIntegerIndexedModel for which this ILcdFilter works.int
Returns the number of domain objects that are accepted by this filter.void
removeChangeListener
(ILcdChangeListener aChangeListener) Removes the given ILcdChangeListenervoid
setModel
(ILcdIntegerIndexedModel aModel) Sets the ILcdIntegerIndexedModel for which this ILcdFilter works.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdFilter
test
-
Constructor Details
-
TLcyModelObjectFilter
Create a new filter- Parameters:
aModel
- The model ofaLayer
. Must be anILcdIntegerIndexedModel
-
-
Method Details
-
addChangeListener
Adds the given ILcdChangeListener. This listener is informed whenever this ILcdFilter has changed. That is, when the accept method returns a different value for at least one of the objects of the associated ILcdIntegerIndexedModel.- Specified by:
addChangeListener
in interfaceILcdChangeSource
- Parameters:
aChangeListener
- The listener to add.- See Also:
-
removeChangeListener
Removes the given ILcdChangeListener- Specified by:
removeChangeListener
in interfaceILcdChangeSource
- Parameters:
aChangeListener
- The listener to remove.
-
fireChangeEvent
Fires the given TLcdChangeEvent to all listeners.- Parameters:
aEvent
- The event to fire.
-
getModel
Returns the associated ILcdIntegerIndexedModel for which this ILcdFilter works.- Returns:
- the associated ILcdIntegerIndexedModel for which this ILcdFilter works.
-
setModel
Sets the ILcdIntegerIndexedModel for which this ILcdFilter works.- Parameters:
aModel
- The model for which this filter will work.
-
changeFilter
Sets whether or not an object should be accepted (e.g., visible) by this ILcdFilter.- Parameters:
aObject
- The object of which to change the accepted state, must be an element of the associated ILcdIntegerIndexedModel.aAccept
- true if the object should be accepted, false otherwise.- See Also:
-
changeFilter
Sets whether or not an object/multiple objects should be accepted (e.g., visible) by this ILcdFilter- Parameters:
aObjectList
- AList
of objects of which to change the accepted state. EveryObject
in the list must be an element of the associatedILcdIntegerIndexedModel
.aAccept
-true
if each of theObject
s inaObjectList
must be accepted,false
otherwise- See Also:
-
changeFilterAllObjects
public void changeFilterAllObjects(boolean aAccept) Changes the accepted state (e.g., the visibility) of all the objects in the ILcdModel.- Parameters:
aAccept
- true if all model objects should be accepted, false otherwise.
-
accept
Description copied from interface:ILcdFilter
Tests if a given object passes the filter or not. The actual test condition is specified by the implementation of this interface.- Specified by:
accept
in interfaceILcdFilter
- Parameters:
aObject
- the object to be tested by the filter.- Returns:
true
if the object passes the filter,false
otherwise.
-
getNumberOfAcceptedObjects
public int getNumberOfAcceptedObjects()Returns the number of domain objects that are accepted by this filter.- Returns:
- The number of accepted domain objects. Is always between
0
andgetModel().size()
.
-