Class TreeModelProvider<T>
- java.lang.Object
-
- org.apache.wicket.extensions.markup.html.repeater.util.TreeModelProvider<T>
-
- Type Parameters:
T- model object type
- All Implemented Interfaces:
Serializable,ITreeProvider<T>,org.apache.wicket.model.IDetachable,org.apache.wicket.util.io.IClusterable
public abstract class TreeModelProvider<T> extends Object implements ITreeProvider<T>
A provider wrapping a SwingTreeModel.
EXPERIMENTAL !- Author:
- svenmeier
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<T>branchUpdatesprotected booleancompleteUpdateprotected List<T>nodeUpdates
-
Constructor Summary
Constructors Constructor Description TreeModelProvider(TreeModel treeModel)Wrap the givenTreeModel.TreeModelProvider(TreeModel treeModel, boolean rootVisible)Wrap the givenTreeModel.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbranchUpdate(Object branch)protected Tcast(Object object)voiddetach()Iterator<T>getChildren(T object)Get the children of the given node.Iterator<T>getRoots()Get the roots of the tree.booleanhasChildren(T object)Does the given object have children - note that this method may returntrueeven ifITreeProvider.getChildren(Object)returns an empty iterator.abstract org.apache.wicket.model.IModel<T>model(T object)Callback used by the consumer of this tree provider to wrap objects retrieved fromITreeProvider.getRoots()orITreeProvider.getChildren(Object)with a model (usually a detachable one).protected voidnodeUpdate(Object[] nodes)voidupdate(AbstractTree<T> tree, org.apache.wicket.ajax.AjaxRequestTarget target)Call this method after all change to the wrappedTreeModelbeing initiated viaAjaxRequestTarget.
-
-
-
Field Detail
-
completeUpdate
protected boolean completeUpdate
-
nodeUpdates
protected List<T> nodeUpdates
-
branchUpdates
protected List<T> branchUpdates
-
-
Constructor Detail
-
TreeModelProvider
public TreeModelProvider(TreeModel treeModel)
Wrap the givenTreeModel.- Parameters:
treeModel- model to wrap
-
TreeModelProvider
public TreeModelProvider(TreeModel treeModel, boolean rootVisible)
Wrap the givenTreeModel.- Parameters:
treeModel- the wrapped modelrootVisible- should the root be visible
-
-
Method Detail
-
getRoots
public Iterator<T> getRoots()
Description copied from interface:ITreeProviderGet the roots of the tree.- Specified by:
getRootsin interfaceITreeProvider<T>- Returns:
- roots
-
hasChildren
public boolean hasChildren(T object)
Description copied from interface:ITreeProviderDoes the given object have children - note that this method may returntrueeven ifITreeProvider.getChildren(Object)returns an empty iterator.- Specified by:
hasChildrenin interfaceITreeProvider<T>- Parameters:
object- the node to check for children- Returns:
trueif node has children
-
getChildren
public Iterator<T> getChildren(T object)
Description copied from interface:ITreeProviderGet the children of the given node.- Specified by:
getChildrenin interfaceITreeProvider<T>- Parameters:
object- node to get children for- Returns:
- children of node
-
model
public abstract org.apache.wicket.model.IModel<T> model(T object)
Description copied from interface:ITreeProviderCallback used by the consumer of this tree provider to wrap objects retrieved fromITreeProvider.getRoots()orITreeProvider.getChildren(Object)with a model (usually a detachable one).Important note: The model must implement
Object.equals(Object)andObject.hashCode()!- Specified by:
modelin interfaceITreeProvider<T>- Parameters:
object- the object that needs to be wrapped- Returns:
- the model representation of the object
-
detach
public void detach()
- Specified by:
detachin interfaceorg.apache.wicket.model.IDetachable
-
update
public void update(AbstractTree<T> tree, org.apache.wicket.ajax.AjaxRequestTarget target)
Call this method after all change to the wrappedTreeModelbeing initiated viaAjaxRequestTarget.- Parameters:
tree- the tree utilizing thisITreeProvidertarget- theAjaxRequestTargetwhich initiated the changes
-
nodeUpdate
protected void nodeUpdate(Object[] nodes)
-
branchUpdate
protected void branchUpdate(Object branch)
-
-