MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-1556

tree2: Programatically setting of Treestate does only work on the first time


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.9
    • Fix Version/s: None
    • Component/s: Tree2
    • Labels:
    • Environment:
      MyFaces 1.1.1, Java SUN JDK 1.5. update 12, Bea Weblogic 9.2 MP3, Windows XP SP3


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

      On the Jsp a tree2 Component is placed. If 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. Resetting means, that the root node will be selected and of course, highlighted with css.

      If the users clicks on a treenode, the node is correctly marked as selected and highlighted. But if the users clicks on the reset Link, the root node will not be seleceted. The view shows the old node as selected. No reset is possible.

      In my reset method in the ManagedBean, which is connected to the Reset commandLink, I'm creating a new treemodel, setting the path to the selected node, and setting 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

      The JSP Code:
      <t:tree2 value="#


      " showRootNode="false" var="node"
      varNodeToggler="t" binding="#


      " clientSideToggle="false">
      <f:facet name="orga">
      <t:commandLink immediate="false" styleClass="#

      {t.nodeSelected ? 'selectedNode':'standardNode'}

      " actionListener="#




      <t:graphicImage value="images/person.png" border="0" alt="TreeIcon"/>
      <h:outputText value="#


      " />

      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; }


        There are no comments yet on this issue.


          • Assignee:
            Jochen List
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: