ICEfaces
  1. ICEfaces
  2. ICE-10857

Enhance the implementation of LazyNodeDataModel to support reordering

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.1, EE-3.3.0.GA_P04
    • Fix Version/s: 4.3
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces4 trunk r46245/ EE-3.3.0-maintenance branch r46245
      Browsers: all
      Server: Tomcat7
    • Assignee Priority:
      P2

      Description

      Trying to re-order nodes on the test using the lazy data model (/ICE-10723-lazy.jsf) results in either an UnsupportedOperationException, or an IndexOutOfBoundException, depending on the node being dragged.

      QA test app for ace:tree: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Nightly/tree
      Test page: /ICE-10723-lazy.jsf


      Nov 19, 2015 2:35:05 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
      SEVERE: java.lang.UnsupportedOperationException
          at org.icefaces.ace.model.tree.NodeDataModel.insert(NodeDataModel.java:77)
          at org.icefaces.ace.component.tree.Tree.insertNode(Tree.java:98)
          at org.icefaces.ace.component.tree.TreeDecoder.decodeReordering(TreeDecoder.java:86)
          at org.icefaces.ace.component.tree.TreeDecoder.decode(TreeDecoder.java:66)
          at org.icefaces.ace.component.tree.TreeRenderer$1.<init>(TreeRenderer.java:64)
          at org.icefaces.ace.component.tree.TreeRenderer.decode(TreeRenderer.java:63)
          at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:832)
          at org.icefaces.ace.component.tree.Tree.processDecodes(Tree.java:299)
          at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:573)
          at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
          at org.icefaces.ace.component.tree.Tree.visitTree(Tree.java:392)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIForm.visitTree(UIForm.java:371)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403)
          at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266)
          at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
          at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:322)
          at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
          at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:927)
          at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)


      Nov 19, 2015 2:34:38 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
      SEVERE: java.lang.IndexOutOfBoundsException: Index: 0
          at java.util.Collections$EmptyList.get(Collections.java:3212)
          at org.icefaces.ace.model.tree.LazyNodeDataModel.navToChild(LazyNodeDataModel.java:100)
          at org.icefaces.ace.model.tree.LazyNodeDataModel.navToKey(LazyNodeDataModel.java:72)
          at org.icefaces.ace.component.tree.Tree.setNodeToKey(Tree.java:157)
          at org.icefaces.ace.component.tree.Tree.setKey(Tree.java:125)
          at org.icefaces.ace.component.tree.TreeDecoder.decodeReordering(TreeDecoder.java:84)
          at org.icefaces.ace.component.tree.TreeDecoder.decode(TreeDecoder.java:66)
          at org.icefaces.ace.component.tree.TreeRenderer$1.<init>(TreeRenderer.java:64)
          at org.icefaces.ace.component.tree.TreeRenderer.decode(TreeRenderer.java:63)
          at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:832)
          at org.icefaces.ace.component.tree.Tree.processDecodes(Tree.java:299)
          at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:573)
          at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
          at org.icefaces.ace.component.tree.Tree.visitTree(Tree.java:392)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIForm.visitTree(UIForm.java:371)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403)
          at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266)
          at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
          at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:322)
          at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
          at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:927)

        Activity

        Hide
        Arturo Zambrano added a comment -

        The reason why the exceptions above occur is because the implementation of LazyNodeDataModel in the test app simply doesn't support reordering. It was originally just a simple implementation for the showcase, which wasn't intended to demonstrate reordering in lazy trees.

        As mentioned in the wiki and in the TLD documentation, for using the ace:tree component in lazy mode, an implementation of LazyNodeDataModel (an abstract class) should be provided. However, the kind of exceptions as the ones reported in this JIRA are likely to happen in many scenarios, since the only abstract method to implement is loadChildrenForNode(). Once, this is done, the app developer may think that this is all what needs to be done. However, there are some other methods that throw an UnsupportedOperationException exception if they aren't overriden, as in the case of insert(). So, in order to support reordering (and other features) in a lazy tree, certain methods have to be implemented that suit the specific tree on the page or application.

        I'm editing this JIRA to change its type from bug to improvement. The improvements that need to be made are the following:
        1. Create an implementation of LazyNodeDataModel that supports reordering, for the showcase and test apps.
        2. Improve the documentation in the wiki and in the TLD to explain what needs to be done to support certain features of the ace:tree component in lazy mode.

        Show
        Arturo Zambrano added a comment - The reason why the exceptions above occur is because the implementation of LazyNodeDataModel in the test app simply doesn't support reordering. It was originally just a simple implementation for the showcase, which wasn't intended to demonstrate reordering in lazy trees. As mentioned in the wiki and in the TLD documentation, for using the ace:tree component in lazy mode, an implementation of LazyNodeDataModel (an abstract class) should be provided. However, the kind of exceptions as the ones reported in this JIRA are likely to happen in many scenarios, since the only abstract method to implement is loadChildrenForNode(). Once, this is done, the app developer may think that this is all what needs to be done. However, there are some other methods that throw an UnsupportedOperationException exception if they aren't overriden, as in the case of insert(). So, in order to support reordering (and other features) in a lazy tree, certain methods have to be implemented that suit the specific tree on the page or application. I'm editing this JIRA to change its type from bug to improvement. The improvements that need to be made are the following: 1. Create an implementation of LazyNodeDataModel that supports reordering, for the showcase and test apps. 2. Improve the documentation in the wiki and in the TLD to explain what needs to be done to support certain features of the ace:tree component in lazy mode.
        Hide
        Ken Fyten added a comment -

        Closing as Won't fix. Re-ordering tree nodes in a lazily loaded tree is not supported, hence the "Not Supported Exception". I added a note regarding this limitation to the Tree wiki page.

        Show
        Ken Fyten added a comment - Closing as Won't fix. Re-ordering tree nodes in a lazily loaded tree is not supported, hence the "Not Supported Exception". I added a note regarding this limitation to the Tree wiki page.
        Hide
        Ken Fyten added a comment -

        Re-opening to target to future release as an improvement.

        Show
        Ken Fyten added a comment - Re-opening to target to future release as an improvement.
        Hide
        Arturo Zambrano added a comment -

        After trying several approaches, it was impossible to support reordering on a lazy tree. The problem lies mainly in the navToKey() and navToChild() methods, which usually produce an IndexOutOfBoundsException when trying to reorder nodes. Like ListNodeDataModel, LazyNodeDataModel would need to have access to the tree roots within the same class in order to perform this and other operations, because of the inherent predictability required for an operation of this nature. Since, the tree roots are in an external source on a lazy tree, it's impossible to support these operations.

        Show
        Arturo Zambrano added a comment - After trying several approaches, it was impossible to support reordering on a lazy tree. The problem lies mainly in the navToKey() and navToChild() methods, which usually produce an IndexOutOfBoundsException when trying to reorder nodes. Like ListNodeDataModel, LazyNodeDataModel would need to have access to the tree roots within the same class in order to perform this and other operations, because of the inherent predictability required for an operation of this nature. Since, the tree roots are in an external source on a lazy tree, it's impossible to support these operations.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Carmen Cristurean
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: