1 Reply Latest reply on May 25, 2010 7:40 AM by Harut Sargsyan

    Setting Selected Node programatically in <rich:tree/>

    David Chokhonelidze Newbie

      Hello,

      I am developing web application and use richfaces tree component ,i need that when user types node name in search box and clicks search button , the node will be selected, i have treeController class but i dont know how to set selected node from java code side, so here is my tree:

       

      @Name("TreeController")
      public class FiListTreeController {
              private HtmlTree tree;
              private HtmlTreeNodesAdaptor treeNodeAdaptor;
      
              @Logger
              private Log log;
      
              public HtmlTree getTree() {
                      return tree;
              }
      
              public void setTree(HtmlTree tree) {
                      this.tree = tree;
              }
      
              public HtmlTreeNodesAdaptor getTreeNodeAdaptor() {
                      return treeNodeAdaptor;
              }
      
              public void setTreeNodeAdaptor(HtmlTreeNodesAdaptor treeNodeAdaptor) {
                      this.treeNodeAdaptor = treeNodeAdaptor;
              }
      
              public void setSelectedNode(String name) {
                      System.out.println("Setting Selected Node.....");
      
              }
      
      

      and here is my tree:

       

      <rich:tree binding="#{TreeController.tree}" id="fiTree" switchType="client">
                  <rich:treeNodesAdaptor binding="#{TreeController.treeNodeAdaptor}"  nodes="#{bTSession.bTypes}" var="bt">
                      
                      <rich:treeNode >
                          [#{bt.code}][#{bt.description}]
                      </rich:treeNode>
      
      

      can anyone tell me how to do that from java code? is that really possible?