org.apache.wicket.extensions.markup.html.repeater.util
Class ProviderSubset<T>

java.lang.Object
  extended by org.apache.wicket.extensions.markup.html.repeater.util.ProviderSubset<T>
All Implemented Interfaces:
Serializable, Iterable<T>, Collection<T>, Set<T>, IDetachable, IClusterable

public class ProviderSubset<T>
extends Object
implements Set<T>, IDetachable

A subset of a ITreeProvider's tree offering automatic detachment. Make sure that the containing model calls IDetachable.detach() on its model object.

Author:
svenmeier
See Also:
ITreeProvider.model(Object), Serialized Form

Constructor Summary
ProviderSubset(ITreeProvider<T> provider)
          Create an empty subset.
ProviderSubset(ITreeProvider<T> provider, boolean addRoots)
          Create a subset optionally containing all roots of the provider.
 
Method Summary
 boolean add(T t)
           
 boolean addAll(Collection<? extends T> ts)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> cs)
           
 IModel<Set<T>> createModel()
          Create a model holding this set.
 void detach()
          Detaches model after use.
 boolean isEmpty()
           
 Iterator<T> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> cs)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 Object[] toArray()
           
<S> S[]
toArray(S[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

ProviderSubset

public ProviderSubset(ITreeProvider<T> provider)
Create an empty subset.

Parameters:
provider - the provider of the complete set

ProviderSubset

public ProviderSubset(ITreeProvider<T> provider,
                      boolean addRoots)
Create a subset optionally containing all roots of the provider.

Parameters:
provider - the provider of the complete set
addRoots - should all roots be added to this subset
Method Detail

detach

public void detach()
Description copied from interface: IDetachable
Detaches model after use. This is generally used to null out transient references that can be re-attached later.

Specified by:
detach in interface IDetachable

size

public int size()
Specified by:
size in interface Collection<T>
Specified by:
size in interface Set<T>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<T>
Specified by:
isEmpty in interface Set<T>

clear

public void clear()
Specified by:
clear in interface Collection<T>
Specified by:
clear in interface Set<T>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<T>
Specified by:
contains in interface Set<T>

add

public boolean add(T t)
Specified by:
add in interface Collection<T>
Specified by:
add in interface Set<T>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<T>
Specified by:
remove in interface Set<T>

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>
Specified by:
iterator in interface Collection<T>
Specified by:
iterator in interface Set<T>

addAll

public boolean addAll(Collection<? extends T> ts)
Specified by:
addAll in interface Collection<T>
Specified by:
addAll in interface Set<T>

containsAll

public boolean containsAll(Collection<?> cs)
Specified by:
containsAll in interface Collection<T>
Specified by:
containsAll in interface Set<T>

removeAll

public boolean removeAll(Collection<?> cs)
Specified by:
removeAll in interface Collection<T>
Specified by:
removeAll in interface Set<T>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<T>
Specified by:
retainAll in interface Set<T>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<T>
Specified by:
toArray in interface Set<T>

toArray

public <S> S[] toArray(S[] a)
Specified by:
toArray in interface Collection<T>
Specified by:
toArray in interface Set<T>

createModel

public IModel<Set<T>> createModel()
Create a model holding this set.

Returns:
model


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