Multiple tml files per page/component

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple tml files per page/component

Timo Nentwig
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Everton Agner-2
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 <[hidden email]>

> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Everton Agner-2
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 <[hidden email]>

> 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 <[hidden email]>
>
> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Thiago H de Paula Figueiredo
On Fri, 19 Nov 2010 14:14:22 -0200, Everton Agner <[hidden email]>  
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Timo Nentwig

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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Juan E. Maya
Timo
On 20 Nov 2010 11:14, "Timo Nentwig" <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Juan E. Maya
In reply to this post by Timo Nentwig
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" <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Thiago H de Paula Figueiredo
In reply to this post by Timo Nentwig
On Sat, 20 Nov 2010 08:14:03 -0200, Timo Nentwig  
<[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Mats Andersson-2
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
> <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple tml files per page/component

Thiago H de Paula Figueiredo
On Sun, 21 Nov 2010 15:24:18 -0200, Mats Andersson  
<[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]