You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Balduran Bu <ba...@bleum.com> on 2009/07/09 08:28:18 UTC
Enum.toString() not honored by t:Select component
Hello,
When t:Select component generates option labels for enums, the
toString() method is not honored at all. It currently generates both
labels and values based on Enum.name() method. In my understanding, the
labels shall be generated based on toString() method instead.
Here is a piece of HTML code T5 generated:
<select id="team" name="team">
<option value="OMS">Oms</option>
<option value="PAYMENT">Payment</option>
</select>
And I expect it shall look like
<select id="team" name="team">
<option value="OMS">OMS</option>
<option value="PAYMENT">Payment</option>
</select>
Here is the enum class:
public enum Team {
OMS, PAYMENT;
public String toString() {
switch(this) {
OMS:
return "OMS";
PAYMENT:
return "Payment";
}
return "":
}
This issue is found in Tapestry 5.1.0.5.
Regards,
Balduran
Re: Enum.toString() not honored by t:Select component
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, Jul 9, 2009 at 4:15 AM, Martin
Strand<do...@gmail.com> wrote:
> To fix your problem, put this in the message catalog (YourPage.properties):
You can also put them in the global message catalog (app.properties).
> oms = OMS
> payment = Payment
You can also use Team.oms (the class name before the enum value name).
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Enum.toString() not honored by t:Select component
Posted by Martin Strand <do...@gmail.com>.
Tapestry looks for a label in your message catalog, if none is found it uses name() to automatically create a proper label.
toString() is not used.
To fix your problem, put this in the message catalog (YourPage.properties):
oms = OMS
payment = Payment
On Thu, 09 Jul 2009 08:28:18 +0200, Balduran Bu <ba...@bleum.com> wrote:
> Hello,
>
>
>
> When t:Select component generates option labels for enums, the
> toString() method is not honored at all. It currently generates both
> labels and values based on Enum.name() method. In my understanding, the
> labels shall be generated based on toString() method instead.
>
>
>
> Here is a piece of HTML code T5 generated:
>
> <select id="team" name="team">
> <option value="OMS">Oms</option>
> <option value="PAYMENT">Payment</option>
> </select>
>
> And I expect it shall look like
> <select id="team" name="team">
> <option value="OMS">OMS</option>
> <option value="PAYMENT">Payment</option>
> </select>
>
>
>
> Here is the enum class:
>
> public enum Team {
>
> OMS, PAYMENT;
>
> public String toString() {
>
> switch(this) {
>
> OMS:
>
> return "OMS";
>
> PAYMENT:
>
> return "Payment";
>
> }
>
> return "":
>
> }
>
>
>
> This issue is found in Tapestry 5.1.0.5.
>
>
>
> Regards,
>
> Balduran
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org