/**/ function nodesArrayToString(nodes) { var result = new Array(); jQuery.each(nodes, function(k, v) { result.push(v.getId()); }); return result.join(''); } function getNodeStateString(treeNode) { return treeNode.isLeaf() ? 'leaf' : (treeNode.isExpanded() ? 'expanded' : 'collapsed'); } function handleNodeToggle(nodeData, event, isTreeNodeLevel) { var treeNode = RichFaces.component(event.target); RichFaces.log.info('Toggle event ' + (isTreeNodeLevel ? '(treeNode level)' : '') + '[' + nodeData + ']:\n ' + treeNode.getId() + ' became ' + getNodeStateString(treeNode)); } function handleBeforeNodeToggle(event, isTreeNodeLevel) { var treeNode = RichFaces.component(event.target); return confirm('Tree' + (isTreeNodeLevel ? ' node ' : ' ') + 'asks: really toggle node ' + treeNode.getId() + '?'); } function handleBeforeNodeSelect(event) { var treeNode = RichFaces.component(event.target); var oldSelectionString = nodesArrayToString(event.rf.data.oldSelection); var newSelectionString = nodesArrayToString(event.rf.data.newSelection); return confirm('Selection will be changed from: [' + oldSelectionString + '] to: [' + newSelectionString + ']'); } function handleNodeSelect(event) { var treeNode = RichFaces.component(event.target); var oldSelectionString = nodesArrayToString(event.rf.data.oldSelection); var newSelectionString = nodesArrayToString(event.rf.data.newSelection); RichFaces.log.info('Selection changed from: [' + oldSelectionString + '] to: [' + newSelectionString + ']'); } Toggle mode: Selection mode: Show custom classes:
Toggle node event:

Base tree: Root node: #{node.data} - #{node.data} -

Base tree w/ filtered contextMenu: Root node: #{node.data} - #{node.data} -

org.richfaces.model.TreeNode support: #{node.data} -

org.richfaces.model.TreeDataModel support: #{node.data} -

Tree with customized look: #{node.data}

Tree with default node:

Tree with client-side event handlers: #{node.data}

Tree with attached behaviors: #{node.data}

Lazy loaded tree: #{node.wrappedNode.data}

Server listeners test: #{node.data}

Toggle node event: #{node.data}

execute/render: #{node.data} Current time: #{treeBean.currentTimeAsString}
Current selection: #{treeBean.selection}
Test text:
Current time: #{treeBean.currentTimeAsString}

'handleLoading' facet: #{node}

'handleLoading' without facet: