4 Replies Latest reply on May 16, 2011 8:25 AM by Paolo Proni

    Error while removing a node out of a tree

    Peter Schütt Newbie

      Hallo,

      I get the appending exception when I remove a tree node out of the tree.

       

      I call via commandLink a delete-method in my controller bean which removes a node out of the tree model.

      When I refresh the browser I see the delete-Action was successful.

       

       

       

      The tree has this structure:

       

      <rich:tree id="processPackageTree" toggleType="ajax" ajaxSubmitSelection="true" var="item">

                      <rich:treeModelAdaptor nodes="#{allProcessDefsBean.allReleaseContainerDefList}" toggleType="client" >

       

                          <rich:treeNode iconLeaf="#{item.used ? '/web/img/package_used.png' : '/images/process/package.png'}"

                                         iconExpanded="#{item.used ? '/web/img/package_used.png' : '/images/process/package.png'}"

                                         iconCollapsed="#{item.used ? '/web/img/package_used.png' : '/images/process/package.png'}">

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

                          </rich:treeNode>

       

                          <rich:treeModelAdaptor id="releaseDef" nodes="#{item.releaseDefs}">

                              <rich:treeNode iconLeaf="#{item.used ? '/web/img/release_used.png' : '/images/process/release.png'}"

                                             iconExpanded="#{item.used ? '/web/img/release_used.png' : '/images/process/release.png'}"

                                             iconCollapsed="#{item.used ? '/web/img/release_used.png' : '/images/process/release.png'}">

                                  <a4j:commandLink action="#{allProcessDefsBean.releaseNodeClick}" render="processReleaseInfoPanel, processButtonPanel" immediate="true">

                                      <a4j:param name="packageDefId" value="#{item.owner.id}" assignTo="#{allProcessDefsBean.currentReleaseContainerDefId}"/>

                                      <a4j:param name="releaseDefId" value="#{item.id}" assignTo="#{allProcessDefsBean.currentReleaseDefId}"/>

                                      <h:outputText value="#{item.fromDate}">

                                          <f:convertDateTime type="date" dateStyle="medium" timeZone="#{allProcessDefsBean.timeZone}"/>

                                      </h:outputText>

                                  </a4j:commandLink>

                              </rich:treeNode>

       

                              <rich:treeModelAdaptor id="subNode" nodes="#{item.nodes}">

                                  <rich:treeNode >

                                      <a4j:commandLink action="#{allProcessDefsBean.subNodeClick}" render="processReleaseInfoPanel, processButtonPanel" immediate="true">

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

       

                                      </a4j:commandLink>

                                  </rich:treeNode>

      ...

       

      The delete-method:

       

                      <a4j:commandLink id="processPackageDefReleaseDelete" action="#{allProcessDefsBean.deleteRelease}"

                                       render="processPackageTree,processReleaseInfoPanel,messages,processButtonPanel" rendered="#{allProcessDefsBean.currentReleaseDef != null}">

                          <h:outputFormat value="#{dr.defs_all_delete_release_definition}" >

                              <f:param value="#{allProcessDefsBean.currentReleaseContainerDef.name}"/>

                              <f:param value="#{allProcessDefsBean.currentReleaseDef.fromDate}"/>

                          </h:outputFormat>

                      </a4j:commandLink>

       

       

      This exceptions was written to the log file:

       

      21.04.2011 14:25:42 org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback logException

      SCHWERWIEGEND: Index: 1, Size: 1

      java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

              at java.util.ArrayList.RangeCheck(ArrayList.java:547)

              at java.util.ArrayList.get(ArrayList.java:322)

              at com.google.common.collect.Iterables.get(Iterables.java:634)

              at org.richfaces.component.DeclarativeTreeDataModelWalker.setupDataModelContext(DeclarativeTreeDataModelWalker.java:86)

              at org.richfaces.component.DeclarativeTreeDataModelWalker.walk(DeclarativeTreeDataModelWalker.java:123)

              at org.richfaces.model.DeclarativeTreeDataModelImpl.setupKey(DeclarativeTreeDataModelImpl.java:105)

              at org.richfaces.model.TreeSequenceKeyModel.setRowKey(TreeSequenceKeyModel.java:49)

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

              at org.richfaces.renderkit.TreeRendererBase.encodeSelectionStateInput(TreeRendererBase.java:131)

              at org.richfaces.renderkit.html.TreeRenderer.encodeEnd(TreeRenderer.java:145)

              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:883)

              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)

              at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)

              at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)

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

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

              at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:278)

              at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:58)

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

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

              at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:278)

              at org.richfaces.renderkit.html.TogglePanelItemRenderer.doEncodeChildren(TogglePanelItemRenderer.java:132)

              at org.richfaces.renderkit.html.TabRenderer.doEncodeChildren(TabRenderer.java:110)

              at org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157)

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

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

              at org.richfaces.renderkit.html.TogglePanelRenderer.encodeMetaComponent(TogglePanelRenderer.java:192)

              at org.richfaces.component.AbstractTogglePanel.encodeMetaComponent(AbstractTogglePanel.java:699)

              at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:503)

              at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:337)

              at org.richfaces.context.ExtendedVisitContext.invokeMetaComponentVisitCallback(ExtendedVisitContext.java:72)

              at org.richfaces.component.AbstractTogglePanel.visitTree(AbstractTogglePanel.java:723)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at org.richfaces.component.AbstractTogglePanel.visitTree(AbstractTogglePanel.java:735)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIForm.visitTree(UIForm.java:335)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:284)

              at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:206)

              at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:974)

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

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

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

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

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

              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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at com.timocom.process.web.settings.LocaleRequestFilter.doFilter(LocaleRequestFilter.java:67)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)

              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)

              at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

              at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

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

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

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

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

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

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)

              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

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

      21.04.2011 14:25:42 com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException

      SCHWERWIEGEND: Error Rendering View[/web/index.xhtml]

      java.lang.IllegalStateException: CDATA tags may not nest

              at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.startCDATA(HtmlResponseWriter.java:630)

              at javax.faces.context.ResponseWriterWrapper.startCDATA(ResponseWriterWrapper.java:172)

              at javax.faces.context.PartialResponseWriter.startUpdate(PartialResponseWriter.java:205)

              at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:511)

              at org.richfaces.context.RenderExtendedVisitContext.invokeVisitCallbackForImplicitComponent(RenderExtendedVisitContext.java:71)

              at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:349)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1485)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIForm.visitTree(UIForm.java:335)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1496)

              at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:284)

              at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:206)

              at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:974)

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

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

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

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

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

              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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at com.timocom.process.web.settings.LocaleRequestFilter.doFilter(LocaleRequestFilter.java:67)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)

              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)

              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

              at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)

              at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

              at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

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

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

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

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

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

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)

              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

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

       

      Thanks for any hints.

       

      Ciao

        Peter Schütt

        • 1. Re: Error while removing a node out of a tree
          Anil Kumar Sadineni Newbie

          I am having same problem. I upgraded to RF 4. I have never seen this before in older versions of richfaces(3.x). Any clues ?

           

          Funcitonality I am trying to achieve is little different. I am trying to re-render the tree with different data in AJAX call when a4j:commandButton clicked.

           

          Here is exception -

           

          Caused by: java.lang.IndexOutOfBoundsException: index (1) must be less than size (0)

                    at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:301)

                    at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:280)

                    at com.google.common.collect.Iterables.get(Iterables.java:640)

                    at org.richfaces.component.DeclarativeTreeDataModelWalker.setupDataModelContext(DeclarativeTreeDataModelWalker.java:86)

                    at org.richfaces.component.DeclarativeTreeDataModelWalker.walk(DeclarativeTreeDataModelWalker.java:123)

                    at org.richfaces.model.DeclarativeTreeDataModelImpl.setupKey(DeclarativeTreeDataModelImpl.java:105)

                    at org.richfaces.model.TreeSequenceKeyModel.setRowKey(TreeSequenceKeyModel.java:49)

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

                    at org.richfaces.renderkit.TreeRendererBase.encodeSelectionStateInput(TreeRendererBase.java:131)

                    at org.richfaces.renderkit.html.TreeRenderer.encodeEnd(TreeRenderer.java:145)

                    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)

           

           

          Thanks in Advance for any solutions.

           

           

          Anil

          • 2. Re: Error while removing a node out of a tree
            Ilya Shaikovsky Master

            please add also model sources.

            • 3. Re: Error while removing a node out of a tree
              Anil Kumar Sadineni Newbie

              Below is my model object -

               

               

               

              import java.io.Serializable;
              import java.util.*;
              
              import com.google.common.collect.Iterators;
              import com.google.common.collect.Lists;
              import com.google.common.collect.Maps;
              import org.richfaces.model.TreeNode;
              
              
              import MRQuestion;
              
              
              public class MRTreeNode implements TreeNode, Serializable {
              
              
                  private static final long serialVersionUID = -1l;
              
              
                  /* code from TreeNodeImpl [START] */
                  private List<Object> keysList = null;
              
              
                  private Map<Object, TreeNode> children = null;
              
              
                  public MRTreeNode() {
                      this(false);
                  }
              
              
                  public MRTreeNode(boolean leaf) {
                      super();
                      this.leaf = leaf;
              
                      if (!leaf) {
                          keysList = Lists.newArrayList();
                          children = Maps.newHashMap();
                      }
                  }
              
              
                  public void addChild(Object key, TreeNode child) {
                      if (isLeaf()) {
                          throw new IllegalStateException("Cannot add children to leaf");
                      }
                      keysList.add(key);
                      children.put(key, child);
                  }
              
              
                  public void insertChild(int idx, Object key, TreeNode child) {
                      if (isLeaf()) {
                          throw new IllegalStateException("Cannot add children to leaf");
                      }
                      keysList.add(idx, key);
                      children.put(key, child);
                  }
              
              
                  public void removeChild(Object key) {
                      if (isLeaf()) {
                          return;
                      }
                      children.remove(key);
                      keysList.remove(key);
                  }
              
              
                  public TreeNode getChild(Object key) {
                      if (isLeaf()) {
                          return null;
                      }
                      return children.get(key);
                  }
              
              
                  public Iterator<Object> getChildrenKeysIterator() {
                      if (isLeaf()) {
                          return Iterators.emptyIterator();
                      }
                      return Iterators.unmodifiableIterator(keysList.iterator());
                  }
              
              
                  public int indexOf(Object key) {
                      if (isLeaf()) {
                          return -1;
                      }
                      return keysList.indexOf(key);
                  }
              
              
                  public boolean isLeaf() {
                      return leaf;
                  }
              
              
                        /* code from TreeNodeImpl [END] */
              
              
                        /* project specific code [START] */
                  public MRQuestion getData() {
                      return data;
                  }
              
              
                  public void setData(MRQuestion data) {
                      this.data = data;
                  }
              
              
                  public TreeNode getParent() {
                      return parent;
                  }
              
              
                  public void setParent(TreeNode parent) {
                      this.parent = parent;
                  }
              
              
                  public Iterator<Map.Entry<Object, TreeNode>> getChildren() {
                      return children.entrySet().iterator();
                  }
              
              
                  public Collection<TreeNode> getChildNodes() {
                      return children.values();
                  }
              
              
                  public boolean isTreeNodeOpen() {
                      return treeNodeOpen;
                  }
              
              
                  public void setTreeNodeOpen(boolean treeNodeOpen) {
                      this.treeNodeOpen = treeNodeOpen;
                  }
              
              
                  public String toString() {
                      return data.toString();
                  }
              
              
                  public boolean isExpanded() {
                      return true;
                  }
              
                  /** Node is MRQuestion type */
                  private MRQuestion data;
              
              
                  /** Parent object for backward traversal. */
                  private TreeNode parent;
              
              
                  private boolean leaf;
              
              
                  private boolean treeNodeOpen;
              }
              
              

               

               

              Thanks,

              Anil.

              • 4. Error while removing a node out of a tree
                Paolo Proni Newbie

                I have a similar problem, did you find any workaround? I think it is a bug of the library.