n Mon, Jul 6, 2009 at 10:20 AM, Jonathan O'Connor<ninki...@eircom.net> wrote: > Hi,
Hi! > I'm pretty sure what the answer is, but can someone confirm that it is not > possible to use java inheritance to extend a component class? Yes, it is. > What I'm trying to do is add a CSV Download button to a Grid, preferably > aligned to the right of the table. I can override the .tml files of the > existing components, but I would prefer to not have to duplicate all the > java code from the Grid class. Tapestry built-in components have most of their method package-private or private for backward compatibility, so subclassing them isn't the answer most of the time. > I considered using a mixin, but that does not allow the mixin to create > other components. Or have I got that wrong? Just Tapestry itself can instantiate components, so I guess you got something wrong here. And I think a mixin it's the best way of doing what you want: @InjectContainer the Grid, use Grid.getGridDataSource(), Grid.getDataModel() (to get the BeanModel), maybe Grid.getCurrentPage(), create an EventLink and return a StreamResponse in its handler method. Take a look at the Autocomplete mixin source for inspiration. No need for subclassing here. Another example, but more complex: http://ars-machina.svn.sourceforge.net/viewvc/ars-machina/tapestry-crud/branches/1.1/src/main/java/br/com/arsmachina/tapestrycrud/mixins/TreeGrid.java?revision=594&view=markup. It is a mixin that provides a tree-like visualization to a Grid. -- Thiago --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org