You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Penza <jo...@gmail.com> on 2007/09/25 13:48:44 UTC

T5 and Enum

In the tapestry 5 Forms tutorial, is demonstrated how one can customize the
options in the drop down list.

The Honorific Enum values are customized in the page.properties

This works really nice.

Next I added an AddressDetail page that display address information.

For example like this:

${address.honorific}
${address.firstName}

But this time the customized enum values (in AddressDetail.properties) are
ignored and the values defined in the enum Honorific.java are printed on the
screen.

How can I customize these values, like in the drop down list?

Re: T5 and Enum

Posted by Howard Lewis Ship <hl...@gmail.com>.
${....} in text, or in an attribute, evaluates its expression and converts
it to a string, which is then streamed out as part of the response.

You need something else, something similar to the GridCell component,
capable of extracting a property and finding a strategy for presenting it to
the user.  The strategy for Enum types, inside a Grid, inlcudes all the
machinery for picking up user-presentable labels from the message catalog,
or fabricating them on the fly.

I expect to put together a BeanDisplay component that will do for a single
bean what Grid does for a collection of beans (more or less).  Kind of a
counterpart to BeanEditForm and BeanEditor.

On 9/25/07, Josh Penza <jo...@gmail.com> wrote:
>
> In the tapestry 5 Forms tutorial, is demonstrated how one can customize
> the
> options in the drop down list.
>
> The Honorific Enum values are customized in the page.properties
>
> This works really nice.
>
> Next I added an AddressDetail page that display address information.
>
> For example like this:
>
> ${address.honorific}
> ${address.firstName}
>
> But this time the customized enum values (in AddressDetail.properties) are
> ignored and the values defined in the enum Honorific.java are printed on
> the
> screen.
>
> How can I customize these values, like in the drop down list?
>



-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind