Re: Rendering block from Java

"Thiago H. de Paula Figueiredo" <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAE_88GZwZOQ==OhYjsuS6TTTzkKr8JbMO0a+74447-SkshH8Cg@mail.gmail.com>
On Fri, Jan 6, 2017 at 3:12 PM, Jaroslav Ciml <[email protected]>
wrote:

> Hi,
>
> Is rendering of a block possible directly from Java code?
>

The way you describe in your example, I don't think so, and I would try to
avoid doing this kind of thing. Couldn't you break the leading text and
trailing text into separate components instead and then create another
component using them? That's what I'd do.


>
> I know that I can return a block from a rendering phase method:
>
> Object beginRender()
> {
>     if (someCondition) {
>         return someBlock; // of type org.apache.tapestry5.Block
>     }
>     ...
> }
>
> However, can I do something like
>
> Object beginRender(MarkupWriter writer)
> {
>     writer.write("Leading text");
>     if (someBlock != null)
>     {
>         writer.renderBlock(someBlock); // this method does not actually
> exist
>     }
>     writer.write("Trailing text");
> }
>
> Thanks.
> Jarda
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Thiago
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.