Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-126

Reverse ordering/exceution of page render phase methods (afterXXX and cleanupRender) incorrect when short-circuiting

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • Tapestry 5.0.6-SNAPSHOT

    Description

      ComponentPageElementImpl is responsible for calling the render
      phase methods of the components. It calls the setupRender method
      on the attached Mixins then the components and then the Mixins that
      have a @MixinAfter annotation. If in this phase the setupRender of a
      Mixin returns a boolean value that will be saved into the Event object and
      in case of a "false" the setupRender calls of the subsequent components
      will be aborted.

      During the "inverse" lifecycle the order is simply reversed and the render
      phase method of the Mixin with @MixinAfter annotation is called, then
      the render phase method of the component and then the method of the
      Mixin is called. The problem is now that the "inverse" render phase
      methods are getting called without checking whether the corresponding
      other render phase methods have been executed.

      So in my case the cleanupRender method of the Form component gets
      called although i have short-circuited the beginRender method with my
      Mixin because there is no state available that indicates that the beginRender
      method of the Form component has NOT been executed.

      private void invoke(boolean reverse, ComponentCallback callback)
      {
      ....
      Iterator<Component> i = reverse ?
      InternalUtils.reverseIterator(_components)
      : _components.iterator();

      while (i.hasNext())
      callback.run(i.next());

      A possible solution would be to create a List that contains those
      components whose render phase methods really have been
      executed. This list is then used in the "inverse" lifecycle.

      see also:
      http://www.nabble.com/T5%3A-Mixin-on-Form-does-not-work-as-expected-tf4562001.html
      http://www.nabble.com/T5%3A-Mixin-on-Form-does-not-work-as-expected-tf4562724.html

      Attachments

        1. jira1805sample.tgz
          8 kB
          Robert Zeigler

        Activity

          People

            hlship Howard Lewis Ship
            kristian Kristian Marinkovic
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: