Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1504

Update autoscroll feature to JSF 2

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.9
    • 1.1.10
    • JSF2
    • None

    Description

      In jsf 1.1. and 1.2, autoscroll behavior had the following problems:

      • It is myfaces specific feature, because requires add some code on renderers. In ri it will not work
      • It only works for h:commandXXX and t:commandXXX components, so if you use trinidad (override h:commandXXX renderers) it will not work.
      • Since it requires render some javascript at the end of <body> tag, it requires use DefaultAddResource or <t:documentBody>

      With jsf 2.0 we have the chance to get rid all this problems and make this feature work with other libraries.

      First a short review about this feature. To make it work, it requires the following points:

      • Render an <input type="hidden" name="autoScroll" /> that will contain the position on the page (x,y)
      • Render a function called getScrolling() ant the end of the page that calculate the value and optionally render the command that scroll.
      • Render the script on each link to call getScrolling() function and assign its value to the hidden field (using oamSetHiddenInput).

      The idea include add the following code:

      • Create a new client behavior tag called t:autoscroll that adds the script required on each "command" component.
      • Create a new component that just render the hidden field. It will be added as a component resource.
      • Create a new component that render autoScroll script. It will be added as a component resource.
      • Add some code on ResourceViewHandler, to add the two previous components to the component tree as transient each time the view is rendered, but only if org.apache.myfaces.AUTO_SCROLL web param is true or t:autoscroll is used on the current page.

      Now, the proposal will work in following scenarios like this:

      • org.apache.myfaces.AUTO_SCROLL is enabled, myfaces core is used, so all h:commandXXX and t:commandXXX works like in jsf 1.1 and jsf 1.2.
      • org.apache.myfaces.AUTO_SCROLL is disabled and myfaces core is used, hidden field and script will be added only if t:autoscroll is used. By default, h:commandXXX and t:commandXXX will not have autoscroll script, so t:autoscroll is required to add this script.
      • RI (Mojarra) is used, hidden field and script will be added only if t:autoscroll is used. By default, h:commandXXX and t:commandXXX will not have autoscroll script, so t:autoscroll is required to add this script.

      Attachments

        1. TOMAHAWK-1504-1.patch
          26 kB
          Leonardo Uribe

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              lu4242 Leonardo Uribe
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: