Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.tree
Class DefaultTreeModel<T>

    java.lang.Object
      org.apache.tapestry5.tree.DefaultTreeModel<T>

Type Parameters:
  `T` -

All Implemented Interfaces:
  TreeModel<T>

    public class DefaultTreeModel<T>

extends java.lang.Object
implements TreeModel<T>

A default implementation of TreeModel that starts with a `ValueEncoder` (for the element to string conversion), a `TreeModelAdapter`, and a list of root nodes.

This implementation is not thread safe.

Since:
  5.3

Constructor Summary
`DefaultTreeModel(ValueEncoder<T> encoder, TreeModelAdapter<T> adapter, java.util.List<T> roots)` Standard constructor.
`DefaultTreeModel(ValueEncoder<T> encoder, TreeModelAdapter<T> adapter, T root)` Creates a new model starting from a single root element.

Method Summary
`TreeNode<T>` | `find(T element)` Recursively searches from the root nodes to find the tree node that matches the provided element.
`TreeNode<T>` | `getById(java.lang.String id)` Locates a node in the tree by its unique id.
`java.util.List<TreeNode<T>>` | `getRootNodes()` Returns the node or nodes that are the top level of the tree.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultTreeModel

    public DefaultTreeModel(ValueEncoder<T> encoder,
                            TreeModelAdapter<T> adapter,
                            T root)

  Creates a new model starting from a single root element.

  Parameters:
    `encoder` - used to convert values to strings and vice-versa
    `adapter` - adapts elements to the tree
    `root` - defines the root node of the model

### DefaultTreeModel

    public DefaultTreeModel(ValueEncoder<T> encoder,
                            TreeModelAdapter<T> adapter,
                            java.util.List<T> roots)

  Standard constructor.

  Parameters:
    `encoder` - used to convert values to strings and vice-versa
    `adapter` - adapts elements to the tree
    `roots` - defines the root nodes of the model

Method Detail

### getRootNodes

    public java.util.List<TreeNode<T>> getRootNodes()

  Description copied from interface: `TreeModel`
  Returns the node or nodes that are the top level of the tree.

  Specified by:
    `getRootNodes` in interface `TreeModel<T>`

### getById

    public TreeNode<T> getById(java.lang.String id)

  Description copied from interface: `TreeModel`
  Locates a node in the tree by its unique id.

  Specified by:
    `getById` in interface `TreeModel<T>`
  See Also:
    `TreeNode.getId()`

### find

    public TreeNode<T> find(T element)

  Description copied from interface: `TreeModel`
  Recursively searches from the root nodes to find the tree node that matches the provided element.

  Specified by:
    `find` in interface `TreeModel<T>`
  Parameters:
    `element` - to search for
  Returns:
    matching node, or null if not found

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.