Hello!
Sometime ago i needed to override default behavior of GridRows
component used inside the Grid (i needed to display more than one
table row for each grid row). For that sake i couldn't find anything
more elegant than extend both Grid and GridRows components (by
extending i mean extending java class extending + copy-paste of
components template).
Today i tried to migrate to Tapestry 5.0.11 and my extensions refused
to compile because all property getter methods were substituted with
Property annotation (e.g. row property of GridRows component).
So, i tried to access needed properties right from the template, but
that caused an exception (cause i needed to access object specific
properties of the row object) :
Could not convert 'row.historyEntry.changes' into a component
parameter binding: Class java.lang.Object does not contain a property
named 'historyEntry' (within property expression
'row.historyEntry.changes'). Available properties: class.
Previously i had a method in my copy of GridRows component which did
something like that:
return ((HistoryEntryDetails) getRow()).getHistoryEntry().getChanges();
I have also found the request by Adam Zimowski to make some other Grid
component propety accessible (again) via getter method:
https://issues.apache.org/jira/browse/TAPESTRY-2271
For now i was able to solve my problem by accessing row property on the grid:
Component container = componentResources.getContainer();
Object row = propertyAccess.get(container, "row");//
return ((HistoryEntryDetails) row).getHistoryEntry().getChanges();
But, after all neither the earlier (inheritance + copypasting) nor
current solution (inheritance + copypasting + usage of
propertyAccess/making property accessible via getter) is elegant. So,
is there any other way of overriding behavior of Grid component? Or
should i file my request to make property XXX accessible each time
something similar happens?
Cheers,
Anton
--
http://www.sourcekibitzer.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]