Thank you Ulrich, you put me on the right track to solve the problem.
Here is what I did precisely, just for the ones who'd need it.
In fact EnumSelectModel is final, so you cant extend it, but it's easy
to build one, and T5 does all the work behind, esp. finding the right
labels :
EnumSelectModel esm = new EnumSelectModel(BaseType.class, messages) ; //
messages is injected by T5 IoC
then the options with the right labels can be accessed with :
esm.getOptions()
and the base types you dont want can easily be removed from this list.
José
Ulrich Stärk a écrit :
getValidBaseTypes has to return an Object which implements
org.apache.tapestry5.SelectModel. If you want to filter out some enum
values that shouldn't be displayed you could extend EnumSelectModel
and overwrite the getOptions() method. In your own implementation make
a call to the super class' getOptions() and remove the desired
elements from the list returned.
This just comes to my mind, there might be a more elegant method.
Uli
José Paumard schrieb:
Hello all,
My TML is the following :
<t:select t:id="basetype" t:value="basetype"/>
The baseType property is of type BaseType, an enum with several
values in it. When I declare theses values in the associated
properties file, to make them readable, everything works fine.
Now if I declare my select like that :
<t:select t:id="basetype" t:value="basetype"
model="prop:validbasetypes"/>
The getValidBaseTypes returns an array of some BaseType values.
Without changing my properties file, I expect to see a subset of the
BaseType values in the drop down list (it is the case), in the same
human-readable form. This last point doesnt work, they are not
converted, I have the raw values in the drop down list.
Has anyone saw the same thing ? Is it supposed to work like that, or
is it a bug ?
Thank you,
José
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]