Well, a simple implementation here may be like: public class Decorate { @Parameter(required = true) private Object by;
@Inject private ComponentResources componentResources; @Inject private Environment environment; Object beginRender() { environment.push(Block.class, componentResources.getBody()); return by; } // in your case, should not render the body, orelse there will be two cases rendered. boolean beforeRenderBody() { return false; } } public class DecoratedBody { @Inject private Environment environment; Object beginRender() { return environment.peek(Block.class); } } I've test and it works. <div t:type="complexcomponent"> <p:titleDecorator> aaa <t:decoratedBody/> bbb </p:titleDecorator> </div> <div t:type="complexcomponent"> <p:titleDecorator> <t:pageLink page="index"><t:decoratedBody/></t:pageLink> </p:titleDecorator> </div> They all work and show what I need. DH ----- Original Message ----- From: "Lukasz Jazgar" <lukasz.jaz...@gmail.com> To: "Tapestry users" <users@tapestry.apache.org> Sent: Saturday, June 06, 2009 5:24 AM Subject: Re: Decoration passed by parameter. Possible? 2009/6/5 Lukasz Jazgar <lukasz.jaz...@gmail.com>: > Suppose, I have a component: > > ComplexComponent.tml > <div> > ... > a lot of tags and components > ... > <span id="title"> > .. complex content .. > </div> > ... > a lot of other tags and components > ... > </div> > > ComplexComponent is very usefull. I use it repeatedly on pages. BUT in > some cases I need "title" to be hyperlink to Tapestry page, in other > cases hyperlink to another page, sometimes external hyperlink or > "mailto:" link. In other cases I need decorate it by border, complex > and unrealizable by only CSS. And finally, I'd like to have > possibility to define any other surrounding of title in the future, > preferably without changing ComplexComponent. > I imagine such a solution: ComplexComponent.java @Parameter @Property Block titleDecorator; ComplexComponent.tml <div> ... a lot of tags and components ... <t:decorate by="titleDecorator"> <span id="title"> .. complex content .. </div> </t:decorate> ... a lot of other tags and components ... </div> Page.tml <t:complexComponent> <t:titleDecorator> <t:pageLink page="otherPage"><t:decoratedBody/></t:pageLink> </t:titleDecorator> </t:complexComponent> Legend: decorate - component a little bit similar to delagate <t:decoratedBody/> - special tag like <t:body/> but relative to containing Block. It's a pity, that it is only imagination. Is it possible to do something similar now? If not, is it technically possible to make such a improvement in future versions? It would be very powerful feature. Lukasz --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org