You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Bruno Aranda (JIRA)" <de...@myfaces.apache.org> on 2006/03/30 17:00:28 UTC

[jira] Closed: (TOMAHAWK-181) Picklist does not support non-string values

     [ http://issues.apache.org/jira/browse/TOMAHAWK-181?page=all ]
     
Bruno Aranda closed TOMAHAWK-181:
---------------------------------

    Fix Version: 1.1.2-SNAPSHOT
     Resolution: Fixed
      Assign To: Bruno Aranda

Patch applied in the SVN. Thanks to Peter Mahoney!

> Picklist does not support non-string values
> -------------------------------------------
>
>          Key: TOMAHAWK-181
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-181
>      Project: MyFaces Tomahawk
>         Type: Bug
>     Versions: 1.1.2-SNAPSHOT
>     Reporter: Peter Mahoney
>     Assignee: Bruno Aranda
>      Fix For: 1.1.2-SNAPSHOT
>  Attachments: picklist.patch
>
> The method selectItemsForSelectedList() in HtmlPicklistRenderer currently compares the value of the SelectItem with the value from the lookup set, which will always be a string.
> Converting the SelectItem value to a string before the comparison solves the problem. The method becomes:
>     private List selectItemsForSelectedList(FacesContext facesContext,
>                                             UIComponent uiComponent, List selectItemList, Converter converter,
>                                             Set lookupSet)
>     {
>         List selectItemForSelectedValues = new ArrayList(lookupSet.size());
>         for (Iterator i = selectItemList.iterator(); i.hasNext();)
>         {
>             //set.add( RendererUtils.getConvertedStringValue(facesContext, uiComponent, converter, i.next()) );
>             SelectItem selectItem = (SelectItem) i.next();
> // Convert the item value to a string
>             String itemStrValue = RendererUtils.getConvertedStringValue(facesContext, uiComponent,
>                     converter, selectItem);
>             
>             for (Iterator i2 = lookupSet.iterator(); i2.hasNext();)
>             {
>                 Object value = i2.next();
> // Compare the lookup value with the string
>                 if (value.equals(itemStrValue))
>                 {
>                     selectItemForSelectedValues.add(selectItem);
>                 }
>             }
>         }
>         return selectItemForSelectedValues;
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira