T
- model object typepublic abstract class TreeModelProvider<T> extends Object implements ITreeProvider<T>
TreeModel
.
Modifier and Type | Field and Description |
---|---|
protected List<T> |
branchUpdates |
protected boolean |
completeUpdate |
protected List<T> |
nodeUpdates |
Constructor and Description |
---|
TreeModelProvider(TreeModel treeModel)
Wrap the given
TreeModel . |
TreeModelProvider(TreeModel treeModel,
boolean rootVisible)
Wrap the given
TreeModel . |
Modifier and Type | Method and Description |
---|---|
protected void |
branchUpdate(Object branch) |
protected T |
cast(Object object) |
void |
detach()
Detaches model after use.
|
Iterator<T> |
getChildren(T object)
Get the children of the given node.
|
Iterator<T> |
getRoots()
Get the roots of the tree.
|
boolean |
hasChildren(T object)
Does the given object have children - note that this method may return
true even
if ITreeProvider.getChildren(Object) returns an empty iterator. |
abstract IModel<T> |
model(T object)
Callback used by the consumer of this tree provider to wrap objects retrieved from
ITreeProvider.getRoots() or ITreeProvider.getChildren(Object) with a model (usually a detachable one). |
protected void |
nodeUpdate(Object[] nodes) |
void |
update(AbstractTree<T> tree,
AjaxRequestTarget target)
Call this method after all change to the wrapped
TreeModel being initiated via
AjaxRequestTarget . |
public TreeModelProvider(TreeModel treeModel)
TreeModel
.treeModel
- model to wrappublic Iterator<T> getRoots()
ITreeProvider
getRoots
in interface ITreeProvider<T>
public boolean hasChildren(T object)
ITreeProvider
true
even
if ITreeProvider.getChildren(Object)
returns an empty iterator.hasChildren
in interface ITreeProvider<T>
object
- the node to check for childrentrue
if node has childrenpublic Iterator<T> getChildren(T object)
ITreeProvider
getChildren
in interface ITreeProvider<T>
object
- node to get children forpublic abstract IModel<T> model(T object)
ITreeProvider
ITreeProvider.getRoots()
or ITreeProvider.getChildren(Object)
with a model (usually a detachable one).
Important note: The model must implement Object.equals(Object)
and
Object.hashCode()
!
model
in interface ITreeProvider<T>
object
- the object that needs to be wrappedpublic void detach()
IDetachable
detach
in interface IDetachable
public void update(AbstractTree<T> tree, AjaxRequestTarget target)
TreeModel
being initiated via
AjaxRequestTarget
.tree
- the tree utilizing this ITreeProvider
target
- the AjaxRequestTarget
which initiated the changesprotected void nodeUpdate(Object[] nodes)
protected void branchUpdate(Object branch)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.