9 Replies Latest reply on Mar 11, 2011 8:19 AM by codo

    RF 4 CR1: implementing and binding org.richfaces.model.TreeNode and org.richfaces.model.TreeDataModel in rich:tree

    codo Newbie

      Hello,

       

      I'm trying to build a richfaces tree. When I implement the interface javax.swing.tree.TreeNode and bind it to the attribute "value" in rich:tree it works just fine. But when I implement org.richfaces.model.TreeNode or org.richfaces.model.TreeDataModel it doesn't work. It throws exception:

       

      java.lang.IllegalArgumentException: org.richfaces.model.TreeNodeImpl@3f26cfe8

              at org.richfaces.model.SwingTreeNodeDataModelImpl.createFakeRootNode(SwingTreeNodeDataModelImpl.java:58)

              at org.richfaces.model.SwingTreeNodeDataModelImpl.setWrappedData(SwingTreeNodeDataModelImpl.java:69)

              at org.richfaces.component.AbstractTree.createExtendedDataModel(AbstractTree.java:478)

              at org.richfaces.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:462)

              at org.richfaces.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:277)

              at org.richfaces.renderkit.TreeEncoderFull.encode(TreeEncoderFull.java:41)

              at org.richfaces.renderkit.TreeRendererBase.encodeTree(TreeRendererBase.java:92)

              at org.richfaces.renderkit.html.TreeRenderer.encodeChildren(TreeRenderer.java:128)

              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

              at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

              at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)

              at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)

              at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)

              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)

              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

              at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)

              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)

              at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)

              at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)

              at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)

              at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)

              at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)

              at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)

              at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)

              at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)

              at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)

              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)

              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)

              at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)

              at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)

              at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)

              at com.sun.grizzly.ContextTask.run(ContextTask.java:69)

              at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)

              at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)

              at java.lang.Thread.run(Thread.java:662)

       

      Is this a bug or I'm doing something wrong?

        • 2. RF 4 CR1: implementing and binding org.richfaces.model.TreeNode and org.richfaces.model.TreeDataModel in rich:tree
          codo Newbie

          Ok, I made project with simple demo of using the three models.

           

          Here is the first one, implementing org.richfaces.model.TreeNode:

           

          The Model:

           

          package model;

           

          import entities.Picture;

          import java.io.Serializable;

          import java.util.ArrayList;

          import java.util.HashMap;

          import java.util.Iterator;

          import java.util.List;

          import java.util.Map;

          import org.richfaces.model.TreeNode;

           

          public class MyRFTreeNode implements TreeNode, Serializable {

           

              private Picture data;

              private List<Object> keyList = new ArrayList<Object>();

              private Map<Object, TreeNode> children = new HashMap<Object, TreeNode>();

              private MyRFTreeNode parent;

           

              public MyRFTreeNode() {

                  this.data = new Picture("Root", null);

              }

           

              public MyRFTreeNode(Picture data) {

                  this.data = data;

              }

           

              @Override

              public TreeNode getChild(Object o) {

                  return children.get(o);

              }

           

              @Override

              public int indexOf(Object o) {

                  return keyList.indexOf(o);

              }

           

              @Override

              public Iterator<Object> getChildrenKeysIterator() {

                  return keyList.iterator();

              }

           

              @Override

              public boolean isLeaf() {

                  return false;

              }

           

              @Override

              public void addChild(Object o, TreeNode tn) {

                  children.put(o, tn);

                  keyList.add(o);

                  ((MyRFTreeNode) tn).setParent(this);

              }

           

              @Override

              public void insertChild(int i, Object o, TreeNode tn) {

                  addChild(o, tn);

              }

           

              @Override

              public void removeChild(Object o) {

                  children.remove(o);

                  keyList.remove(o);

              }

           

              public void setParent(MyRFTreeNode parent) {

                  this.parent = parent;

              }

           

              public Picture getData() {

                  return data;

              }

           

              public MyRFTreeNode getParent() {

                  return parent;

              }

           

          }

           

          The managed bean:

           

          package beans;

           

          import entities.Picture;

          import javax.faces.bean.ManagedBean;

          import javax.faces.bean.RequestScoped;

          import model.MyRFTreeNode;

           

          @ManagedBean

          @RequestScoped

          public class TreeBeanRFTreeNode {

           

              private MyRFTreeNode root;

           

              public TreeBeanRFTreeNode() {

                  root = new MyRFTreeNode();

                  MyRFTreeNode node1 = new MyRFTreeNode(new Picture("picture1", "Description1"));

                  MyRFTreeNode node2 = new MyRFTreeNode(new Picture("picture2", "Description2"));

                  MyRFTreeNode node3 = new MyRFTreeNode(new Picture("picture3", "Description3"));

           

                  root.addChild(1, node1);

                  root.addChild(2, node2);

                  root.addChild(3, node3);

           

                  MyRFTreeNode node11 = new MyRFTreeNode(new Picture("picture11", "Description11"));

                  MyRFTreeNode node12 = new MyRFTreeNode(new Picture("picture12", "Description12"));

                  MyRFTreeNode node13 = new MyRFTreeNode(new Picture("picture13", "Description13"));

           

                  node1.addChild(11, node11);

                  node1.addChild(12, node12);

                  node1.addChild(13, node13);

              }

           

              public MyRFTreeNode getRoot() {

                  return root;

              }

          }

           

          The xhtml:

           

          <?xml version='1.0' encoding='UTF-8' ?>

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

          <html xmlns="http://www.w3.org/1999/xhtml"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:ui="http://java.sun.com/jsf/facelets"

                xmlns:rich="http://richfaces.org/rich">

           

           

              <h:body>

                  <ui:composition template="./skeleton.xhtml">

                      <ui:define name="head">

                      </ui:define>

                      <ui:define name="top">

                      </ui:define>

                      <ui:define name="content">

                          <h:form id="form_main_tree">

                              <rich:tree value="#{treeBeanRFTreeNode.root}" var="item">

                                  <rich:treeNode>

                                          <h:outputText value="#{item.data.name}"/>

                                  </rich:treeNode>

                              </rich:tree>

                          </h:form>

                      </ui:define>

                  </ui:composition>

              </h:body>

          </html>

           

          The output:

           

          java.lang.IllegalArgumentException: model.MyRFTreeNode@632986d4

                  at org.richfaces.model.SwingTreeNodeDataModelImpl.createFakeRootNode(SwingTreeNodeDataModelImpl.java:58)

                  at org.richfaces.model.SwingTreeNodeDataModelImpl.setWrappedData(SwingTreeNodeDataModelImpl.java:69)

                  at org.richfaces.component.AbstractTree.createExtendedDataModel(AbstractTree.java:478)

                  at org.richfaces.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:462)

                  at org.richfaces.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:277)

                  at org.richfaces.renderkit.TreeEncoderFull.encode(TreeEncoderFull.java:41)

                  at org.richfaces.renderkit.TreeRendererBase.encodeTree(TreeRendererBase.java:92)

                  at org.richfaces.renderkit.html.TreeRenderer.encodeChildren(TreeRenderer.java:128)

                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

                  at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

                  at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)

                  at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)

                  at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)

                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)

                  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

                  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

                  at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)

                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)

                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)

                  at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)

                  at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)

                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)

                  at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)

                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)

                  at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)

                  at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)

                  at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)

                  at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)

                  at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)

                  at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)

                  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)

                  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)

                  at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)

                  at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)

                  at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)

                  at com.sun.grizzly.ContextTask.run(ContextTask.java:69)

                  at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)

                  at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)

                  at java.lang.Thread.run(Thread.java:662)

           

          Here is the second one, implementing org.richfaces.model.TreeDataModel:

           

          The Model:

           

          package model;

           

          import entities.Picture;

          import java.io.Serializable;

          import java.util.ArrayList;

          import java.util.Iterator;

          import java.util.List;

          import javax.faces.convert.Converter;

          import org.richfaces.model.TreeDataModel;

          import org.richfaces.model.TreeDataModelTuple;

           

          public class MyRFTreeDataModel implements TreeDataModel<Picture>, Serializable {

           

              private Picture data;

              private Object rowKey;

              private List<TreeDataModelTuple> children = new ArrayList<TreeDataModelTuple>();

              private MyRFTreeDataModel parent;

           

              public MyRFTreeDataModel() {

                  this.data = new Picture("Root", null);

              }

           

              public MyRFTreeDataModel(Object rowKey, Picture data, MyRFTreeDataModel parent) {

                  this.rowKey = rowKey;

                  this.data = data;

                  this.parent = parent;

                  this.parent.addChild(new TreeDataModelTuple(rowKey, data));

              }

           

              @Override

              public Object getRowKey() {

                  return rowKey;

              }

           

              @Override

              public void setRowKey(Object o) {

                  this.rowKey = o;

              }

           

              @Override

              public boolean isDataAvailable() {

                  return true;

              }

           

              @Override

              public boolean isLeaf() {

                  return false;

              }

           

              @Override

              public Picture getData() {

                  return data;

              }

           

              @Override

              public Iterator<TreeDataModelTuple> children() {

                  return children.iterator();

              }

           

              @Override

              public Object getParentRowKey(Object o) {

                  return parent.getRowKey();

              }

           

              @Override

              public Object getWrappedData() {

                  // I don't really know how to use this wrapped data

                  return data;

              }

           

              @Override

              public void setWrappedData(Object o) {

                  // I don't really know how to use this wrapped data

                  data = (Picture) o;

              }

           

              @Override

              public TreeDataModelTuple createSnapshot() {

                  // I don't really know how to use this snapshot

                  return new TreeDataModelTuple(rowKey, data);

              }

           

              @Override

              public void restoreFromSnapshot(TreeDataModelTuple tdmt) {

                  // I don't really know how to use this snapshot

                  rowKey = tdmt.getRowKey();

                  data = (Picture) tdmt.getData();

              }

           

              @Override

              public Converter getRowKeyConverter() {

                  throw new UnsupportedOperationException("Not supported yet.");

              }

           

              public void addChild(TreeDataModelTuple tdmt) {

                  children.add(tdmt);

              }

             

          }

           

          The managed bean:

           

          /*

          * To change this template, choose Tools | Templates

          * and open the template in the editor.

          */

           

          package beans;

           

          import entities.Picture;

          import javax.faces.bean.ManagedBean;

          import javax.faces.bean.RequestScoped;

          import model.MyRFTreeDataModel;

           

          @ManagedBean

          @RequestScoped

          public class TreeBeanRFTreeDataModel {

           

              private MyRFTreeDataModel root;

           

              public TreeBeanRFTreeDataModel() {

                  root = new MyRFTreeDataModel();

                  MyRFTreeDataModel node1 = new MyRFTreeDataModel(1, new Picture("picture1", "Description1"), root);

                  MyRFTreeDataModel node2 = new MyRFTreeDataModel(2, new Picture("picture2", "Description2"), root);

                  MyRFTreeDataModel node3 = new MyRFTreeDataModel(3, new Picture("picture3", "Description3"), root);

           

                  MyRFTreeDataModel node11 = new MyRFTreeDataModel(11, new Picture("picture11", "Description11"), node1);

                  MyRFTreeDataModel node12 = new MyRFTreeDataModel(12, new Picture("picture12", "Description12"), node1);

                  MyRFTreeDataModel node13 = new MyRFTreeDataModel(13, new Picture("picture13", "Description13"), node1);

              }

           

              public MyRFTreeDataModel getRoot() {

                  return root;

              }

           

          }

           

          The xhtml:

           

          <?xml version='1.0' encoding='UTF-8' ?>

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

          <html xmlns="http://www.w3.org/1999/xhtml"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:ui="http://java.sun.com/jsf/facelets"

                xmlns:rich="http://richfaces.org/rich">

           

              <h:body>

                  <ui:composition template="./skeleton.xhtml">

                      <ui:define name="head">

                      </ui:define>

                      <ui:define name="top">

                      </ui:define>

                      <ui:define name="content">

                          <h:form id="form_main_tree">

                              <rich:tree value="#{treeBeanRFTreeDataModel.root}" var="item">

                                  <rich:treeNode>

                                          <h:outputText value="#{item.data.name}"/>

                                  </rich:treeNode>

                              </rich:tree>

                          </h:form>

                      </ui:define>

                  </ui:composition>

              </h:body>

          </html>

           

          The output:

           

          java.lang.IllegalArgumentException: model.MyRFTreeDataModel@139db084

                  at org.richfaces.model.SwingTreeNodeDataModelImpl.createFakeRootNode(SwingTreeNodeDataModelImpl.java:58)

                  at org.richfaces.model.SwingTreeNodeDataModelImpl.setWrappedData(SwingTreeNodeDataModelImpl.java:69)

                  at org.richfaces.component.AbstractTree.createExtendedDataModel(AbstractTree.java:478)

                  at org.richfaces.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:462)

                  at org.richfaces.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:277)

                  at org.richfaces.renderkit.TreeEncoderFull.encode(TreeEncoderFull.java:41)

                  at org.richfaces.renderkit.TreeRendererBase.encodeTree(TreeRendererBase.java:92)

                  at org.richfaces.renderkit.html.TreeRenderer.encodeChildren(TreeRenderer.java:128)

                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

                  at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

                  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

                  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

                  at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)

                  at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)

                  at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)

                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)

                  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

                  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

                  at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)

                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)

                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)

                  at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)

                  at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)

                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)

                  at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)

                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)

                  at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)

                  at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)

                  at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)

                  at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)

                  at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)

                  at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)

                  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)

                  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)

                  at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)

                  at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)

                  at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)

                  at com.sun.grizzly.ContextTask.run(ContextTask.java:69)

                  at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)

                  at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)

                  at java.lang.Thread.run(Thread.java:662)

           

          Only implementing javax.swing.tree.TreeNode works for me (for now). I'll not paste the code because the post will be too long

          Waiting for your answer.

           

          Greetings

          • 4. RF 4 CR1: implementing and binding org.richfaces.model.TreeNode and org.richfaces.model.TreeDataModel in rich:tree
            codo Newbie

            Hello,

             

            I'm using WAR.

             

            Btw in my managed bean I changed the type of "root" property from MyRFTreeNode to List<MyRFTreeNode> (I saw in your example that you are using List) and now the output is different:

             

            java.lang.ClassCastException: model.MyRFTreeNode cannot be cast to javax.swing.tree.TreeNode

                    at org.richfaces.model.SwingTreeNodeDataModelImpl.isLeaf(SwingTreeNodeDataModelImpl.java:87)

                    at org.richfaces.component.AbstractTree.isLeaf(AbstractTree.java:446)

                    at org.richfaces.component.TreeRange.shouldIterateChildren(TreeRange.java:56)

                    at org.richfaces.component.AbstractTree.walkModelChildren(AbstractTree.java:505)

                    at org.richfaces.component.AbstractTree.walkModelChildren(AbstractTree.java:523)

                    at org.richfaces.component.AbstractTree.walkModel(AbstractTree.java:497)

                    at org.richfaces.renderkit.TreeEncoderBase.encodeTree(TreeEncoderBase.java:96)

                    at org.richfaces.renderkit.TreeEncoderFull.encode(TreeEncoderFull.java:42)

                    at org.richfaces.renderkit.TreeRendererBase.encodeTree(TreeRendererBase.java:92)

                    at org.richfaces.renderkit.html.TreeRenderer.encodeChildren(TreeRenderer.java:128)

                    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

                    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

                    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

                    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

                    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

                    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

                    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

                    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)

                    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)

                    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)

                    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)

                    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

                    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

                    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)

                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)

                    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)

                    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)

                    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)

                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)

                    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)

                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)

                    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)

                    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)

                    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)

                    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)

                    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)

                    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)

                    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)

                    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)

                    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)

                    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)

                    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)

                    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)

                    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)

                    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)

                    at java.lang.Thread.run(Thread.java:662)

            • 5. RF 4 CR1: implementing and binding org.richfaces.model.TreeNode and org.richfaces.model.TreeDataModel in rich:tree
              Nick Belaevski Master

              Looks like a bug - thanks for reporting! I've reopened RF-9718 to get this fixed.

              • 6. RF 4 CR1: implementing and binding org.richfaces.model.TreeNode and org.richfaces.model.TreeDataModel in rich:tree
                codo Newbie

                Hello,

                 

                I saw that bug 9718 is marked as resolved so I downloaded the nightly build from yesterday(10.3.2011) and tried my examples. The example which is using org.richfaces.model.TreeNode works now, but the other, using org.richfaces.model.TreeDataModel, doesn't work. It throws the same exception.

                • 7. RF 4 CR1: implementing and binding org.richfaces.model.TreeNode and org.richfaces.model.TreeDataModel in rich:tree
                  Nick Belaevski Master

                  Yup, that's what I missed to add - sorry. Reopened the issue and will add support now.