You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bjornharvold <bj...@harvold.com> on 2007/04/27 19:58:45 UTC

Templating with Tapestry 5

Ok, I've been barking up a tree the whole day... and I'm not even sure it's
the wrong one.

I want to be able to do real component templating like struts has it's
tiles. So my page (CoolPage) would look something like this:
<t:layout/>

.. a one liner

My CoolPage.java would have some string properties referring to components
that it would inject into layout. It also extends an abstract class which
has the default template associated with it (Layout):

class CoolPage extends AbstractPage {
@Component(parameters{"navbar=coolnavbar", "header=coolheader"})
private Layout _layout;

private String _coolnavbar = "navbarComponentName"
private String _coolheader = "headerComponentName"

etc...
}

The component names might be delegated down several levels of components to
whatever component needs that specific information.

Then Layout.html would look something like:
<div t:type="navbar"/>

Layout.java looks like this:
class Layout {
private String _navbar;

accessors here
}

The problem occurs because Layout.html does NOT grab the injected string
names put resolves the component to be of type navbar which does not exist. 

I am doing this because the look-and-feel of the application carries 3
layers of components. The layers have just been created to wrap the
components in Yahoo UI divs mostly. I don't want to have to redo the default
layout on every tapestry page if something changes.That's why i am trying to
keep all that in one layout and inject components into the layout. The
layout class doesn't know what component goes where, it should just hold a
basket of injected components and the template should know where to put the
components.

Any ideas?... or is there a better way?
-- 
View this message in context: http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10223765
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: Templating with Tapestry 5

Posted by bjornharvold <bj...@harvold.com>.
Nice - thanks :-)

-- 
View this message in context: http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10226122
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: Templating with Tapestry 5

Posted by Yann Ramin <at...@stackworks.net>.
Went down this road recently.

You have a Layout component (call it what you want)

<html><body>some static stuff
<t:body/>
</body>
</html>

and each page uses the layout;

<t:layout>
body body
</t:layout>

if you want more flexibility, you can pass in other components as 
parameters, and use t:delegate to render them



<t:layout>
<t:parameter name="sidebar">
	<t:sidebar t:id="sidebar"/>
	</t:parameter>
body body
</t:layout>

and in the layout:

<t:delegate to="propertyNameOfYourParameter"/>


bjornharvold wrote:
> Konstantin,
> 
> Can you give me an example?
> 
> thx
> bjorn
> 
>
> 


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


Re: Templating with Tapestry 5

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
You got it right.

--- bjornharvold <bj...@harvold.com> wrote:

> 
> But that's Tapestry 4, no? Oh I think I get it. In
> tapestry 5 you have the
> <t:body/> Basically, you wrap your components in
> layouts.
> 
> 
> 
> Konstantin Ignatyev wrote:
> > 
> > Just look closely at the Workbench example that
> comes
> > with Tapestry:
> > 
> > Border component has 
> > Page content goes
> > here.
> > 
> > And individual pages look like this;
> > 
> >    <-- this is the first page
> > line
> > ..
> > Meaningful page content
> > ..
> > 
> > 
> > --- bjornharvold <bj...@harvold.com> wrote:
> > 
> >> 
> >> Konstantin,
> >> 
> >> Can you give me an example?
> >> 
> >> thx
> >> bjorn
> >> 
> >> 
> >> Konstantin Ignatyev wrote:
> >> > 
> >> > Had the same problem when I started with T
> after
> >> > spending too much time with Struts.
> >> > 
> >> > In T Layout is usually done upside down
> compared
> >> to
> >> > struts: layout is handled by Border component
> that
> >> is
> >> > wrapper to the page content.
> >> > 
> >> > Feels weird initially but works well.
> >> > 
> >> > --- bjornharvold <bj...@harvold.com> wrote:
> >> > 
> >> >> 
> >> >> Ok, I've been barking up a tree the whole
> day...
> >> and
> >> >> I'm not even sure it's
> >> >> the wrong one.
> >> >> 
> >> >> I want to be able to do real component
> templating
> >> >> like struts has it's
> >> >> tiles. So my page (CoolPage) would look
> something
> >> >> like this:
> >> >> <t:layout/>
> >> >> 
> >> >> .. a one liner
> >> >> 
> >> >> My CoolPage.java would have some string
> >> properties
> >> >> referring to components
> >> >> that it would inject into layout. It also
> extends
> >> an
> >> >> abstract class which
> >> >> has the default template associated with it
> >> >> (Layout):
> >> >> 
> >> >> class CoolPage extends AbstractPage {
> >> >> @Component(parameters{"navbar=coolnavbar",
> >> >> "header=coolheader"})
> >> >> private Layout _layout;
> >> >> 
> >> >> private String _coolnavbar =
> >> "navbarComponentName"
> >> >> private String _coolheader =
> >> "headerComponentName"
> >> >> 
> >> >> etc...
> >> >> }
> >> >> 
> >> >> The component names might be delegated down
> >> several
> >> >> levels of components to
> >> >> whatever component needs that specific
> >> information.
> >> >> 
> >> >> Then Layout.html would look something like:
> >> >> <div t:type="navbar"/>
> >> >> 
> >> >> Layout.java looks like this:
> >> >> class Layout {
> >> >> private String _navbar;
> >> >> 
> >> >> accessors here
> >> >> }
> >> >> 
> >> >> The problem occurs because Layout.html does
> NOT
> >> grab
> >> >> the injected string
> >> >> names put resolves the component to be of type
> >> >> navbar which does not exist. 
> >> >> 
> >> >> I am doing this because the look-and-feel of
> the
> >> >> application carries 3
> >> >> layers of components. The layers have just
> been
> >> >> created to wrap the
> >> >> components in Yahoo UI divs mostly. I don't
> want
> >> to
> >> >> have to redo the default
> >> >> layout on every tapestry page if something
> >> >> changes.That's why i am trying to
> >> >> keep all that in one layout and inject
> components
> >> >> into the layout. The
> >> >> layout class doesn't know what component goes
> >> where,
> >> >> it should just hold a
> >> >> basket of injected components and the template
> >> >> should know where to put the
> >> >> components.
> >> >> 
> >> >> Any ideas?... or is there a better way?
> >> >> -- 
> >> >> View this message in context:
> >> >>
> >> >
> >>
> >
>
http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10223765
> >> >> 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
> >> >> 
> >> >> 
> >> > 
> >> > 
> >> > Konstantin Ignatyev
> >> > 
> >> > 
> >> > 
> >> > 
> >> > PS: If this is a typical day on planet earth,
> >> humans will add fifteen
> >> > million tons of carbon to the atmosphere,
> destroy
> >> 115 square miles of
> >> > tropical rainforest, create seventy-two miles
> of
> >> desert, eliminate between
> >> > forty to one hundred species, erode seventy-one
> >> million tons of topsoil,
> >> > add 2,700 tons of CFCs to the stratosphere, and
> >> increase their population
> >> > by 263,000
> >> > 
> >> > Bowers, C.A.  The Culture of Denial:  Why the
> >> Environmental Movement Needs
> >> > a Strategy for Reforming Universities and
> Public
> >> Schools.  New York: 
> >> > State University of New York Press, 1997: (4)
> (5)
> >> (p.206)
> >> > 
> >> >
> >>
> >
>
---------------------------------------------------------------------
> >> > To unsubscribe, e-mail:
> >> users-unsubscribe@tapestry.apache.org
> 
=== message truncated ===


Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  New York:  State University of New York Press, 1997: (4) (5) (p.206)

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


Re: Templating with Tapestry 5

Posted by bjornharvold <bj...@harvold.com>.
But that's Tapestry 4, no? Oh I think I get it. In tapestry 5 you have the
<t:body/> Basically, you wrap your components in layouts.



Konstantin Ignatyev wrote:
> 
> Just look closely at the Workbench example that comes
> with Tapestry:
> 
> Border component has 
> Page content goes
> here.
> 
> And individual pages look like this;
> 
>    <-- this is the first page
> line
> ..
> Meaningful page content
> ..
> 
> 
> --- bjornharvold <bj...@harvold.com> wrote:
> 
>> 
>> Konstantin,
>> 
>> Can you give me an example?
>> 
>> thx
>> bjorn
>> 
>> 
>> Konstantin Ignatyev wrote:
>> > 
>> > Had the same problem when I started with T after
>> > spending too much time with Struts.
>> > 
>> > In T Layout is usually done upside down compared
>> to
>> > struts: layout is handled by Border component that
>> is
>> > wrapper to the page content.
>> > 
>> > Feels weird initially but works well.
>> > 
>> > --- bjornharvold <bj...@harvold.com> wrote:
>> > 
>> >> 
>> >> Ok, I've been barking up a tree the whole day...
>> and
>> >> I'm not even sure it's
>> >> the wrong one.
>> >> 
>> >> I want to be able to do real component templating
>> >> like struts has it's
>> >> tiles. So my page (CoolPage) would look something
>> >> like this:
>> >> <t:layout/>
>> >> 
>> >> .. a one liner
>> >> 
>> >> My CoolPage.java would have some string
>> properties
>> >> referring to components
>> >> that it would inject into layout. It also extends
>> an
>> >> abstract class which
>> >> has the default template associated with it
>> >> (Layout):
>> >> 
>> >> class CoolPage extends AbstractPage {
>> >> @Component(parameters{"navbar=coolnavbar",
>> >> "header=coolheader"})
>> >> private Layout _layout;
>> >> 
>> >> private String _coolnavbar =
>> "navbarComponentName"
>> >> private String _coolheader =
>> "headerComponentName"
>> >> 
>> >> etc...
>> >> }
>> >> 
>> >> The component names might be delegated down
>> several
>> >> levels of components to
>> >> whatever component needs that specific
>> information.
>> >> 
>> >> Then Layout.html would look something like:
>> >> <div t:type="navbar"/>
>> >> 
>> >> Layout.java looks like this:
>> >> class Layout {
>> >> private String _navbar;
>> >> 
>> >> accessors here
>> >> }
>> >> 
>> >> The problem occurs because Layout.html does NOT
>> grab
>> >> the injected string
>> >> names put resolves the component to be of type
>> >> navbar which does not exist. 
>> >> 
>> >> I am doing this because the look-and-feel of the
>> >> application carries 3
>> >> layers of components. The layers have just been
>> >> created to wrap the
>> >> components in Yahoo UI divs mostly. I don't want
>> to
>> >> have to redo the default
>> >> layout on every tapestry page if something
>> >> changes.That's why i am trying to
>> >> keep all that in one layout and inject components
>> >> into the layout. The
>> >> layout class doesn't know what component goes
>> where,
>> >> it should just hold a
>> >> basket of injected components and the template
>> >> should know where to put the
>> >> components.
>> >> 
>> >> Any ideas?... or is there a better way?
>> >> -- 
>> >> View this message in context:
>> >>
>> >
>>
> http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10223765
>> >> 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
>> >> 
>> >> 
>> > 
>> > 
>> > Konstantin Ignatyev
>> > 
>> > 
>> > 
>> > 
>> > PS: If this is a typical day on planet earth,
>> humans will add fifteen
>> > million tons of carbon to the atmosphere, destroy
>> 115 square miles of
>> > tropical rainforest, create seventy-two miles of
>> desert, eliminate between
>> > forty to one hundred species, erode seventy-one
>> million tons of topsoil,
>> > add 2,700 tons of CFCs to the stratosphere, and
>> increase their population
>> > by 263,000
>> > 
>> > Bowers, C.A.  The Culture of Denial:  Why the
>> Environmental Movement Needs
>> > a Strategy for Reforming Universities and Public
>> Schools.  New York: 
>> > State University of New York Press, 1997: (4) (5)
>> (p.206)
>> > 
>> >
>>
> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail:
>> users-help@tapestry.apache.org
>> > 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10224896
>> 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
>> 
>> 
> 
> 
> Konstantin Ignatyev
> 
> 
> 
> 
> PS: If this is a typical day on planet earth, humans will add fifteen
> million tons of carbon to the atmosphere, destroy 115 square miles of
> tropical rainforest, create seventy-two miles of desert, eliminate between
> forty to one hundred species, erode seventy-one million tons of topsoil,
> add 2,700 tons of CFCs to the stratosphere, and increase their population
> by 263,000
> 
> Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs
> a Strategy for Reforming Universities and Public Schools.  New York: 
> State University of New York Press, 1997: (4) (5) (p.206)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10225100
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: Templating with Tapestry 5

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
Just look closely at the Workbench example that comes
with Tapestry:

Border component has 
<span jwcid="@RenderBody">Page content goes
here.</span>

And individual pages look like this;

<span jwcid="@Border">   <-- this is the first page
line
..
Meaningful page content
..
</span>

--- bjornharvold <bj...@harvold.com> wrote:

> 
> Konstantin,
> 
> Can you give me an example?
> 
> thx
> bjorn
> 
> 
> Konstantin Ignatyev wrote:
> > 
> > Had the same problem when I started with T after
> > spending too much time with Struts.
> > 
> > In T Layout is usually done upside down compared
> to
> > struts: layout is handled by Border component that
> is
> > wrapper to the page content.
> > 
> > Feels weird initially but works well.
> > 
> > --- bjornharvold <bj...@harvold.com> wrote:
> > 
> >> 
> >> Ok, I've been barking up a tree the whole day...
> and
> >> I'm not even sure it's
> >> the wrong one.
> >> 
> >> I want to be able to do real component templating
> >> like struts has it's
> >> tiles. So my page (CoolPage) would look something
> >> like this:
> >> <t:layout/>
> >> 
> >> .. a one liner
> >> 
> >> My CoolPage.java would have some string
> properties
> >> referring to components
> >> that it would inject into layout. It also extends
> an
> >> abstract class which
> >> has the default template associated with it
> >> (Layout):
> >> 
> >> class CoolPage extends AbstractPage {
> >> @Component(parameters{"navbar=coolnavbar",
> >> "header=coolheader"})
> >> private Layout _layout;
> >> 
> >> private String _coolnavbar =
> "navbarComponentName"
> >> private String _coolheader =
> "headerComponentName"
> >> 
> >> etc...
> >> }
> >> 
> >> The component names might be delegated down
> several
> >> levels of components to
> >> whatever component needs that specific
> information.
> >> 
> >> Then Layout.html would look something like:
> >> <div t:type="navbar"/>
> >> 
> >> Layout.java looks like this:
> >> class Layout {
> >> private String _navbar;
> >> 
> >> accessors here
> >> }
> >> 
> >> The problem occurs because Layout.html does NOT
> grab
> >> the injected string
> >> names put resolves the component to be of type
> >> navbar which does not exist. 
> >> 
> >> I am doing this because the look-and-feel of the
> >> application carries 3
> >> layers of components. The layers have just been
> >> created to wrap the
> >> components in Yahoo UI divs mostly. I don't want
> to
> >> have to redo the default
> >> layout on every tapestry page if something
> >> changes.That's why i am trying to
> >> keep all that in one layout and inject components
> >> into the layout. The
> >> layout class doesn't know what component goes
> where,
> >> it should just hold a
> >> basket of injected components and the template
> >> should know where to put the
> >> components.
> >> 
> >> Any ideas?... or is there a better way?
> >> -- 
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10223765
> >> 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
> >> 
> >> 
> > 
> > 
> > Konstantin Ignatyev
> > 
> > 
> > 
> > 
> > PS: If this is a typical day on planet earth,
> humans will add fifteen
> > million tons of carbon to the atmosphere, destroy
> 115 square miles of
> > tropical rainforest, create seventy-two miles of
> desert, eliminate between
> > forty to one hundred species, erode seventy-one
> million tons of topsoil,
> > add 2,700 tons of CFCs to the stratosphere, and
> increase their population
> > by 263,000
> > 
> > Bowers, C.A.  The Culture of Denial:  Why the
> Environmental Movement Needs
> > a Strategy for Reforming Universities and Public
> Schools.  New York: 
> > State University of New York Press, 1997: (4) (5)
> (p.206)
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> users-help@tapestry.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10224896
> 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
> 
> 


Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  New York:  State University of New York Press, 1997: (4) (5) (p.206)

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


Re: Templating with Tapestry 5

Posted by bjornharvold <bj...@harvold.com>.
Konstantin,

Can you give me an example?

thx
bjorn


Konstantin Ignatyev wrote:
> 
> Had the same problem when I started with T after
> spending too much time with Struts.
> 
> In T Layout is usually done upside down compared to
> struts: layout is handled by Border component that is
> wrapper to the page content.
> 
> Feels weird initially but works well.
> 
> --- bjornharvold <bj...@harvold.com> wrote:
> 
>> 
>> Ok, I've been barking up a tree the whole day... and
>> I'm not even sure it's
>> the wrong one.
>> 
>> I want to be able to do real component templating
>> like struts has it's
>> tiles. So my page (CoolPage) would look something
>> like this:
>> <t:layout/>
>> 
>> .. a one liner
>> 
>> My CoolPage.java would have some string properties
>> referring to components
>> that it would inject into layout. It also extends an
>> abstract class which
>> has the default template associated with it
>> (Layout):
>> 
>> class CoolPage extends AbstractPage {
>> @Component(parameters{"navbar=coolnavbar",
>> "header=coolheader"})
>> private Layout _layout;
>> 
>> private String _coolnavbar = "navbarComponentName"
>> private String _coolheader = "headerComponentName"
>> 
>> etc...
>> }
>> 
>> The component names might be delegated down several
>> levels of components to
>> whatever component needs that specific information.
>> 
>> Then Layout.html would look something like:
>> <div t:type="navbar"/>
>> 
>> Layout.java looks like this:
>> class Layout {
>> private String _navbar;
>> 
>> accessors here
>> }
>> 
>> The problem occurs because Layout.html does NOT grab
>> the injected string
>> names put resolves the component to be of type
>> navbar which does not exist. 
>> 
>> I am doing this because the look-and-feel of the
>> application carries 3
>> layers of components. The layers have just been
>> created to wrap the
>> components in Yahoo UI divs mostly. I don't want to
>> have to redo the default
>> layout on every tapestry page if something
>> changes.That's why i am trying to
>> keep all that in one layout and inject components
>> into the layout. The
>> layout class doesn't know what component goes where,
>> it should just hold a
>> basket of injected components and the template
>> should know where to put the
>> components.
>> 
>> Any ideas?... or is there a better way?
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10223765
>> 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
>> 
>> 
> 
> 
> Konstantin Ignatyev
> 
> 
> 
> 
> PS: If this is a typical day on planet earth, humans will add fifteen
> million tons of carbon to the atmosphere, destroy 115 square miles of
> tropical rainforest, create seventy-two miles of desert, eliminate between
> forty to one hundred species, erode seventy-one million tons of topsoil,
> add 2,700 tons of CFCs to the stratosphere, and increase their population
> by 263,000
> 
> Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs
> a Strategy for Reforming Universities and Public Schools.  New York: 
> State University of New York Press, 1997: (4) (5) (p.206)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10224896
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: Templating with Tapestry 5

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
Had the same problem when I started with T after
spending too much time with Struts.

In T Layout is usually done upside down compared to
struts: layout is handled by Border component that is
wrapper to the page content.

Feels weird initially but works well.

--- bjornharvold <bj...@harvold.com> wrote:

> 
> Ok, I've been barking up a tree the whole day... and
> I'm not even sure it's
> the wrong one.
> 
> I want to be able to do real component templating
> like struts has it's
> tiles. So my page (CoolPage) would look something
> like this:
> <t:layout/>
> 
> .. a one liner
> 
> My CoolPage.java would have some string properties
> referring to components
> that it would inject into layout. It also extends an
> abstract class which
> has the default template associated with it
> (Layout):
> 
> class CoolPage extends AbstractPage {
> @Component(parameters{"navbar=coolnavbar",
> "header=coolheader"})
> private Layout _layout;
> 
> private String _coolnavbar = "navbarComponentName"
> private String _coolheader = "headerComponentName"
> 
> etc...
> }
> 
> The component names might be delegated down several
> levels of components to
> whatever component needs that specific information.
> 
> Then Layout.html would look something like:
> <div t:type="navbar"/>
> 
> Layout.java looks like this:
> class Layout {
> private String _navbar;
> 
> accessors here
> }
> 
> The problem occurs because Layout.html does NOT grab
> the injected string
> names put resolves the component to be of type
> navbar which does not exist. 
> 
> I am doing this because the look-and-feel of the
> application carries 3
> layers of components. The layers have just been
> created to wrap the
> components in Yahoo UI divs mostly. I don't want to
> have to redo the default
> layout on every tapestry page if something
> changes.That's why i am trying to
> keep all that in one layout and inject components
> into the layout. The
> layout class doesn't know what component goes where,
> it should just hold a
> basket of injected components and the template
> should know where to put the
> components.
> 
> Any ideas?... or is there a better way?
> -- 
> View this message in context:
>
http://www.nabble.com/Templating-with-Tapestry-5-tf3659025.html#a10223765
> 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
> 
> 


Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  New York:  State University of New York Press, 1997: (4) (5) (p.206)

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