You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Anton Litvinenko <an...@gmail.com> on 2008/03/23 13:22:33 UTC

Tapestry 5.0.11 and extending components

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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry 5.0.11 and extending components

Posted by Adam Zimowski <zi...@gmail.com>.
I submitted issue for this a while back and Howard fixed this. You
will be able to access row again in 5.0.12.

https://issues.apache.org/jira/browse/TAPESTRY-2271

On Sun, Mar 23, 2008 at 7:22 AM, Anton Litvinenko
<an...@gmail.com> wrote:
> 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: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org