Hello,

I have a problem with resetting the state of tree2 component.

On my JSP, I have the tree2. I f the user clicks on a node, the node is marked 
as selected and highlighted with css. This works fine. Also on the page, there 
is a commandLink "Reset", which should resets the tree (default is, that the 
root node is selected).

In my reset method in the ManagedBean, I'm creating a new treemodel, setting 
the path to the selected node, and adding the model to the tree. I have tried 
both options, recreating model and tree and only updating the model. Nothing 
worked as expected. In both cases, the old node is shown as selected.

I have debugged throw the code and in theBackingBean, everythink is correctly 
set. I can see the variables of htmlTree and treeModel and everythink looks 
like expected. Then I have debugged the isNodeSelected() Method of the tree, 
and I can see, that the getDataModel() Method of UITreeData returns a 
_cachedModel variable which contains the old model, with the old selected node. 
And this model seam to be used for rendering the jsp

How can I reset the selection reset correctly? I found something in further 
posts on the maillinglist, but it does not worked for me 
(http://markmail.org/thread/mbvpuuw7egyndnbt)

Thanks a lot!
Best Regards
Jochen Zink



the JSP Code:
<t:tree2 value="#{bean.model}" showRootNode="false" var="node" 
     varNodeToggler="t" binding="#{bean.htmlTree}" clientSideToggle="false">
     <f:facet name="orga">
         <h:panelGroup>
             <t:commandLink immediate="false" styleClass="#{t.nodeSelected ? 
'selectedNode':'standardNode'}" actionListener="#{t.setNodeSelected}"
 action="#{bavCockpitBean.updateNodeList}">
                <t:graphicImage value="images/person.png" border="0" 
alt="TreeIcon"/>
                <h:outputText value="#{node.description}" />
             </t:commandLink>
        </h:panelGroup>
     </f:facet>                                    
</t:tree2>


The ManagedBean Code:
private HtmlTree htmlTree = null;
private TreeModelBase treeModel = null;
private boolean forceTreeUpdate = true;

public String reset() {
    this.forceUpdate = true;
    return "success";
}

public TreeModel getHirarchieModel() {    
    if ( forceUpdate ) {
        this.forceUpdate = false;
        TreeNode root = ... // Generating the tree;
 
        this.treeModel = new TreeModelBase(root);
        this.treeModel.getTreeState().setSelected( "0:0" );
 
        this.htmlTree = new HtmlTree();
        tree.setModel(this.treeModel);
 
        return this.treeModel;
 
 }
___________________________________________________________
GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

Reply via email to