Hi everybody,
I'm stucked with this problem:
I'm trying to implement a Drag'n Drop Tree where I can move the nodes around. The recursiveTreeNodesAdaptor seems to be perfect to fullfill my requirements.
<rich:tree switchType="ajax" nodeSelectListener="#{depotManager.processSelection}" ajaxSubmitSelection="true"
reRender="depotTab" id="tree" dragIndicator="dragIndicator" dropListener="#{depotManager.dropListener}" >
<rich:recursiveTreeNodesAdaptor roots="#{depotManager.getRoot()}" var="item" nodes="#{item.children}">
<rich:treeNode acceptedTypes="depot" ragType="depot">
<rich:dndParam name="label" type="drag">
#{item.name}
</rich:dndParam>
<h:outputText value="#{item.name}" />
</rich:treeNode>
</rich:recursiveTreeNodesAdaptor>
</rich:tree>TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null; TreeNode draggedNode = dragNodeKey != null ? srcTree.getTreeNode(dragNodeKey) : null;
Adaptor-based trees do not use TreeNode, so the method always return null for such trees. Please use UIDataAdaptor.getRowData() instead.
TreeNode parentNode = draggedNode.getParent(); state = srcTree.removeNode(dragNodeKey); Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
Hi,
TreeNode are not available for model adaptor tags. Please take a look at this sample: http://anonsvn.jboss.org/repos/richfaces/trunk/samples/treeModelDemo - rf-1081.jsp