0 Replies Latest reply on Mar 18, 2009 7:55 AM by s.ceno

    RichFaces Tree Property 'type' not found for nodeFace.

      Hallo everybody.
      Before I posted this topic, I tried to find possibly related sollutions on this forum and internet with no success.

      I use richfaces in portlet environment, JBoss Portal 2.7.1 RichFaces 3.3.0GA and JSF 1.2 Facelets 1.1.1.4 and Spring 2.5 and have succesfully rendered default tree.

      I wanted to customize my nodes with custom icons,so I looked for example http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?tab=usage&cid=2364871

      If I hard code my nodeFace in the tree, I have no problem.

      I thought I add my nodeFace dinamically so I extended the TreeNodeImp and added new property type with it's Getter and Setter methods.

      public class CustomNodeType extends TreeNodeImpl{
      
       private String type;
      
       public CustomNodeType (){
       super();
       }
      
       public void setType(String type) {
       this.type = type;
       }
      
       public String getType() {
       return type;
       }
      
      }


      During the loading of the tree, I set the type of each node, dependent of my Data Object type I have to load on in the tree.


      In the xhtml I have the tree something like this:

      <rich:tree nodeSelectListener="#{treeProvider.selectNode}" reRender="selectedNode" ajaxSubmitSelection="true"
      switchType="ajax" treeNodeVar="treeNode" value="#{searchTreeProvider.rootNode}"
      var="item" ajaxKeys="#{null}"
      nodeFace="#{item.type}">
      
      
      <rich:treeNode id="id1" type="type1" iconLeaf="icon1.png"
      icon="icon1.png">
      <h:outputText id="idd1" value="#{item}" />
      </rich:treeNode>
      
       <rich:treeNode id="id2"
       type="type2" iconLeaf="icon2.png" icon="icon2.png">
      
      <h:outputText id="idd2" value="#{item}" />
      </rich:treeNode>
      
      </rich:tree>
      


      When running the App, the tree is rendered with it's first level nodes but with the default tree icons comming with RichFaces and when I click the node to expand, I get the following exception:

      javax.servlet.ServletException: javax.el.PropertyNotFoundException: /portlet/view.xhtml @78,35 nodeFace="#{item.type}": Property 'type' not found on type org.richfaces.model.TreeNodeImpl
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
       org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      


      as a root cause.

      I read in one other forum a suggestion that one should use rather the var="item" property the treeNodeVar="item" property of the tree component.

      I did it and it resulted with the same exception.

      I will appreciate any suggestion or redirection to another thread with similar problem.

      Thanx in advance