JBoss.orgCommunity Documentation

6.88.  < rich:treeNode >

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


Table 6.486. rich : treeNode attributes

Attribute NameDescription
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
ajaxSingleboolean attribute which provides possibility to limit JSF tree processing(decoding, conversion/validation, value applying) to the component which send the request only
ajaxSubmitSelectionAn algorithm of AJAX request submission. Possible values are "inherit", "true", "false". Default value is "inherit".
bindingThe 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 element to set focus after request 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
highlightedClassCorresponds to the HTML class attribute. Applied to highlighted node
iconThe icon for node
iconCollapsedThe icon for collapsed node
iconExpandedThe icon for expanded node
iconLeafAn icon for component leaves
idEvery 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", updates on client side ONLY elements from this 'reRender' property. If "false" (default) updates all rendered by ajax region components
nodeClassName of node CSS class
nodeSelectListenerMethodBinding representing an action listener method that will be notified after selection of node.
onbeforedomupdateJavaScript code for call before DOM has been updated on client side
onclickHTML: a script expression; a pointer button is clicked
oncollapseHTML: script expression to invoke on node collapsing
oncompleteJavaScript code for call after request completed on client side
oncontextmenuJavaScript handler to be called on right click. Returning false prevents default browser context menu from being displayed
ondblclickHTML: a script expression; a pointer button is double-clicked
ondragendA JavaScript event handler called after a drag operation. Default value is "getDefaultOndragend()".
ondragenterA JavaScript event handler called on enter draggable object to zone. Default value is "getDefaultOndragexit()".
ondragexitA JavaScript event handler called after a drag object leaves zone. Default value is "getDefaultOndragexit()".
ondragstartA JavaScript event handler called before drag object. Default value is "getDefaultOndragstart()".
ondropIt's an event that is called when something is dropped on a drop zone. Default value is "getDefaultOndrop()".
ondropendA JavaScript handler for event fired on a drop even the drop for a given type is not available. Default value is "getDefaultOndropend()".
ondropoutA JavaScript event handler called after a out operation
ondropoverA JavaScript event handler called after a drop operation
onexpandHTML: script expression to invoke on node expansion
onkeydownHTML: a script expression; a key is pressed down
onkeypressHTML: a script expression; a key is pressed and released
onkeyupHTML: a script expression; a key is released
onmousedownHTML: script expression; a pointer button is pressed down
onmousemoveHTML: a script expression; a pointer is moved within
onmouseoutHTML: a script expression; a pointer is moved away
onmouseoverHTML: a script expression; a pointer is moved onto
onmouseupHTML: script expression; a pointer button is released
onselectedHTML: script expression to invoke on node selection
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
renderedIf "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()".
selectedClassCorresponds to the HTML class attribute. Applied to selected node
statusID (in format of call UIComponent.findComponent()) of Request status component
timeoutGets timeout in ms. Default value is "getDefaultTimeout()".
typeA node type
typeMappingMap between a draggable type and an indicator name on zone. it's defined with the pair (drag type:indicator name))

Table 6.487. 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 here.

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:draggable> and <rich:dropZone> 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.

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 here.