### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev
- Next

### 6.9.4. < rich:recursiveTreeNodesAdaptor > available since 3.1.0

expand all

#### 6.9.4.1. Description

The <rich:recursiveTreeNodesAdaptor> is an extension of a <rich:treeNodesAdaptor> component that provides the possibility to define data models and process nodes recursively.

Figure 6.110. Expanded tree with <rich:recursiveTreeNodesAdaptor>

#### 6.9.4.2. Key Features

- Allows to define combined data models

- Possibility to define nodes for processing via attributes

- Allows to process nodes recursively

Table 6.177. rich : recursiveTreeNodesAdaptor attributes

Attribute Name | Description
--- | ---
binding | JSF: The attribute takes a value-binding expression for a component property of a backing bean
id | JSF: Every component may have a unique id that is automatically created if omitted
included | This boolean expression is used to define which elements of both collections are processed. Default value is "true".
includedNode | This boolean expression is used to define which elements are processed. Default value is "true".
includedRoot | This boolean expression is used to define which elements are processed applying to "roots" collection. Default value is "true".
nodes | Defines collection to use at the other (non-top) levels of iteration
recursionOrder | The attribute is used to control a recursion order. Possible values are "first", "last", "[id of adaptor]" ("first" and "last" are reserved values). When "[id of the adaptor]" is set it means that recursion occurs after these adaptor component nodes are processed. The default value is "last"
rendered | JSF: If "false", this component is not rendered
roots | Defines collection to use at the top of iteration
var | A request-scope attribute via which the data object for the current collection element will be used when iterating

Table 6.178. Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.RecursiveTreeNodesAdaptor
component-class | org.richfaces.component.html.HtmlRecursiveTreeNodesAdaptor
component-family | org.richfaces.RecursiveTreeNodesAdaptor
tag-class | org.richfaces.taglib.RecursiveTreeNodesAdaptorTag

#### 6.9.4.3. Creating the Component with a Page Tag

Example:

    ...

    <rich:tree switchType="ajax" stateAdvisor="#{treeDemoStateAdvisor}">

        <rich:recursiveTreeNodesAdaptor roots="#{fileSystemBean.sourceRoots}" var="item" nodes="#{item.nodes}" />

    </rich:tree>

    ...

#### 6.9.4.4. Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.HtmlRecursiveTreeNodesAdaptor;

    ...

    HtmlRecursiveTreeNodesAdaptor myRecursiveTreeNodesAdaptor = new HtmlRecursiveTreeNodesAdaptor();

    ...

#### 6.9.4.5. Details of Usage

The <rich:recursiveTreeNodesAdaptor> component has a "roots" attribute that defines collection to use at the top of recursion.

The "nodes" attribute defines collection to use on another recursion levels.

The "var" attribute is used to access to the current collection element.

The <rich:recursiveTreeNodesAdaptor> component can be nested without any limitations. See the following example.

Example:

    ...

    <rich:tree adviseNodeOpened="#{treeModelBean.adviseNodeOpened}" switchType="client">

        <rich:treeNodesAdaptor id="project" nodes="#{loaderBean.projects}" var="project">

            <rich:treeNode>

                <h:commandLink action="#{project.click}" value="Project: #{project.name}" />

            </rich:treeNode>

            <rich:recursiveTreeNodesAdaptor id="dir" var="dir" root="#{project.dirs}" nodes="#{dir.directories}">

                <rich:treeNode>

                    <h:commandLink action="#{dir.click}" value="Directory: #{dir.name}" />

                </rich:treeNode>

                <rich:treeNodesAdaptor id="file" var="file" nodes="#{dir.files}">

                    <rich:treeNode>

                        <h:commandLink action="#{file.click}" value="File: #{file.name}" />

                    </rich:treeNode>

                </rich:treeNodesAdaptor>

                <rich:treeNodesAdaptor id="file1" var="file" nodes="#{dir.files}">

                    <rich:treeNode>

                        <h:commandLink action="#{file.click}" value="File1: #{file.name}" />

                    </rich:treeNode>

                </rich:treeNodesAdaptor>

                <rich:recursiveTreeNodesAdaptor id="archiveEntry" var="archiveEntry"

                                roots="#{dir.files}" nodes="#{archiveEntry.archiveEntries}"

                                includedRoot="#{archiveEntry.class.simpleName == 'ArchiveFile'}"

                                includedNode="#{archiveEntry.class.simpleName == 'ArchiveEntry'}">

                    <rich:treeNode id="archiveEntryNode">

                        <h:commandLink action="#{archiveEntry.click}" value="Archive entry: #{archiveEntry.name}" />

                    </rich:treeNode>

                </rich:recursiveTreeNodesAdaptor>

            </rich:recursiveTreeNodesAdaptor>

        </rich:treeNodesAdaptor>

    </rich:tree>

    ...

#### 6.9.4.6. Relevant resources links

On the component Live Demo page you can see the example of <rich:recursiveTreeNodesAdaptor> usage.

- Prev6.9.3. < rich:treeNodesAdaptor > ...
- Top of page
- Front page
- Next6.9.5. < rich:changeExpandListener >...