You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Harald Graf <eg...@gmx.at> on 2007/11/12 16:15:50 UTC

[T5] Dynamic Layouts]


hi all,

is there any possibility to use dynamic layouts for example, i'd like to use some variable for my
layout name (${layout} which is then filled in my pageclass at runtime depending on some conditions.

<html t:type="${layout}" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
</html>

thank you,
harald





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


Re: T5 acquire block from separate page [was: Re: Antwort: [T5] Dynamic Layouts]]

Posted by Lance White <la...@logicscope.com>.

Did you get a resolution for this?

Cheers

Lance



Michael Gerzabek wrote:
> 
> Hi Robert,
> 
> You clearly outlined the simple case. I'm interested in the 2nd case: The
> name of my block/ component is read from the database and I have to
> acquire the block/ component from another page (where the name could also
> be in the database).
> 
> I found Howards repy to an earlier thread [1]. This was back in May 07.
> The result then was mainly what's written in the docs [2] about the
> delegate component. 
> 
> Is there a way to dynamically load a page/ component/ block today?
> 
> Thanks!
> Michael
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5--Dynamic-Layouts--tp13707415p17335198.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


T5 acquire block from separate page [was: Re: Antwort: [T5] Dynamic Layouts]]

Posted by Michael Gerzabek <mi...@gmx.net>.
Hi Robert,

You clearly outlined the simple case. I'm interested in the 2nd case: The
name of my block/ component is read from the database and I have to acquire
the block/ component from another page (where the name could also be in the
database).

I found Howards repy to an earlier thread [1]. This was back in May 07. The
result then was mainly what's written in the docs [2] about the delegate
component. 

Is there a way to dynamically load a page/ component/ block today?

Thanks!
Michael

[1] T5: Best practice for rendering a dynamic component
http://www.nabble.com/T5%3A-Best-practice-for-rendering-a-dynamic-component-to10765577.html#a10775220
[2] org.apache.tapestry.corelib.components.Delegate
http://tapestry.formos.com/nightly/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Delegate.html


Robert Zeigler wrote:
> 
> <t:block id="layout1">
> ...
> </t:block>
> 
> <t:block id="layout2">
> ...
> </t:block>
> 
> And your getLayoutComponent() method would look something like:
> public Object getLayoutComponent() {
>    return _componentResources.getBlock(_layout);
> } 
> That's the simple case.  For the more complicated case of pluggable  
> layouts, you can play the same game, except that you would acquire the  
> blocks not from the current component template, but from some other  
> page (which is, in fact, legal. :)
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5--Dynamic-Layouts--tp13707415p15799919.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Antwort: [T5] Dynamic Layouts]

Posted by Harald Graf <eg...@gmx.at>.
ty for your detailed answer. sounds good.

cheers,
harald

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


Re: Antwort: [T5] Dynamic Layouts]

Posted by Robert Zeigler <ro...@scazdl.org>.
Doing it exactly as you want won't work (as pointed out by Kris), but  
you can accomplish the same thing using the delegate component.
I would recommend something like:
create a single layout component that hides the complexity from the  
rest of the app.
That layout component takes a parameter "layout" or "name:" or whatever.
So, you use your layout component like:
<div t:type="layout" layout="default">
...
</div>


The layout component structure will depend on the complexity of your  
application.
For example, will layouts be "pluggable"? Or is there a set number of  
layouts?
In any event, the overall structure for your layout component is going  
to be:
<t:delegate to="layoutComponent">
...
</t:delegate>

Then your java class will have a:
public Object getLayoutComponent() {
}
method. And that method is responsible for determining which layout is  
used.
For the simple case where there are several layouts, but they are  
known ahead of time, you can put each layout into your layout  
component, like:

<t:block id="layout1">
...
</t:block>

<t:block id="layout2">
...
</t:block>

And your getLayoutComponent() method would look something like:
public Object getLayoutComponent() {
   return _componentResources.getBlock(_layout);
}

Where _componentResources is an injected variable of type  
ComponentResources, and _layout is your String layout parameter for  
the component.

That's the simple case.  For the more complicated case of pluggable  
layouts, you can play the same game, except that you would acquire the  
blocks not from the current component template, but from some other  
page (which is, in fact, legal. :)


Cheers,

Robert

On Nov 13, 2007, at 11/131:54 AM , Kristian Marinkovic wrote:

> hi harald,
>
> want you ask for is not doable in Tapestry... for good reason :)
> (please search the mailing list for static structure dynamic behvior)
>
>
> part of what you want can be achieved with a Delegate
> component. you'd have to declare you layout specific
> components in your Layout component within a Block
> and display one of these components using a Delegate.
>
> g,
> kris
>
>
>
>
> Harald Graf <eg...@gmx.at>
> 12.11.2007 16:15
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> [T5] Dynamic Layouts]
>
>
>
>
>
>
>
>
>
> hi all,
>
> is there any possibility to use dynamic layouts for example, i'd  
> like to
> use some variable for my
> layout name (${layout} which is then filled in my pageclass at runtime
> depending on some conditions.
>
> <html t:type="${layout}" xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> </html>
>
> thank you,
> harald
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Antwort: [T5] Dynamic Layouts]

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi harald,

want you ask for is not doable in Tapestry... for good reason :)
(please search the mailing list for static structure dynamic behvior)


part of what you want can be achieved with a Delegate
component. you'd have to declare you layout specific 
components in your Layout component within a Block 
and display one of these components using a Delegate.

g,
kris




Harald Graf <eg...@gmx.at> 
12.11.2007 16:15
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
[T5] Dynamic Layouts]









hi all,

is there any possibility to use dynamic layouts for example, i'd like to 
use some variable for my
layout name (${layout} which is then filled in my pageclass at runtime 
depending on some conditions.

<html t:type="${layout}" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
</html>

thank you,
harald





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