myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Mahoney (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (TOMAHAWK-181) Picklist does not support non-string values
Date Tue, 07 Mar 2006 17:00:38 GMT
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


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


Mime
View raw message