1 Reply Latest reply on Mar 13, 2009 8:12 AM by ilya_shaikovsky

    rich:tree componentState attribute not working

    khisanthmagus

      In order for the tree state to persist across requests I am attempting to use the componentState attribute of the rich:tree component. I have the attribute set, the property in the bean, and the getter and setter in the bean, but the getter and setter are never called. Any ideas what is wrong?

      <rich:tree value="#{ItemGroup.treeNode}" var="groups" showConnectingLines="true" ajaxSubmitSelection="true"
      reRender="dataTable,itemGroupName,addNewAsset,addMultipleAsset,deleteAsset" nodeFace="#{groups.type}"
      selectedClass="treeNodeSelectedText" componentState="#{itemGroupBean.treeState}">
       <rich:treeNode type="disabled" iconLeaf="/images/iconFolderDisabled.GIF" icon="/images/iconFolderDisabled.GIF">
       <h:outputText value="#{groups.group.itemGroupName}" />
       </rich:treeNode>
       <rich:treeNode type="node" nodeSelectListener="#{AssetManager.onItemGroupSelectionFromAssetTree}" iconLeaf="/images/iconFolder.gif" icon="/images/iconFolder.gif">
       <h:outputText value="#{groups.group.itemGroupName}" />
       </rich:treeNode>
       <rich:treeNode type="root" nodeSelectListener="#{AssetManager.onItemGroupSelectionFromAssetTree}" iconLeaf="/images/iconFolder.gif" icon="/images/iconFolder.gif">
       <h:outputText value="#{groups.group.itemGroupName}" />
       </rich:treeNode>
       <rich:treeNode type="recycle" iconLeaf="/images/recyclebin.gif" icon="/images/recyclebin.gif">
       <h:outputText value="#{groups.group.itemGroupName}" styleClass="treeNodeNotAllowed" />
       </rich:treeNode>
       <rich:treeNode type="packagesroot" iconLeaf="/images/iconFolder.gif" icon="/images/iconFolder.gif">
       <h:outputText value="#{groups.group.itemGroupName}" />
       </rich:treeNode>
       <rich:treeNode type="TestPackage" nodeSelectListener="#{AssetManager.onItemGroupSelectionFromAssetTree}" iconLeaf="/images/iconFolder.gif" icon="/images/iconFolder.gif">
       <h:outputText value="#{groups.testPackage.name}" />
       </rich:treeNode>
      </rich:tree>
      


      private TreeState treeState;
      
       public void setTreeState(TreeState treeState) {
       this.treeState = treeState;
       }
      
       public TreeState getTreeState() {
       return treeState;
       }


        • 1. Re: rich:tree componentState attribute not working
          ilya_shaikovsky

          can't confirm. just added the same property to the demosite bean and defined the component state. both getters and setters called while submit and nodes switching

           <h:form>
           <rich:tree style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}" componentState="#{userBean.state}">
           <rich:treeNode type="artist" iconLeaf="/images/tree/singer.gif" icon="/images/tree/singer.gif">
           <h:outputText value="#{item.name}" />
           </rich:treeNode>
           <rich:treeNode type="album" iconLeaf="/images/tree/disc.gif" icon="/images/tree/disc.gif">
           <h:outputText value="#{item.title}" />
           </rich:treeNode>
           <rich:treeNode type="song" iconLeaf="/images/tree/song.gif" icon="/images/tree/song.gif">
           <h:outputText value="#{item.title}" />
           </rich:treeNode>
           </rich:tree>
           <a4j:commandButton value="click" />
           </h:form>
          


           TreeState state;
           public TreeState getState() {
           System.out.println("UserBean.getState()");
           return state;
           }
          
           public void setState(TreeState state) {
           System.out.println("UserBean.setState()");
           this.state = state;
           }