OK, I'm not experienced in the InjectContainer annotation, but it seems that one have to write it on each embedded component? I have to figure out. The original intention was that the component's container must not be mentioned anywhere, even not in an annotation.
Von Samsung Mobile gesendet -------- Ursprüngliche Nachricht -------- Von: Thiago H de Paula Figueiredo <thiag...@gmail.com> Datum:13.02.2015 21:03 (GMT+01:00) An: Tapestry users <users@tapestry.apache.org> Betreff: Re: How to get container inside self written component On Fri, 13 Feb 2015 17:26:25 -0200, Erich Gormann <e.gorm...@gormann.de> wrote: > Hi Thiago, Hi! > I see what you mean, but I did not want to manipulate the container > component, but only wanted to look up if a certain (self written) > annotation is present on it and then let the embedded component to do > certain things. > > According to my opinion that would be a nice way to get information > about the container component without knowing it in the embedded > component and without make the unnecessary work for other developers to > write one more parameter besides all other ones. > > I can not see why an additional parameter is the recommended way here. Now that you've given the whole picture, specially the annotation part, now it makes sense to use @InjectContainer. But remember that annotation-level classes are *not* live-reloaded, so, once you put or remove the annotation, this check won't work. It can be made to work indirectly, implementing and contributing a ComponentClassTransformWorker that calls setMeta("someKeyYou'llCreate", "true") in the component's ComponentModel when it has the annotation. To query that in the inner ocmponent, you can @Inject ComponentResources and use the getContainer().getComponentModel().getMeta(String key). -- 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