The code is simpler in 5.4, using the AjaxResponseRenderer, but it's
basically the same thing:
- Contribute a filter into the active thread's PartialMarkupRenderer pipeline
- The filter creates an empty element for the renderable object
- The renderable object renders markup inside the element
- The body of the element is captured and stuffed into a JSONObject key

On Mon, Feb 27, 2012 at 6:10 AM, Thiago H. de Paula Figueiredo
<thiag...@gmail.com> wrote:
> Hi!
>
> Have you checked its source? Here's the 5.1.0.5 one (which is the version
> used in  the project I'm working now):
>
> public class MultiZoneUpdateEventResultProcessor implements
> ComponentEventResultProcessor<MultiZoneUpdate>
> {
>    private final PageRenderQueue queue;
>
>    private final TypeCoercer typeCoercer;
>
>    public MultiZoneUpdateEventResultProcessor(PageRenderQueue queue,
> TypeCoercer typeCoercer)
>    {
>        this.queue = queue;
>        this.typeCoercer = typeCoercer;
>    }
>
>    public void processResultValue(final MultiZoneUpdate value) throws
> IOException
>    {
>        // There has to be at least a single command in the queue to force a
> render.
>        queue.initializeForPartialPageRender(new RenderCommand()
>        {
>            public void render(MarkupWriter writer, RenderQueue queue)
>            {
>            }
>        });
>
>        queue.addPartialMarkupRendererFilter(new SetupZonesFilter());
>
>        Map<String, Object> map = value.getZoneToRenderMap();
>
>        for (String zoneId : map.keySet())
>        {
>            Object provided = map.get(zoneId);
>
>            RenderCommand zoneRenderCommand = toRenderer(zoneId, provided);
>
>            queue.addPartialMarkupRendererFilter(new
> SingleZonePartialRendererFilter(zoneId, zoneRenderCommand, queue));
>        }
>    }
>
>    private RenderCommand toRenderer(String zoneId, Object provided)
>    {
>        try
>        {
>            return typeCoercer.coerce(provided, RenderCommand.class);
>        }
>        catch (Exception ex)
>        {
>            throw new IllegalArgumentException(String.format("Failure
> converting renderer for zone '%s': %s",
>                                                             zoneId,
>
> InternalUtils.toMessage(ex)), ex);
>        }
>    }
> }
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to