Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

6.9.2.  < rich:treeNode > available since 3.0.0

The <rich:treeNode> component is designed for creating sets of tree elements within a <rich:tree> component.


Table 6.188. rich : treeNode attributes

Attribute Name Description
acceptCursorsList of comma separated cursors that indicates when acceptable draggable over dropzone
acceptedTypesA list of drag zones types, which elements are accepted by a drop zone
ajaxSingleLimits JSF tree processing (decoding, conversion, validation and model updating) only to a component that sends the request. Boolean
ajaxSubmitSelectionAn algorithm of AJAX request submission. Possible values are "inherit", "true", "false". Default value is "inherit".
binding JSF: The attribute takes a value-binding expression for a component property of a backing bean
bypassUpdatesIf "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input
changeExpandListenerListener called on expand/collapse event on the node
cursorTypeMappingMapping between drop types and acceptable cursors
dataSerialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax
dragIndicatorId of a component that is used as drag pointer during the drag operation
dragListenerMethodBinding representing an action listener method that will be notified after drag operation
dragTypeA drag zone type that is used for zone definition, which elements can be accepted by a drop zone
dragValueData to be sent to the drop zone after a drop event. Default value is "getUITree().getDragValue()".
dropListenerMethodBinding representing an action listener method that will be notified after drop operation
dropValueData to be processed after a drop event. Default value is "getUITree().getDropValue()".
eventsQueueName of requests queue to avoid send next request before complete other from same event. Can be used to reduce number of requests of frequently events (key press, mouse move etc.)
focusID of an element to set focus after request is completed on client side
grabbingCursorsList of comma separated cursors that indicates when you has grabbed something
grabCursorsList of comma separated cursors that indicates when you can grab and drag an object
highlightedClassAssigns one or more space-separated CSS class names to the component highlighted node
iconThe icon for node
iconCollapsedThe icon for collapsed node
iconExpandedThe icon for expanded node
iconLeafAn icon for component leaves
id JSF: Every component may have a unique id that is automatically created if omitted
ignoreDupResponsesAttribute allows to ignore an Ajax Response produced by a request if the newest 'similar' request is in a queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows to avoid unnecessary updates on the client side if the response isn't actual now
limitToListIf "true", then of all AJAX-rendered on the page components only those will be updated, which ID's are passed to the "reRender" attribute of the describable component. "false"-the default value-means that all components with ajaxRendered="true" will be updated.
nodeClassAssigns one or more space-separated CSS class names to the component node
nodeSelectListenerMethodBinding representing an action listener method that will be notified after selection of node.
onbeforedomupdateThe client-side script method to be called before DOM is updated
onclick DHTML: The client-side script method to be called when the element is clicked
oncollapseThe client-side script method to be called when a node is collapsed
oncompleteThe client-side script method to be called after the request is completed
oncontextmenuThe client-side script method to be called when the right mouse button is clicked over the component. Returning false prevents a default browser context menu from being displayed.
ondblclick DHTML: The client-side script method to be called when the element is double-clicked
ondragendThe client-side script method to be called when the dragging operation is finished. The default attribute value is "getDefaultOndragend()".
ondragenterThe client-side script method to be called when a draggable object enters the zone. The default attribute value is "getDefaultOndragenter()".
ondragexitThe client-side script method to be called after a draggable object leaves the zone. The default attribute value is "getDefaultOndragexit()".
ondragstartThe client-side script method to be called when the dragging operation is started. The default attribute value is "getDefaultOndragstart()".
ondropThe client-side script method to be called when something is dropped into the drop zone. The default attribute value is "getDefaultOndrop()".
ondropendThe client-side script method to be called when a draggable object is dropped into any zone. The default attribute value is "getDefaultOndropend()".
ondropoutThe client-side script method to be called when the draggable object is moved away from the drop zone
ondropoverThe client-side script method to be called when the draggable object is over the drop zone
onexpandThe client-side script method to be called when a node is expanded
onkeydown DHTML: The client-side script method to be called when a key is pressed down over the element
onkeypress DHTML: The client-side script method to be called when a key is pressed over the element and released
onkeyup DHTML: The client-side script method to be called when a key is released
onmousedown DHTML: The client-side script method to be called when a mouse button is pressed down over the element
onmousemove DHTML: The client-side script method to be called when a pointer is moved within the element
onmouseout DHTML: The client-side script method to be called when a pointer is moved away from the element
onmouseover DHTML: The client-side script method to be called when a pointer is moved onto the element
onmouseup DHTML: The client-side script method to be called when a mouse button is released
onselectedThe client-side script method to be called when a node is selected
processId['s] (in format of call UIComponent.findComponent()) of components, processed at the phases 2-5 in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection
rejectCursorsList of comma separated cursors that indicates when rejectable draggable over dropzone
rendered JSF: If "false", this component is not rendered
requestDelayAttribute defines the time (in ms.) that the request will be wait in the queue before it is ready to send. When the delay time is over, the request will be sent to the server or removed if the newest 'similar' request is in a queue already
reRenderId['s] (in format of call UIComponent.findComponent()) of components, rendered in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection. Default value is "getDefaultReRender()".
selectedClassAssigns one or more space-separated CSS class names to the component selected node
similarityGroupingIdIf there are any component requests with identical IDs then these requests will be grouped.
statusID (in format of call UIComponent.findComponent()) of Request status component
timeoutGets timeout in ms. Default value is "getDefaultTimeout()".
typeHTML: A node type
typeMappingThe attribute associates a type of dragable zone (dragType) with <rich:dndParam> defined for <rich:dropSupport> for passing parameter value to <rich:dragIndicator>. It uses JSON format: (drag_type: parameter_name).

Table 6.189. Component identification parameters

NameValue
component-typeorg.richfaces.TreeNode
component-classorg.richfaces.component.html.HtmlTreeNode
component-familyorg.richfaces.TreeNode
renderer-typeorg.richfaces.TreeNodeRenderer
tag-classorg.richfaces.taglib.TreeNodeTag

Here is a simple example as it can be used on a page:

Example:


...
<rich:tree ... faceNode="simpleNode">
        <rich:treeNode type="simpleNode">
                <!--Tree node data displaying template-->
        </rich:treeNode>
</rich:tree>
...

Example:

import org.richfaces.component.html.HtmlTreeNode;

...
HtmlTreeNode myPanel = new HtmlTreeNode();
...

The "icon" , "iconCollapsed" , "iconExpanded" , "iconLeaf" attributes define icons for the component. Also you can define icons using facets with the same names. If the facets are defined, the corresponding attributes are ignored and facets contents are used as icons. The width of a rendered facet area is 16px.


...
<rich:tree ...>
        ...
        <rich:treeNode ...>
                <f:facet name="icon">
                    <outputText value="A"/>
                </f:facet>
                <f:facet name="iconCollapsed">
                    <outputText value="B"/>
                </f:facet>      
                <f:facet name="iconExpanded">
                    <outputText value="C"/>
                </f:facet>
                <f:facet name="iconLeaf">
                    <outputText value="D"/>
                </f:facet>
        </rich:treeNode>
        ...
</rich:tree>
...

As it has been mentioned above, <rich:treeNode> defines a template for nodes rendering in a tree. Thus, during XML document rendering (a web.xml application) as a tree, the following nodes output (passed via var="data" on a tree) happens:

Example:


...
<rich:tree ... faceNode="simpleNode" ... value="#{bean.data}" var="data">
        <rich:treeNode type="simpleNode">
                <h:outputText value="context-param:"/>
                <h:inputText value="#{data.name}"/>
        </rich:treeNode>
</rich:tree>
...

Hence, <h:outputText /> tag outputs the "context-param" string and then the <h:inputText /> outputs the data.name element of this node.

Different nodes for rendering could be defined depending on some conditions on the tree level. Each condition represents some rendering template. To get more information on various treeNodesAdaptorAdaptor definition for nodes, see the tree component chapter.

Switching between expanded/collapsed modes is also managed on the tree level and defined in the corresponding section.

Default nodes of the tree level as well as the ones defined with the treeNodesAdaptorAdaptor component could send Ajax requests when selected with the mouse, it's managed with the "ajaxSubmitSelection" attribute (true/false).

Information about the "process" attribute usage you can find " Decide what to process " guide section.

The main information on Drag and Drop operations is given in the corresponding paragraph of the tree component chapter. It's only necessary to mention that each node could also be a Drag element as well as a Drop container, i.e. the container and the element have all attributes, listeners and ways of behavior similar to the ones of the <rich:dragSupport > and <rich:dropSupport > components simultaneously.

Just as Drag and Drop operations it corresponds to the one described on the tree component level for a default Node.


For skinnability implementation, the components use a style class redefinition method. Default style classes are mapped on skin parameters.

There are two ways to redefine the appearance of all <rich:treeNode> components at once:




On the screenshot there are classes names that define styles for component elements.




In order to redefine the style for all <rich:treeNode> components on a page using CSS, it's enough to create classes with the same names and define the necessary properties in them.

For instance, if you need to change the size of a tree node image, you should redefine the .rich-tree-h-ic-img class properties:


...
.rich-tree-h-ic-img{
       
width:30px;
       
height:30px;
}   
...

To change the style of particular <rich:treeNode> components define your own style classes in the corresponding <rich:treeNode> attributes.

It is also possible to change look and feel of specific <rich:treeNode> with the help of defining for them "selectedClass" and "highlightedClass" attributes by their specific classes.

How to Expand/Collapse Tree Nodes from code see in thiswiki article.