org.apache.wicket.examples.tree
Class FooProvider

java.lang.Object
  extended by org.apache.wicket.examples.tree.FooProvider
All Implemented Interfaces:
Serializable, ITreeProvider<Foo>, IDetachable, IClusterable

public class FooProvider
extends Object
implements ITreeProvider<Foo>

A provider of Foos. For simplicity all foos are kept as class members, in a real world scenario these would be fetched from a database. If Foos were Serializable you could of course just keep references in instance variables.

Author:
Sven Meier
See Also:
model(Foo), Serialized Form

Constructor Summary
FooProvider()
          Construct.
 
Method Summary
 void detach()
          Nothing to do.
 Iterator<Foo> getChildren(Foo foo)
          Get the children of the given node.
 Iterator<Foo> getRoots()
          Get the roots of the tree.
 boolean hasChildren(Foo foo)
          Does the given object have children - note that this method may return true even if ITreeProvider.getChildren(Object) returns an empty iterator.
 IModel<Foo> model(Foo foo)
          Creates a FooModel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FooProvider

public FooProvider()
Construct.

Method Detail

detach

public void detach()
Nothing to do.

Specified by:
detach in interface IDetachable

getRoots

public Iterator<Foo> getRoots()
Description copied from interface: ITreeProvider
Get the roots of the tree.

Specified by:
getRoots in interface ITreeProvider<Foo>
Returns:
roots

hasChildren

public boolean hasChildren(Foo foo)
Description copied from interface: ITreeProvider
Does the given object have children - note that this method may return true even if ITreeProvider.getChildren(Object) returns an empty iterator.

Specified by:
hasChildren in interface ITreeProvider<Foo>
Parameters:
foo - the node to check for children
Returns:
true if node has children

getChildren

public Iterator<Foo> getChildren(Foo foo)
Description copied from interface: ITreeProvider
Get the children of the given node.

Specified by:
getChildren in interface ITreeProvider<Foo>
Parameters:
foo - node to get children for
Returns:
children of node

model

public IModel<Foo> model(Foo foo)
Creates a FooModel.

Specified by:
model in interface ITreeProvider<Foo>
Parameters:
foo - the object that needs to be wrapped
Returns:
the model representation of the object


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