Javatpoint Logo
Javatpoint Logo

RichFaces <rich:tree>

This component is used to create a hierarchical tree. It uses <rich:treeNode> as a child component.

We can create customize tree according to our requirement. RichFaces provides all the available components to create tree accordingly.

It requires the value attribute to bind the data model for creating the tree. The data model must be either an org.richfaces.model.TreeNode interface, an org.richfaces.model.TreeDataModel interface or a javax.swing.tree.TreeNode interface.

Style classes and skin parameters

The following table contains the Style classes and corresponding skin parameters for the treeNode.

Class Function Skin Parameters Mapped CSS properties
.rf-trn It is used to define styles for a tree node. generalFamilyFont generalSizeFont font-family font-size
.rf-trn-lbl It is used to define styles for a tree node label. No skin parameters.
.rf-trn-cnt It is used to define styles for tree node content. No skin parameters.
.rf-trn-sel It is used to define styles for a selected tree node. additionalBackgroundColor background
.rf-trn-ldn It is used to define styles for a tree node when it is loading. additionalBackgroundColor background
.rf-trn-hnd It is used to define styles for a tree node handle. No skin parameters.
.rf-trn-hnd-lf It is used to define styles for the handle of a leaf node. No skin parameters.
.rf-trn-hnd-colps It is used to define styles for the handle of a collapsed node. No skin parameters.
.rf-trn-hnd-exp It is used to define styles for the handle of an expanded node. No skin parameters.
.rf-trn-hnd-ldn-fct It is used to define styles for the loading facet of a tree node handle. No skin parameters.
.rf-trn-ico It is used to define styles for tree node icon. No skin parameters.
.rf-trn-ico-lf It is used to define styles for the icon of a leaf node. No skin parameters.
.rf-trn-ico-colps It is used to define styles for the icon of a collapsed node. No skin parameters.
.rf-trn-ico-exp It is used to define styles for the icon of an expanded node. No skin parameters.
.rf-trn-ico-cst It is used to define styles for a custom node icon. No skin parameters.

Example

Here, in the following example, we are implementing <rich:tree> component. This example contains the following files.

JSF File

// rich-tree.xhtml

Managed Bean

// Tree.java

Output:

RichFaces Tree 1

After expending the root tree, it shows all the tree nodes as shown below.

RichFaces Tree 2




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA