You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org> on 2007/12/18 09:44:43 UTC

[jira] Updated: (TRINIDAD-830) tr:selectOneRadio - no preselection (default value) with java 5 enums

     [ https://issues.apache.org/jira/browse/TRINIDAD-830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias Weßendorf updated TRINIDAD-830:
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.5-core
                   1.0.5-core
           Status: Resolved  (was: Patch Available)

> tr:selectOneRadio - no preselection (default value) with java 5 enums
> ---------------------------------------------------------------------
>
>                 Key: TRINIDAD-830
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-830
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>            Reporter: Gerhard Petracek
>            Priority: Minor
>             Fix For: 1.0.5-core, 1.2.5-core
>
>         Attachments: SimpleSelectOneRenderer_independent.patch
>
>
> sample scenario:
> public class Person
> {
>     ...
>     private Character gender; //I chose Character to compare possibilities
> //+ getter and setter methods
> }
> -> within tr:selectOneRadio the following two selectItems work very well:
> <tr:selectItem label="#{messages.female}" value="f" .../>
> <tr:selectItem label="#{messages.male}" value="m" .../>
> ("f" and "m" is important for the comparison)
> the example above also works with a java 5 enum with one exception - preselected values:
> e.g.:
> public enum Gender
> {
>     female, male
> }
> ->
> public class Person
> {
>     ...
>     private Gender gender;
> //+ getter and setter methods
> }
> in comparison to the first example it would be logical to use the following possibility (with the enum version of this example):
> <tr:selectItem label="#{messages.female}" value="female" .../>
> <tr:selectItem label="#{messages.male}" value="male" .../>
> this version of the example works well with the exception of the preselected/default value
> (e.g. if the page is redisplayed and should provide the previous entered value(s) or a simple default selection which is not reasonable for this gender example...)
> ---
> at the moment the following workaround is possible:
> <tr:selectItem label="#{messages.female}" value="#{pageBean.female}" ..."/>
> <tr:selectItem label="#{messages.male}" value="#{pageBean.male}" ..."/>
> within pageBean:
> public Gender getFemale()
> {
>     return Gender.female;
> }
> public Gender getMale()
> {
>     return Gender.male;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.