I'm not sure if I understood your requirement correctly but I think you need to have a reference to the element on which the mixin is applied, correct ?
You can use this: @InjectContainer > private ClientElement clientElement; On Fri, Jul 6, 2012 at 10:22 AM, mem <memcacher+tapes...@gmail.com> wrote: > Hello, > > i'd like to extend some components with the ability to render certain nodes > with an additional attribute which is then picked up in JS and used as a > keybinding for shortcuts. > So far i created a mixin which i preferably would like to put on any kind > of > component, in case of an EventLink it should simply render: > link > instead of: > link > This works like expected but a problem comes up with components that > contain > components, for example: > public class MyComponent > { > @Component(//parameters) > private EventLink edit; > > ... more stuff in here > } > > Now i'd like to use 'MyComponent' on different pages where on some pages > i'd > like to use the mixin whereas on others i don't. I also don't want to > change > the component and add the mixin in the component and a parameter to control > if it should be active or not. > When debugging i found the rendered elements are available in class > RenderQueueImpl in the Stack<ComponentResources> renderingComponents, other > than that i couldn't find any appearance and don't know if or how to inject > or access the element. > I'd like to pass the component name and optionally the container > component(s) in a fashion like: > 'myComponent.edit' where myComponent is the variable name as in: > @Component > private MyComponent myComponent; > to my mixin. > Is there any way i can filter the rendered element in the render phases? > > @BeginRender > void beginRender(final MarkupWriter markupWriter) > { > markupWriter.addListener(new MarkupWriterListener() > { > @Override > public void elementDidEnd(final Element element) > { > /** > * here i'd like to put my if(element == parameter) > * where element is the currently rendered component > * and parameter is the passed parameter somhow in the > * fashion of containerName.componentName > */ > element.attribute(ATTRIBUTE_NAME, shortcut); > } > > @Override > public void elementDidStart(Element element) > { > } > }); > } > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/How-to-resolve-the-rendered-component-in-a-mixin-tp5714315.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- *Regards,* *Muhammad Gelbana Java Developer*