You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jochen Zink <jo...@web.de> on 2010/09/09 13:32:55 UTC

Problems while resetting the state of tree2

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

Re: Problems while resetting the state of tree2

Posted by Jochen Zink <jo...@web.de>.
Hello,

no solution at the moment. I have also no response to my question.

Regards
Jochen

-----Ursprüngliche Nachricht-----
Von: Greg <ri...@tds.net>
Gesendet: 16.09.2010 17:36:00
An: users@myfaces.apache.org
Betreff: Re: Problems while resetting the state of tree2

>Jochen Zink <jochenlist [ web.de> writes:
>
>> 
>> Hello,
>> 
>> I have a problem with resetting the state of tree2 component.
>> 
>> ___________________________________________________________
>> GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
>> Jetzt freischalten unter http://movieflat.web.de
>> 
>> 
>
>I have the same issue. Have you found a solution to this?
>
>Greg
>
>
>
___________________________________________________________
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt kostenlose Movie-FLAT freischalten! http://movieflat.web.de

Re: Problems while resetting the state of tree2

Posted by Greg <ri...@tds.net>.
Jochen Zink <jochenlist <at> web.de> writes:

> 
> Hello,
> 
> I have a problem with resetting the state of tree2 component.
> 
> ___________________________________________________________
> GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://movieflat.web.de
> 
> 

I have the same issue. Have you found a solution to this?

Greg