ICEfaces
  1. ICEfaces
  2. ICE-5231

Fully support the render attribute of f:ajax tag

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha1
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2.0 JSF 2.0
    • Workaround Exists:
      Yes
    • Workaround Description:
      Specify @all and let ICEfaces determine what needs to be executed/rendered

      Description

      The f:ajax tag allows attributes to determine which portions of a page should be executed and which should be rendered. ICEfaces should support the full range of both of these attributes. Since the attributes meaningfully apply to different parts of the JSF lifecycle (execute vs render), there are separate JIRAs for each part. This case applies to the render part of the lifecycle.

        Issue Links

          Activity

          Hide
          Ted Goddard added a comment -

          document.getElementById() looks reasonable to add to DOMResponseWriter, so I will prototype the JSF rendering aspect. This bug is slightly higher in priority now since many of the mojarra tests exercise this feature.

          Show
          Ted Goddard added a comment - document.getElementById() looks reasonable to add to DOMResponseWriter, so I will prototype the JSF rendering aspect. This bug is slightly higher in priority now since many of the mojarra tests exercise this feature.
          Hide
          Ted Goddard added a comment -

          An initial prototype for subtree rendering has been checked in.

          Support for document.getElementById() is provided by identifying the id attribute via

          Element.setIdAttributeNode()

          for attributes that are named "id".

          During partial rendering (isRenderAll() == false) the list of ids is "visited" with an encodeAll() in tree visitor callback. The first complication is that the new DOM is empty (the page has not been rendered yet). This is resolved by cloning the old DOM. When a component is partially rendered, the previous subtree is replaced with an empty version; the problem with this, is that the first action of the component is to render the root of the subtree. To suppress this, a flag is set that suppresses the next startElement().

          To improve this implementation, the old DOM should not be cloned: it would be more efficient to keep the subtree fragments generated by the rendered components. As a feature improvement, it should be possible to specify whether a given subtree will have the DOM diff applied or not.

          Show
          Ted Goddard added a comment - An initial prototype for subtree rendering has been checked in. Support for document.getElementById() is provided by identifying the id attribute via Element.setIdAttributeNode() for attributes that are named "id". During partial rendering (isRenderAll() == false) the list of ids is "visited" with an encodeAll() in tree visitor callback. The first complication is that the new DOM is empty (the page has not been rendered yet). This is resolved by cloning the old DOM. When a component is partially rendered, the previous subtree is replaced with an empty version; the problem with this, is that the first action of the component is to render the root of the subtree. To suppress this, a flag is set that suppresses the next startElement(). To improve this implementation, the old DOM should not be cloned: it would be more efficient to keep the subtree fragments generated by the rendered components. As a feature improvement, it should be possible to specify whether a given subtree will have the DOM diff applied or not.
          Hide
          Ted Goddard added a comment -

          Implementation note: it is not necessary to clone the DOM. When partial rendering is used, the replaced fragments of the old DOM can be retained. Modification of the old DOM in-place can be used to create the new DOM. The diff can then be run against the retained fragments.

          Show
          Ted Goddard added a comment - Implementation note: it is not necessary to clone the DOM. When partial rendering is used, the replaced fragments of the old DOM can be retained. Modification of the old DOM in-place can be used to create the new DOM. The diff can then be run against the retained fragments.
          Hide
          Ted Goddard added a comment -

          The diff is now being applied to just the rendered subtrees:

          If isRenderAll() is false, the DOMResponseWriter is flagged for subtree rendering, and uses the old DOM as the current DOM
          For each component subtree render, the existing DOM subtree is removed and the new subtree is rendered in its place
          The diff is calculated against the recently removed subtree

          The assumption is that a given component will render a rooted subtree of markup. Component rendering behavior other than this (such as rendering two elements, or rendering a new element without an ID) would result in an empty or malformed diff result.

          The basic sample has been enhanced to include icefaces-subtree.jsf (with both execute and render directives). The ICEfaces pages now also include a timestamp to show which part of the page is updated. For icefaces.jsf, the timestamp is always updated because the full page is rendered. For icefaces-subtree.jsf, the timestamp is not updated because it is not included in the render directive.

          Show
          Ted Goddard added a comment - The diff is now being applied to just the rendered subtrees: If isRenderAll() is false, the DOMResponseWriter is flagged for subtree rendering, and uses the old DOM as the current DOM For each component subtree render, the existing DOM subtree is removed and the new subtree is rendered in its place The diff is calculated against the recently removed subtree The assumption is that a given component will render a rooted subtree of markup. Component rendering behavior other than this (such as rendering two elements, or rendering a new element without an ID) would result in an empty or malformed diff result. The basic sample has been enhanced to include icefaces-subtree.jsf (with both execute and render directives). The ICEfaces pages now also include a timestamp to show which part of the page is updated. For icefaces.jsf, the timestamp is always updated because the full page is rendered. For icefaces-subtree.jsf, the timestamp is not updated because it is not included in the render directive.
          Hide
          Ted Goddard added a comment -

          This feature is now implemented.

          Testing of pathological cases would be useful (such as render directives for non-existant or overlapping IDs), however, we must compare the ICEfaces failure in these cases to the stock JSF failure).

          It is recommended that developers use <f:ajax> render directives only as a last resort for performance optimization, as stale render directives will result in pages that are extremely difficult to maintain.

          Show
          Ted Goddard added a comment - This feature is now implemented. Testing of pathological cases would be useful (such as render directives for non-existant or overlapping IDs), however, we must compare the ICEfaces failure in these cases to the stock JSF failure). It is recommended that developers use <f:ajax> render directives only as a last resort for performance optimization, as stale render directives will result in pages that are extremely difficult to maintain.

            People

            • Assignee:
              Ted Goddard
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: