org.apache.wicket.util.iterator
Class AbstractHierarchyIteratorWithFilter<N,I extends N>

java.lang.Object
  extended by org.apache.wicket.util.iterator.AbstractHierarchyIterator<N,I>
      extended by org.apache.wicket.util.iterator.AbstractHierarchyIteratorWithFilter<N,I>
Type Parameters:
N -
I -
All Implemented Interfaces:
java.lang.Iterable<I>, java.util.Iterator<I>
Direct Known Subclasses:
ComponentHierarchyIterator, GenericComponentHierarchyIterator

public abstract class AbstractHierarchyIteratorWithFilter<N,I extends N>
extends AbstractHierarchyIterator<N,I>

Extend AbstractHierarchyIterator and add support for filters.

Author:
Juergen Donnerstag

Constructor Summary
AbstractHierarchyIteratorWithFilter(N root)
          Construct.
 
Method Summary
 AbstractHierarchyIteratorWithFilter<N,I> addFilter(IteratorFilter<N> filter)
          Add a filter (fluent API)
 AbstractHierarchyIteratorWithFilter<N,I> addTraverseFilters(IteratorFilter<N> filter)
          Add a filter to the traversal filter list (fluent API).
 java.util.List<IteratorFilter<N>> getFilters()
           
 I getFirst(boolean throwException)
           
 java.util.List<IteratorFilter<N>> getTraverseFilters()
           
protected  boolean onFilter(N node)
          Apply all registered filters
protected  boolean onTraversalFilter(N node)
          Apply all registered traversal filters
 java.util.Collection<IteratorFilter<N>> replaceFilterSet(java.util.Collection<IteratorFilter<N>> filters)
          Replace the current set of filters.
 java.util.List<I> toList()
           
 
Methods inherited from class org.apache.wicket.util.iterator.AbstractHierarchyIterator
dontGoDeeper, hasChildren, hasNext, iterator, newIterator, next, remove, setChildFirst, skipRemainingSiblings, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractHierarchyIteratorWithFilter

public AbstractHierarchyIteratorWithFilter(N root)
Construct.

Parameters:
root -
Method Detail

onFilter

protected final boolean onFilter(N node)
Apply all registered filters

Overrides:
onFilter in class AbstractHierarchyIterator<N,I extends N>
Parameters:
node -
Returns:
False, to filter the component. True, to continue processing the component.

getFilters

public final java.util.List<IteratorFilter<N>> getFilters()
Parameters:
filter -
Returns:
Gets the List of all registered filters. A new list will be created if no filter has been registered yet (never return null).

addFilter

public AbstractHierarchyIteratorWithFilter<N,I> addFilter(IteratorFilter<N> filter)
Add a filter (fluent API)

Parameters:
filter -
Returns:
this

replaceFilterSet

public java.util.Collection<IteratorFilter<N>> replaceFilterSet(java.util.Collection<IteratorFilter<N>> filters)
Replace the current set of filters. Sometimes you need to first find X to than start searching for Y.

Parameters:
filters - New filter set. May be null to remove all filters.
Returns:
Old filter set. Null, if no filter was registered.

getFirst

public final I getFirst(boolean throwException)
Parameters:
throwException - If true, an exception is thrown if no matching element was found.
Returns:
Find the the first element matching all filters

toList

public final java.util.List<I> toList()
Returns:
Gets all elements matching the filters in a list

getTraverseFilters

public final java.util.List<IteratorFilter<N>> getTraverseFilters()
Returns:
Gets the List of all registered traversal filters. A new list will be created if no traversal filter has been registered yet (never return null).

addTraverseFilters

public AbstractHierarchyIteratorWithFilter<N,I> addTraverseFilters(IteratorFilter<N> filter)
Add a filter to the traversal filter list (fluent API).

Parameters:
filter -
Returns:
this

onTraversalFilter

protected boolean onTraversalFilter(N node)
Apply all registered traversal filters

Overrides:
onTraversalFilter in class AbstractHierarchyIterator<N,I extends N>
Parameters:
node -
Returns:
False, to filter the element. True, to continue processing the component.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.