1 Reply Latest reply on Dec 12, 2013 4:20 PM by Brian Leathem

    rich:tree is rendering tostring of DataHolderTreeNodeImpl instedof treedata name

    selvaraj chennappan Newbie

      Hi team,

      I am using richfaces 4.3.4 and seam 2.3.1 .

      Problem: rich:tree is rendering tostring of DataHolderTreeNodeImpl instedof treedata name

       

      Note :Same code is working fine in richfaces 3.3.3

       

      public class DataHolderTreeNodeImpl extends TreeNodeImpl{
      
       private Object data;
        private TreeNode parent;
      
        public DataHolderTreeNodeImpl() {
            super();
        }
      
        public DataHolderTreeNodeImpl(boolean leaf, Object data) {
            super(leaf);
            this.data = data;
        }
      
        public Object getData() {
            return data;
        }
      
        public final void setData(Object data) {
           this.data = data;
        }
      
        public final TreeNode getParent() {
            return parent;
        }
      
      
        public final void setParent(TreeNode parent) {
            this.parent = parent;
        }
      
        public Iterator getChildren(){
            return getChildrenKeysIterator();
        }
      }
      

       

      Here object data can be TreeNodeData or XMLTreenodeData

       

      public class TreeNodeData {
      
        //The node type indication ( shelf/slot/card..);
        private String classType = "";
        // can represent PKId of the instance of classtype
        private String id = "";
        //Indicates the type of the node such as edit/list/nonavigation
        private String type = "navigate";
        //Display Name in the tree
        private String name = "";
        //PkId field in the database. Used to for traverse the page from the Tree.
        private String pkIdName = "";
        //Table Name of the Node data if present.
        private String tableName = "";
      
        public String getPkIdName() {
        return pkIdName;
        }
      
      
        public void setPkIdName(String pkIdName) {
        this.pkIdName = pkIdName;
        }
      
        public String getTableName() {
        return tableName;
        }
      
        public void setTableName(String tableName) {
        this.tableName = tableName;
        }
      
        public TreeNodeData(String classType, String id, String type, String name) {
        setClassType(classType);
        setId(id);
        setType(type);
        setName(name);
        }
      
        public TreeNodeData() {
        // TODO Auto-generated constructor stub
        }
      
        public String getName() {
        return name;
        }
      
        public void setName(String name) {
        this.name = name;
        }
      
        public String getType() {
        return type;
        }
        public void setType(String type) {
        this.type = type;
        }
      
        public String getClassType() {
        return classType;
        }
      
        public void setClassType(String classType) {
        this.classType = classType;
        }
      
        public String getId() {
        return id;
        }
      
        public void setId(String id) {
        this.id = id;
        }
      }
      

       

      Xhtml tag:

       

      <rich:tree toggleType="ajax"  binding="#{platformTreeBean.richTree}"
                        value="#{platformTreeBean.treeNode}" 
                        var="item" iconCollapsed ="/img/tree_folder.gif"
                        iconLeaf="/img/application.gif"
                        iconExpanded ="/img/tree_folder.gif" id="platTreeId"
                        toggleListener ="#{platformTreeBean.processExpansion}"
                        >
                       
                      <rich:treeNode type="root">
                      <s:link view="/ServersList.xhtml" target="platTreeActionFrame">
                      <f:param name="nodeValue"  value="#{item.name}"/>
                              <h:outputText value="#{item.name}"></h:outputText>
                      </s:link>
                      </rich:treeNode>
      </rich:tree>