T
- public class DefaultTreeModel<T> extends Object implements TreeModel<T>
ValueEncoder
(for the element to string conversion),
a TreeModelAdapter
, and a list of root nodes.
This implementation is not thread safe.Constructor and Description |
---|
DefaultTreeModel(ValueEncoder<T> encoder,
TreeModelAdapter<T> adapter,
List<T> roots)
Standard constructor.
|
DefaultTreeModel(ValueEncoder<T> encoder,
TreeModelAdapter<T> adapter,
T root)
Creates a new model starting from a single root element.
|
Modifier and Type | Method and Description |
---|---|
TreeNode<T> |
find(T element)
Recursively searches from the root nodes to find the tree node that matches
the provided element.
|
TreeNode<T> |
getById(String id)
Locates a node in the tree by its unique id.
|
List<TreeNode<T>> |
getRootNodes()
Returns the node or nodes that are the top level of the tree.
|
public DefaultTreeModel(ValueEncoder<T> encoder, TreeModelAdapter<T> adapter, T root)
encoder
- used to convert values to strings and vice-versaadapter
- adapts elements to the treeroot
- defines the root node of the modelpublic DefaultTreeModel(ValueEncoder<T> encoder, TreeModelAdapter<T> adapter, List<T> roots)
encoder
- used to convert values to strings and vice-versaadapter
- adapts elements to the treeroots
- defines the root nodes of the modelpublic List<TreeNode<T>> getRootNodes()
TreeModel
getRootNodes
in interface TreeModel<T>
public TreeNode<T> getById(String id)
TreeModel
getById
in interface TreeModel<T>
TreeNode.getId()
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.