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>
,IDetachable
,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>
branchUpdates
protected boolean
completeUpdate
protected 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 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 returntrue
even ifITreeProvider.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 fromITreeProvider.getRoots()
orITreeProvider.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 wrappedTreeModel
being 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:ITreeProvider
Get the roots of the tree.- Specified by:
getRoots
in interfaceITreeProvider<T>
- Returns:
- roots
-
hasChildren
public boolean hasChildren(T object)
Description copied from interface:ITreeProvider
Does the given object have children - note that this method may returntrue
even ifITreeProvider.getChildren(Object)
returns an empty iterator.- Specified by:
hasChildren
in interfaceITreeProvider<T>
- Parameters:
object
- the node to check for children- Returns:
true
if node has children
-
getChildren
public Iterator<T> getChildren(T object)
Description copied from interface:ITreeProvider
Get the children of the given node.- Specified by:
getChildren
in interfaceITreeProvider<T>
- Parameters:
object
- node to get children for- Returns:
- children of node
-
model
public abstract IModel<T> model(T object)
Description copied from interface:ITreeProvider
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).Important note: The model must implement
Object.equals(Object)
andObject.hashCode()
!- Specified by:
model
in interfaceITreeProvider<T>
- Parameters:
object
- the object that needs to be wrapped- Returns:
- the model representation of the object
-
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 interfaceIDetachable
-
update
public void update(AbstractTree<T> tree, AjaxRequestTarget target)
Call this method after all change to the wrappedTreeModel
being initiated viaAjaxRequestTarget
.- Parameters:
tree
- the tree utilizing thisITreeProvider
target
- theAjaxRequestTarget
which initiated the changes
-
nodeUpdate
protected void nodeUpdate(Object[] nodes)
-
branchUpdate
protected void branchUpdate(Object branch)
-
-