You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Timo Nentwig <ti...@toptarif.de> on 2010/11/19 16:40:57 UTC

Multiple tml files per page/component

Hi!

So, I'm a tapestry (5.1) noob and so far I was unable to figure whether it fulfills a requirement essential to me: is it possible to have different tml files for each component? So far it seems like each component has exactly one tml file.

thx
tcn
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple tml files per page/component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sun, 21 Nov 2010 15:24:18 -0200, Mats Andersson  
<ma...@ronsoft.se> wrote:

> And don't be too afraid to create more pages, one page for each view. If  
> you find that you have to duplicate code in the pages you could probably  
> put that into services and components and that way your code will be  
> easier to maintain than one complex page.

Another solution would be to have a base class and some subclasses, as  
templates are inherited.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple tml files per page/component

Posted by Mats Andersson <ma...@ronsoft.se>.
And don't be too afraid to create more pages, one page for each view. If 
you find that you have to duplicate code in the pages you could probably 
put that into services and components and that way your code will be 
easier to maintain than one complex page.


Thiago H. de Paula Figueiredo skrev 2010-11-20 14:49:
> On Sat, 20 Nov 2010 08:14:03 -0200, Timo Nentwig 
> <ti...@toptarif.de> wrote:
>
>> White labeling. Same code, different appearance.
>
> As Juan said, CSS can solve most of your problem here. If you need 
> HTML structure differences, not just appearance ones, you can use 
> blocks, components and the Delegate component. Example here: 
> http://tapestry.apache.org/tapestry5.1/cookbook/switch.html.
>

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


Re: Multiple tml files per page/component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 20 Nov 2010 08:14:03 -0200, Timo Nentwig  
<ti...@toptarif.de> wrote:

> White labeling. Same code, different appearance.

As Juan said, CSS can solve most of your problem here. If you need HTML  
structure differences, not just appearance ones, you can use blocks,  
components and the Delegate component. Example here:  
http://tapestry.apache.org/tapestry5.1/cookbook/switch.html.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple tml files per page/component

Posted by "Juan E. Maya" <ma...@gmail.com>.
Timo
On 20 Nov 2010 11:14, "Timo Nentwig" <ti...@toptarif.de> wrote:
>
> On Nov 19, 2010, at 18:24, Thiago H. de Paula Figueiredo wrote:
>
>>> Btw, what's your scenario and why is the multiple templates per page a
>>> requirement for you? Maybe you could achieve what you need with
>>> Components...
>>
>> I'm also curious to know what these requirements are. I never needed to
have more than one template for a given page or component. This sounds like
someone developing Tapestry with a Struts mind. :P
>>
>> You can simulate multiple templates for a given page or component using
blocks (<t:block), components and the Delegate component.
>
> White labeling. Same code, different appearance.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Re: Multiple tml files per page/component

Posted by "Juan E. Maya" <ma...@gmail.com>.
Timo, css should be used to modify the appearance of the content rendered by
pages or components and because the nature of css you can always override
parts defined in your component.

Doesn't css fulfill your requirements ?
On 20 Nov 2010 11:14, "Timo Nentwig" <ti...@toptarif.de> wrote:
>
> On Nov 19, 2010, at 18:24, Thiago H. de Paula Figueiredo wrote:
>
>>> Btw, what's your scenario and why is the multiple templates per page a
>>> requirement for you? Maybe you could achieve what you need with
>>> Components...
>>
>> I'm also curious to know what these requirements are. I never needed to
have more than one template for a given page or component. This sounds like
someone developing Tapestry with a Struts mind. :P
>>
>> You can simulate multiple templates for a given page or component using
blocks (<t:block), components and the Delegate component.
>
> White labeling. Same code, different appearance.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Re: Multiple tml files per page/component

Posted by Timo Nentwig <ti...@toptarif.de>.
On Nov 19, 2010, at 18:24, Thiago H. de Paula Figueiredo wrote:

>> Btw, what's your scenario and why is the multiple templates per page a
>> requirement for you? Maybe you could achieve what you need with
>> Components...
> 
> I'm also curious to know what these requirements are. I never needed to have more than one template for a given page or component. This sounds like someone developing Tapestry with a Struts mind. :P
> 
> You can simulate multiple templates for a given page or component using blocks (<t:block), components and the Delegate component.

White labeling. Same code, different appearance.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple tml files per page/component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 19 Nov 2010 14:14:22 -0200, Everton Agner <to...@gmail.com>  
wrote:

> PS: About the Locale scenario, i don't know if you would need to have 2  
> page classes also.

No need for different page or component classes for different locales. One  
page or component class, multiple templates, one for each locale.

Everton is right that a page or component can have zero templates. This is  
more common with components that generate their output using MarkupWriter.

> Btw, what's your scenario and why is the multiple templates per page a
> requirement for you? Maybe you could achieve what you need with
> Components...

I'm also curious to know what these requirements are. I never needed to  
have more than one template for a given page or component. This sounds  
like someone developing Tapestry with a Struts mind. :P

You can simulate multiple templates for a given page or component using  
blocks (<t:block), components and the Delegate component.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple tml files per page/component

Posted by Everton Agner <to...@gmail.com>.
PS: About the Locale scenario, i don't know if you would need to have 2 page
classes also. I just know you could do something like it, but never
implemented.

Btw, what's your scenario and why is the multiple templates per page a
requirement for you? Maybe you could achieve what you need with
Components...

_______________________
Everton Agner Ramos


2010/11/19 Everton Agner <to...@gmail.com>

> As far as I know, you can Localize your TML files. Example: you can have an
> Edit_en.tml and an Edit_pt.tml for a Edit.java page class. But that handles
> only the Locale scenario... I don't know if it works only for Pages or if
> it's possible on Components also...
>
> But you can render output without having a TML file, in the rendering
> phases in the Page/Component class...
>
> _______________________
> Everton Agner Ramos
>
>
> 2010/11/19 Timo Nentwig <ti...@toptarif.de>
>
> Hi!
>>
>> So, I'm a tapestry (5.1) noob and so far I was unable to figure whether it
>> fulfills a requirement essential to me: is it possible to have different tml
>> files for each component? So far it seems like each component has exactly
>> one tml file.
>>
>> thx
>> tcn
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Re: Multiple tml files per page/component

Posted by Everton Agner <to...@gmail.com>.
As far as I know, you can Localize your TML files. Example: you can have an
Edit_en.tml and an Edit_pt.tml for a Edit.java page class. But that handles
only the Locale scenario... I don't know if it works only for Pages or if
it's possible on Components also...

But you can render output without having a TML file, in the rendering phases
in the Page/Component class...

_______________________
Everton Agner Ramos


2010/11/19 Timo Nentwig <ti...@toptarif.de>

> Hi!
>
> So, I'm a tapestry (5.1) noob and so far I was unable to figure whether it
> fulfills a requirement essential to me: is it possible to have different tml
> files for each component? So far it seems like each component has exactly
> one tml file.
>
> thx
> tcn
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>