Re: Constructing a block in java

2011-07-07 Thread Thiago H. de Paula Figueiredo
On Thu, 07 Jul 2011 15:02:05 -0300, Mark wrote: Just implement a StringRenderCommand. :) Perhaps I misunderstood. I can't seem to find an interface or class called a StringRenderCommand in the JavaDocs anywhere. Am I looking in the wrong place? I'm suggesting you to write one. ;) -- Thia

Re: Constructing a block in java

2011-07-07 Thread Mark
> >> 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. > > Just implement a StringRenderCommand. :) Perhaps I misunders

Re: Constructing a block in java

2011-07-07 Thread Josh Canfield
Ah, sorry. I didn't read closely what you were trying to do. For ajax response you need a RenderCommand, as Thiago said... On Thu, Jul 7, 2011 at 10:02 AM, Mark wrote: > Josh, > > Thats what I thought originally.  This is for a ModalDialog using > Taha's addon.  When someone clicks "more info" it

Re: Constructing a block in java

2011-07-07 Thread Thiago H. de Paula Figueiredo
On Thu, 07 Jul 2011 14:15:46 -0300, Mark wrote: return new StringRenderable("" + person.getName() + ""); It should implement RenderCommand, not Renderable. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars

Re: Constructing a block in java

2011-07-07 Thread Mark
On Thu, Jul 7, 2011 at 11:39 AM, Thiago H. de Paula Figueiredo wrote: >> 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 update

Re: Constructing a block in java

2011-07-07 Thread Mark
Josh, Thats what I thought originally. This is for a ModalDialog using Taha's addon. When someone clicks "more info" it pops up with a modal dialog box and the contents are determined by this method. If I return a String, Tapestry tries to find a page that matches the String and return that ins

Re: Constructing a block in java

2011-07-07 Thread Josh Canfield
Have you tried returning a String? There is a built-in TypeCoercer for String -> Renderable This is implemented using StringRenderable which uses write(text) (not writeRaw) so your html will be escaped. Josh On Thu, Jul 7, 2011 at 9:35 AM, Mark wrote: > On Thu, Jul 7, 2011 at 6:34 AM, Thiago H.

Re: Constructing a block in java

2011-07-07 Thread Thiago H. de Paula Figueiredo
On Thu, 07 Jul 2011 13:35:47 -0300, Mark wrote: Ah ok. So something along the lines of this? Object onShowDialogFromMoreInfo(final Person person) { return new RenderCommand() { public void render(MarkupWriter writer, RenderQueue queue) {

Re: Constructing a block in java

2011-07-07 Thread Mark
On Thu, Jul 7, 2011 at 6:34 AM, Thiago H. de Paula Figueiredo wrote: > On Thu, 07 Jul 2011 01:25:39 -0300, Mark wrote: > >> Is there a better way to construct a block from a string in Java than >> this? >> >>    Block onShowDialogFromMoreInfo(TicketClass ticketClass) { >>        return  new Rende

Re: Constructing a block in java

2011-07-07 Thread Thiago H. de Paula Figueiredo
On Thu, 07 Jul 2011 01:25:39 -0300, Mark 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 ne

Constructing a block in java

2011-07-06 Thread Mark
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())); } Mark