On Thu, Jul 7, 2011 at 6:34 AM, Thiago H. de Paula Figueiredo
<thiag...@gmail.com> wrote:
> On Thu, 07 Jul 2011 01:25:39 -0300, Mark <mark-li...@xeric.net> wrote:
>
>> Is there a better way to construct a block from a string in Java than
>> this?
>>
>>    Block onShowDialogFromMoreInfo(TicketClass ticketClass) {
>>        return  new RenderableAsBlock(new
>> StringRenderable(person.getInfo()));
>>    }
>
> Do you really need it to be a block? To pass it to Delegate? It doesn't need
> to be a block. It can also be a component or any object that implements
> RenderCommand. Why don't you just return a RenderCommand instance? Tapestry
> ultimately renders only RenderCommand's. Anything else which can be rendered
> implements RenderCommand (including BlockImpl) or converted to an instance
> of it.

Ah ok.  So something along the lines of this?

    Object onShowDialogFromMoreInfo(final Person person) {
        return new RenderCommand()
        {
            public void render(MarkupWriter writer, RenderQueue queue)
            {
                writer.writeRaw("<b>" + person.getName() + "</b>");
            }
        };
    }

I was thinking that there should be a way to do it with just a string,
but I guess that won't work because a string will try to send the
browser to a new page instead of just updating the part that needs to
be updated.

Mark

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

Reply via email to