RichFaces tree advisednode problem(without phaselistener)
roy433 Mar 14, 2011 6:25 PMHi All,
I have problem using advisednode attribute. Tree is supposed to execute advisenodeopened only once the dropdown menu is changed. Once the tree is loaded on the page if the user tries to expand a node, it is not expanding advisednodeexpanded method is overwriting the state of the node How to prevent this?
<h:form>
<h:selectOneMenu id="Treedropdownviews"
value="#{batchContentTree.selectedTreeView}">
<f:selectItems value="#{treeViewList}" />
<a:support ajaxSingle="true" event="onchange"
actionListener="#{batchContentTree.treeView}" reRender="tree" />
</h:selectOneMenu>
<rich:panel id="configtree">
<h:outputText value="#{batchHome.batch.name}" />
<div><rich:tree id="tree" switchType="server" adviseNodeOpened="#{batchContentTree.adviseNodeOpened}" >
<rich:treeNodesAdaptor var="_auState"
rendered="#{batchContentTree.aucufusususetFilter}"
nodes="#{batchHome.batch.batchOperationsManager.auStateList}">
<rich:treeNode id="AllAuid">
<h:outputText
value="#{!empty _auState.name ? _auState.name : 'NULL'} : " />
<h:outputText rendered="#{!empty _auState.contentSetName}"
value="#{_auState.contentSetName}" />
<rich:contextMenu hideDelay="0" showDelay="0" direction="right-up"
disableDefaultMenu="true" event="onmouseover" attached="true"
submitMode="ajax" id="auMenu">
<rich:menuItem ignoreDupResponses="true" immediate="true"
ajaxSingle="true"
action="#{batchContentTree.setCurrent(_auState.name)}"
submitMode="ajax" value="Export PMD ">
</rich:menuItem>
<rich:menuItem ignoreDupResponses="true" immediate="true"
ajaxSingle="true"
action="#{batchContentTree.setCurrent(_auState.id)}"
submitMode="ajax" value="Export DMD ">
</rich:menuItem>
</rich:contextMenu>
</rich:treeNode>
-----------------------------------------------------
public void treeView(final ActionEvent e) {
if ("Inspection_tree".equals(getselectedTreeView()) || "Process_Tree_Closed".equals(getselectedTreeView())) {
collapseLevelCu = true;
this.configUITree.queueCollapseAll();
log.info("event cu level");
} else {
try {
collapseLevelCu = false;
this.configUITree.queueExpandAll();
}
}
-------------------------------------------------
public Boolean adviseNodeOpened(UITree tree) {
/* Initial view of the tree when loaded for the first time */
if (!collapseLevelCu ) {
log.info("+++++++ adviseNodeOpened !collapseLevelCu");
tree.queueCollapseAll();
Object key = tree.getRowKey();
TreeRowKey treeRowKey = (TreeRowKey) key;
if (treeRowKey == null || treeRowKey.depth() <= 3) {
return Boolean.TRUE;
}
}