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

Class ISimpleFilterable

source code

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

Interface that is implemented by containers which allow reducing their visible contents based on a set of filters. This interface has been renamed from IFilterable, and implementing the new IFilterable instead of or in addition to ISimpleFilterable is recommended. This interface might be removed in future Muntjac versions.

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 contents and the filtered indices to the container.

How filtering is performed when a IHierarchical container implements ISimpleFilterable 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. The unfiltered position of items added at index 0, at index IContainer.size or at an undefined position is up to the implementation.

The functionality of ISimpleFilterable can be implemented using the IFilterable API and SimpleStringFilter.

Instance Methods [hide private]
 
addContainerFilter(self, propertyId, filterString, ignoreCase, onlyMatchPrefix)
Add a filter for given property.
source code
 
removeAllContainerFilters(self)
Remove all filters from all properties.
source code
 
removeContainerFilters(self, propertyId)
Remove all filters from the given property.
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, propertyId, filterString, ignoreCase, onlyMatchPrefix)

source code 

Add a filter for given property.

The API IFilterable.addContainerFilter is recommended instead of this method. A SimpleStringFilter can be used with the new API to implement the old string filtering functionality.

The filter accepts items for which __str__ of the value of the given property contains or starts with given filterString. Other items are not visible in the container when filtered.

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

Parameters:
  • propertyId - Property for which the filter is applied to.
  • filterString - String that must match the value of the property
  • ignoreCase - Determine if the casing can be ignored when comparing strings.
  • onlyMatchPrefix - Only match prefixes; no other matches are included.

removeContainerFilters(self, propertyId)

source code 

Remove all filters from the given property.

Parameters:
  • propertyId - for which to remove filters