Tapestry 5
  1. Tapestry 5
  2. TAP5-938

Expose ability to render a portion of a page (a Block, Component, etc.) without using internal services

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2
    • Fix Version/s: 5.4
    • Component/s: tapestry-core

      Description

      Currently you have to create an instance of PageRenderQueyeImpl and obtain an appropriate MarkupWriter. This could be combined into a facade service to do all the necessary work.

        Issue Links

          Activity

          Hide
          Howard M. Lewis Ship added a comment -

          I can no longer remember why I thought this was important.

          Show
          Howard M. Lewis Ship added a comment - I can no longer remember why I thought this was important.
          Hide
          Robert Zeigler added a comment -

          It seems useful for complex ajax scenarios. Typically, you would just return the component/block/etc. from your event handler and update a zone, but I know of at least one application that needed more power & flexibility than zones provide (at the time, at least), and the developers wound up rendering portions of pages and returning the text stream.

          Show
          Robert Zeigler added a comment - It seems useful for complex ajax scenarios. Typically, you would just return the component/block/etc. from your event handler and update a zone, but I know of at least one application that needed more power & flexibility than zones provide (at the time, at least), and the developers wound up rendering portions of pages and returning the text stream.
          Hide
          ASF subversion and git services added a comment -

          Commit 8b7be0060db3b4995896211eae26242559ece227 in branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=8b7be00 ]

          TAP5-938: Expose ability to render a portion of a page (a Block,
          Component, etc.) without using internal services

          Show
          ASF subversion and git services added a comment - Commit 8b7be0060db3b4995896211eae26242559ece227 in branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=8b7be00 ] TAP5-938 : Expose ability to render a portion of a page (a Block, Component, etc.) without using internal services
          Hide
          Thiago H. de Paula Figueiredo added a comment -

          Implemented as the PartialTemplateRenderer service and its render(Object) and renderToDocument(Object) methods.

          Show
          Thiago H. de Paula Figueiredo added a comment - Implemented as the PartialTemplateRenderer service and its render(Object) and renderToDocument(Object) methods.
          Hide
          Lance added a comment -

          Hi Thiago, I'm slightly concerned that things like @Environmental and JavaScriptSupport.addScript(...) etc won't work with this solution.

          I've only had a quick poke at the code so could be wrong.

          Show
          Lance added a comment - Hi Thiago, I'm slightly concerned that things like @Environmental and JavaScriptSupport.addScript(...) etc won't work with this solution. I've only had a quick poke at the code so could be wrong.
          Hide
          Thiago H. de Paula Figueiredo added a comment -

          Hi, Lance!

          The Javadoc of the new methods explicitly say that importing and inclusing of CSS and JS will be ignored. Otherwise, it's something beyond the scope of this issue IMHO, as the return type of the methods couldn't be String or Document because they would need to have the markup plus imported CSS and JavaScript files plus JavaScript snippets generated by JavaScriptSupport.addScript() (which is deprecated already) or JavaScriptSupport.require(). Of course, in another issue, we can add methods to PartialTemplateRenderer that deal with that.

          I haven't tested yet, but I can't see why @Environmental wouldn't work. It's backed by Environment, a per-thread-service.

          Show
          Thiago H. de Paula Figueiredo added a comment - Hi, Lance! The Javadoc of the new methods explicitly say that importing and inclusing of CSS and JS will be ignored. Otherwise, it's something beyond the scope of this issue IMHO, as the return type of the methods couldn't be String or Document because they would need to have the markup plus imported CSS and JavaScript files plus JavaScript snippets generated by JavaScriptSupport.addScript() (which is deprecated already) or JavaScriptSupport.require(). Of course, in another issue, we can add methods to PartialTemplateRenderer that deal with that. I haven't tested yet, but I can't see why @Environmental wouldn't work. It's backed by Environment, a per-thread-service.
          Hide
          Lance added a comment -

          Ah, I guess I misunderstood the scope of this. I was hoping it might replace tapestry-offline.

          Perhaps @Environmental was a bad example, I'm guessing that @HeartbeatDeffered won't work. So the label component etc might not work

          Show
          Lance added a comment - Ah, I guess I misunderstood the scope of this. I was hoping it might replace tapestry-offline. Perhaps @Environmental was a bad example, I'm guessing that @HeartbeatDeffered won't work. So the label component etc might not work
          Hide
          Thiago H. de Paula Figueiredo added a comment -

          tapestry-offline, from its description, is about using Tapestry templates out of a webapp. What I think the scope is, inside a webapp, to render a block or component into a string so a portion of template can be rendered and then passed as-is to, for example, a JavaScript library in an AJAX request or to e-mail part of a page. The ticket description is very light in details, so I can see people interpreting it differently.

          Regarding @HeartbeatDeferred, yeah, it may not work. Every contribution on how to break the PartialTemplateRenderer is very welcome, so we can fix it.

          Show
          Thiago H. de Paula Figueiredo added a comment - tapestry-offline, from its description, is about using Tapestry templates out of a webapp. What I think the scope is, inside a webapp, to render a block or component into a string so a portion of template can be rendered and then passed as-is to, for example, a JavaScript library in an AJAX request or to e-mail part of a page. The ticket description is very light in details, so I can see people interpreting it differently. Regarding @HeartbeatDeferred, yeah, it may not work. Every contribution on how to break the PartialTemplateRenderer is very welcome, so we can fix it.

            People

            • Assignee:
              Thiago H. de Paula Figueiredo
              Reporter:
              Howard M. Lewis Ship
            • Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development