Tree Drag and Drop Problem with recursiveNodesAdapter
skarvenz Sep 18, 2008 6:49 PMI have a tree that contains both a recursiveTreeNodesAdapter and treeNodesAdapter. When I perform a drag and drop onto the tree itself, nodes that are dragged from the treeNodesAdapter will reRender the tree, but nodes that are dragged from the recursiveTreeNodesAdapter do not seem to reRender the tree. It seems to be the same problem as bug RF-1801 (https://jira.jboss.org/jira/browse/RF-1081) but it is only happening when the node being dragged is from the recursiveTreeNodesAdapter. I have tried reRendering the entire panel that the tree is on, but that doesn't seem to work either. Please see code below.
Is anyone else having this problem? or have a workaround for it?
Thanks!
JSP Page:
<rich:tree adviseNodeOpened="#{ui$query$setFilters.adviseNodeOpen}" icon="" iconLeaf="" showConnectingLines="true" switchType="ajax" id="theTree" nodeSelectListener="#{ui$query$setFilters.processTreeSelection}"
reRender="theTree" dropListener="#{ui$query$setFilters.treeDrop}" >
<rich:treeNodesAdaptor id="TheDateGroup" var="dg" nodes="#{ui$query$newQuery.qryStatement.whereClause.dateGroup}" >
<rich:treeNode acceptedTypes="wg" reRender="theTree">
<h:outputText value="#{dg.filterString}" />
</rich:treeNode>
<rich:recursiveTreeNodesAdaptor id="whereGroup" roots="#{dg.whereGroups}" var="wg" nodes="#{wg.whereGroups}" >
<rich:treeNode dragType="wg" acceptedTypes="wf,wg">
<h:outputText value="#{wg.isAnd}" converter="#{ui$query$setFilters.cvtAndOr}" />
</rich:treeNode>
<rich:treeNodesAdaptor id="wf" var="wf" nodes="#{wg.whereFilters}">
<rich:treeNode dragType="wf" reRender="treePanel">
<h:outputText value="#{wf.displayString}"/>
</rich:treeNode>
</rich:treeNodesAdaptor>
</rich:recursiveTreeNodesAdaptor>
</rich:treeNodesAdaptor>
</rich:tree>
Java code for drag and drop:
public void treeDrop(DropEvent dropEvent) {
UITree tree = ((UITreeNode) dropEvent.getComponent()).getUITree();
Object dragValue = dropEvent.getDragValue();
Object dropValue = dropEvent.getDropValue();
if (dragValue != dropValue) {
//Drop group will always be a group
Group dropGroup = (Group) tree.getRowData(dropValue);
//Drag Item could be a WhereGroup or a WhereFilter
Object item = tree.getRowData(dragValue);
if (item instanceof WhereGroup) {
WhereGroup dragGroup = (WhereGroup) item;
dragGroup.getParent().removeWhereGroup(dragGroup);
dropGroup.addWhereGroup(dragGroup);
} else if (item instanceof WhereFilter && dropGroup instanceof WhereGroup) {
WhereFilter dragFilter = (WhereFilter) tree.getRowData(dragValue);
dragFilter.getParent().removeWhereFilter(dragFilter);
((WhereGroup) dropGroup).addWhereFilter(dragFilter);
}
tree.addRequestKey(tree.getParentRowKey(dragValue));
}
}