[richfaces-issues] [JBoss JIRA] (RF-13101) rich:select Method getSelectInputLabel is not working when using objects

J W (JIRA) jira-events at lists.jboss.org
Mon Aug 12 03:50:26 EDT 2013


     [ https://issues.jboss.org/browse/RF-13101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

J W updated RF-13101:
---------------------

    Workaround Description: 
Replace {code} AbstractSelectComponent select = (AbstractSelectComponent) component;
        Object value = select.getSubmittedValue();
        String label = null;
        if (value == null) {
            value = select.getValue();
            if (value == null) {
                value = ""; // Find Default-Values too.
            }
        }
        value = value.toString(); // needed to compare string-sepresentations

        Iterator<SelectItem> items = SelectUtils.getSelectItems(facesContext, component);

        while (items.hasNext()) {
            SelectItem item = items.next();
            Object itemValue = item.getValue();
            //prevent NPE
            if (itemValue != null) {
                if (value.equals(itemValue.toString())) {
                    label = item.getLabel();
                    break;
                }
            }
        }

        if (label == null) {
            label = value.toString();
        }
        return label;
{code}

  was:
Replace {code}org.richfaces.renderkit.SelectHelper.getSelectInputLabel(FacesContext facesContext, UIComponent component){code} with the following:

{code}public static String getSelectInputLabel(FacesContext facesContext, UIComponent component) {
        String label = null;
        String selectedValue = InputUtils.getInputValue(facesContext, component);
        if (selectedValue != null) {
            List<ClientSelectItem> convertedSelectItems = RichFacesSelectHelper.getConvertedSelectItems(facesContext, component);
            for (ClientSelectItem clientSelectItem : convertedSelectItems) {
                if (selectedValue.equals(clientSelectItem.getConvertedValue())) {
                    label = clientSelectItem.getLabel();
                    break;
                }
            }
        }
        return label;
{code}


    
> rich:select Method getSelectInputLabel is not working when using objects
> ------------------------------------------------------------------------
>
>                 Key: RF-13101
>                 URL: https://issues.jboss.org/browse/RF-13101
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input, component-selects
>    Affects Versions: 4.3.2, 5.0.0.Alpha1
>            Reporter: J W
>              Labels: rich:select, select
>             Fix For: 4.5.0.Alpha1
>
>   Original Estimate: 30 minutes
>  Remaining Estimate: 30 minutes
>
> The condition of the if-statement in org.richfaces.renderkit.SelectHelper.getSelectInputLabel(FacesContext facesContext, UIComponent component) is not working with the string-representations of the items. If using cloned objects the equals method will return false, even if the items are the same, because the IDs are different.
> The method should use only the strings of the objects, similiar to how MyFaces has solved this (check workarround).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list