Package muntjac :: Package data :: Module container :: Class IFilterable
[hide private]
[frames] | no frames]

Class IFilterable

source code

object --+    
         |    
IContainer --+
             |
            IFilterable
Known Subclasses:

Interface that is implemented by containers which allow reducing their visible contents based on a set of filters.

When a set of filters are set, only items that match all the filters are included in the visible contents of the container. Still new items that do not match filters can be added to the container. Multiple filters can be added and the container remembers the state of the filters. When multiple filters are added, all filters must match for an item to be visible in the container.

When an IOrdered or IIndexed container is filtered, all operations of these interfaces should only use the filtered and sorted contents and the filtered indices to the container. Indices or item identifiers in the public API refer to the visible view unless otherwise stated. However, the addItem*() methods may add items that will be filtered out after addition or moved to another position based on sorting.

How filtering is performed when a IHierarchical container implements IFilterable is implementation specific and should be documented in the implementing class.

Adding items (if supported) to a filtered IOrdered or IIndexed container should insert them immediately after the indicated visible item. However, the unfiltered position of items added at index 0, at index IContainer.size or at an undefined position is up to the implementation.

Instance Methods [hide private]
 
addContainerFilter(self, fltr)
Adds a filter for the container.
source code
 
removeContainerFilter(self, fltr)
Removes a filter from the container.
source code
 
removeAllContainerFilters(self)
Remove all active filters from the container.
source code

Inherited from IContainer: addContainerProperty, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, removeItem, size

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

addContainerFilter(self, fltr)

source code 

Adds a filter for the container.

If a container has multiple filters, only items accepted by all filters are visible.

Raises:

removeContainerFilter(self, fltr)

source code 

Removes a filter from the container.

This requires that the __eq__ method considers the filters as equivalent (same instance or properly implemented __eq__ method).