Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 5.3.2
    • Fix Version/s: None
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      I've seen several posts on the mailing lists asking for how to render blocks manually in pages/components.

      Had a use case in this issue: https://issues.apache.org/jira/browse/TAP5-1863

      Basically I tried with:
      --------
      RenderCommand renderCommand = (RenderCommand)alertBlock;
      MarkupWriter markupWriter = new MarkupWriterImpl();
      RenderQueueImpl renderQueue = new RenderQueueImpl(log);
      renderQueue.push(renderCommand);
      renderQueue.run(markupWriter);

      alertManager.info(markupWriter.toString());
      --------

      Don't know if it's the 'correct' way of doing things so requesting a service or a helper class available in core that does the job.

        Issue Links

          Activity

          Magnus Kvalheim created issue -
          Jochen Kemnade made changes -
          Field Original Value New Value
          Link This issue relates to TAP5-938 [ TAP5-938 ]
          Michael Wyraz made changes -
          Attachment RenderCommandToStringService.java [ 12612692 ]
          Attachment RenderCommandToStringServiceImpl.java [ 12612693 ]
          Lance made changes -
          Comment [ Something like this:

          {code}
          package foo.bar.components;

          public class CaptureBody {
             @Property
             private Binding value;

             @Property
             private MarkupHandler handler;

             void beforeRender(MarkupWriter writer) {
                if (value == null && handler == null) {
                   throw new IllegalStateException("value or handler must be specified");
                }
                writer.element("deleteme");
             }

             // let the body render

             void afterRender(MarkupWriter writer) {
                Element container = writer.getElement();
                writer.end();
                String markup = container.getChildMarkup();
                container.remove();

                if (value != null) {
                   value.set(markup);
                }

                if (handler != null) {
                   handler.handle(markup);
                }
             }
          }
          {code} ]
          Lance made changes -
          Comment [ Yes, that's exactly what the proposed component will do. It will use it's own render phases to capture/remove the markup from the current render (page or ajax). ]
          Thiago H. de Paula Figueiredo made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Magnus Kvalheim
            • Votes:
              7 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development