2 Replies Latest reply on Jun 12, 2007 3:47 PM by Tong Wang

    rich:tree and getTreeNode problems

    .:lexx:. Newbie

      Hi guys.
      I found strange thing trying to implement selection handling in my tree bean.
      Here is my own implementation of TreeNode interface:

      public class USSDTreeNode implements TreeNode {
       private static final long serialVersionUID = -3498990493803705085L;
       private Object data;
       private TreeNode parent;
      
       private Map childrenMap = new LinkedHashMap();
      ....
      }
      


      and ui-component definition:

      <rich:tree styleClass="menuStructure"
       value="#{ussdMenuTree.data}"
       var="item"
       switchType="server"
       dragIndicator="treeIndicator"
       binding="#{ussdMenuTree.tree}"
      
      nodeSelectListener="#{ussdMenuTree.processSelection}"
      
       ajaxSubmitSelection="true">
      
       <rich:treeNode type="ussdNode">
       <h:outputText value="#{item.name}"/>
       </rich:treeNode>
       </rich:tree>
      


      and tree component bean:

      @Scope(ScopeType.SESSION)
      @Name("ussdMenuTree")
      public class USSDMenuTree implements NodeSelectedListener {
       @Logger
       private Log log;
      
       private USSDTreeStructureBuilder builder;
      
       private UITree tree;
      
       private USSDTreeNode selectedNode;
       private USSDTreeNode root;
      
       public USSDMenuTree() {
       builder = new USSDTreeStructureBuilder();
       reset();
       }
      
       public void processSelection(NodeSelectedEvent event) throws AbortProcessingException {
       log.info("Node selected: " + getTree(event).getRowKey());
       TreeNode treeNode = getTree(event).getTreeNode();
       log.info("Selected: " + treeNode + ", class: " + treeNode.getClass() + ", data: " + treeNode.getData() + ", dataClass: " + treeNode.getData().getClass());
       }
      ...
      


      In theory method getTreeNode should return instance of USSDTreeNode but it always returns object with type TreeNodeImpl. Why?