For now I tried the last approach, (InjectContainer), but it throws Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.transform.InjectContainerWorker$1$1.get(InjectContainerWorker.java:80)
It looks like it's not the proper way in my case. Trying other ways. PS: Just wandering, if the container worker gets null, then it probably means, that there is no container at all (for my current page, in which I put the annotation). 2015-10-22 15:40 GMT+02:00 Thiago H de Paula Figueiredo <thiag...@gmail.com> : > On Thu, 22 Oct 2015 06:48:34 -0200, g kuczera <gkucz...@gmail.com> wrote: > > Hi Guys, >> > > Hi! > > I have a custom layout named LayoutM (java class and tml). It is used by my >> page - Activities - like that: >> >> <t:layoutM title="${message:site.title} - ${message:page.title}" >> bodyClass="dashboard" >> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" >> xmlns:p="tapestry:parameter"> >> <!--a lot of stuff --> >> </t:layoutM> >> >> And it implements some kind of interface (class LayoutM implements >> CustomInterface). >> Is there a way to pass LayoutM java class object,+ >> to Activities page? >> > > Yes. The recommended way of passing information (objects) around is > through parameters. When this isn't possible, such as in your case, you can > use the Environment service. Examples in > http://tapestry.apache.org/environmental-services.html > https://tawus.wordpress.com/2011/04/25/tapestry-magic-6-environment/ > > Is something like that correct (if I put it below "a lot of stuff" line)? >> >> <p:fieldName value=${this}></p:fieldName> >> > > No, this isn't correct in two different ways: there's no way to reference > this in the prop binding (the default one) and, in addition, you shouldn't > use ${} expansions in parameters. It's always either useless or a bug. > > What I can see right now is the "this" being an instance of Activities >> class. How can I get the parent layout's object? >> > > @InjectContainer > private Object parentObject; // actually, the field can be of any type you > want. > > But you should try to avoid this, because it couples too much the > component and its parent. Use the Environment instead. > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >