Tapestry
  1. Tapestry
  2. TAPESTRY-545

Hook into the rendering process for AJAX improvement

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: Framework
    • Labels:
      None

      Description

      I added this feature request in the hope, that we might find a solution on how to simplify the AJAX support in tapestry.
      It currently requires a special "Part" component which exchanges its markupwriter during rendering. As all components not contained in such a "Part" use a Nullwriter, this approach allows to only render specified components.

      The disadvantage with this is, that the part component is absolutely required. It would be much nicer if all components could be marked as "to be rendered".

      For a discussion which approaches are possible see http://thread.gmane.org/gmane.comp.jakarta.tapestry.devel/6734

      At the end I can only see one possibility (or maybe two, but the second one is dirty):

      -add a wrapMethodImplementation(Class,MethodSignature,String,String) method to the EnhancementOperation interface which allows to do kind of AOP magic to the renderComponent method of each component. This would allow to switch the markupwriter in all renderComponent methods of all components.

      the disadvantage: the enhancementworker who does this must come very late in the chain. Otherwise other enhancementworkers could add code before or after the wrapped code.

      -the dirty one: using a little enhancement for the prepareforRender method in combination with threadlocals, the partialservice and a special markupwriter could achieve the same. But this would require to make the markupwriter more clever than it should be. not nice.

      As already mentioned in the e-mail discussion: I can't see any other possibilities. But maybe someone else?

        Activity

        Hide
        Jesse Kuhnert added a comment -

        This is already handleable via the EnhancementWorker chain logic in hivemind. A better solution should hopefully come out in the 4.1 release.

        Show
        Jesse Kuhnert added a comment - This is already handleable via the EnhancementWorker chain logic in hivemind. A better solution should hopefully come out in the 4.1 release.
        Hide
        Jesse Kuhnert added a comment -

        Not that this is the right way at all, but for a clearer picture of what sort of problems are being placed, take a look at http://cvs.sourceforge.net/viewcvs.py/tacos/tacos4/src/net/sf/tacos/partial/?only_with_tag=prototype-ajax

        Anything starting with the word Ajax in that particular directory are some of the things being dealt with...

        It would be nice to eliminate the need for a new EngineService as well, but then how do you pass in the "id"s of the components that you need refreshed "globally"? Can IRequestCycle steal a particular set of parameters and kind of do it automatically?

        The implementation listed above is using jwcid Component id's when they are provided, and if not, it tries to use the html id="" attribute specified on the component.

        Show
        Jesse Kuhnert added a comment - Not that this is the right way at all, but for a clearer picture of what sort of problems are being placed, take a look at http://cvs.sourceforge.net/viewcvs.py/tacos/tacos4/src/net/sf/tacos/partial/?only_with_tag=prototype-ajax Anything starting with the word Ajax in that particular directory are some of the things being dealt with... It would be nice to eliminate the need for a new EngineService as well, but then how do you pass in the "id"s of the components that you need refreshed "globally"? Can IRequestCycle steal a particular set of parameters and kind of do it automatically? The implementation listed above is using jwcid Component id's when they are provided, and if not, it tries to use the html id="" attribute specified on the component.
        Hide
        Jesse Kuhnert added a comment -

        Not wanting to butt in or anything....but this would seem to only get us halfway there. The ability to call renderComponent on a specific component I think is already there, though you do have to write some sort of engine service to control how to pass in the writer.

        I think the ideal scnerio would be :

        -) A way to add behaviour to the render cycle which allows a contributed service to determine which IMarkupWriter any given component in the system is passed. This would mean some sort of interface that would pass in the IComponent instance itself to the check?

        OR

        The IPage suggestion you had would work, only if there were a corresponding engine service that could dole out renders to a list of components, as it may be desirable to have more than one component rendered in a particular request. ....

        Show
        Jesse Kuhnert added a comment - Not wanting to butt in or anything....but this would seem to only get us halfway there. The ability to call renderComponent on a specific component I think is already there, though you do have to write some sort of engine service to control how to pass in the writer. I think the ideal scnerio would be : -) A way to add behaviour to the render cycle which allows a contributed service to determine which IMarkupWriter any given component in the system is passed. This would mean some sort of interface that would pass in the IComponent instance itself to the check? OR The IPage suggestion you had would work, only if there were a corresponding engine service that could dole out renders to a list of components, as it may be desirable to have more than one component rendered in a particular request. ....
        Hide
        Howard M. Lewis Ship added a comment -

        Seems like what you may want is the ability to start the rendering process inside a page, at an arbitrary component, rather than at the page itself.

        Perhaps an additional method on IPage to say "render this component" rather than the default "render yourself".

        Show
        Howard M. Lewis Ship added a comment - Seems like what you may want is the ability to start the rendering process inside a page, at an arbitrary component, rather than at the page itself. Perhaps an additional method on IPage to say "render this component" rather than the default "render yourself".
        Hide
        Jesse Kuhnert added a comment -

        This is being worked on in a related project, tacos.sourceforge.net. Reference implementation will be available soon.

        Show
        Jesse Kuhnert added a comment - This is being worked on in a related project, tacos.sourceforge.net. Reference implementation will be available soon.

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Markus Joschko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development