rich:comboBox ignore label of SelectItem(s)
-------------------------------------------

                 Key: RF-5385
                 URL: https://jira.jboss.org/jira/browse/RF-5385
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.2.2
         Environment: java 1.5
myfaces 1.2
            Reporter: Andreas Höhmann
            Priority: Critical


<rich:comboBox id="scaleOfActions"
                               defaultLabel="Enter some value"
                               directInputSuggestions="false"
                               enableManualInput="false"
                               selectFirstOnUpdate="false"
                               value="#{Bean.value}">
   <f:selectItems 
value="#{utils:selectItemsLocalizedEnumString('PER_HOUR,PER_DAY,PER_WEEK,PER_MONTH,PER_YEAR')}"
 />
</rich:comboBox>

I expected this (this is the correct output of h:selectOneMenu with a4j:support 
...)

<select id="form_subsystem_safety:scaleOfActions" class="smallField" 
name="form_subsystem_safety:scaleOfActions" size="1" 
onkeyup="if(event.keyCode!=13) return false; 
;A4J.AJAX.Submit('_viewRoot','form_subsystem_safety',event,{'eventsQueue':'sid','parameters':{'form_subsystem_safety:scaleOfActions_livevalidation_enterpressed':'form_subsystem_safety:scaleOfActions_livevalidation_enterpressed'}
 
,'actionUrl':'../../sid-base-web-app/main/sid.jsf;jsessionid=1xss4deh2fa52','ignoreDupResponses':true,'requestDelay':250}
 )" style="" 
onchange=";A4J.AJAX.Submit('_viewRoot','form_subsystem_safety',event,{'eventsQueue':'sid','parameters':{'form_subsystem_safety:scaleOfActions_livevalidation_onchange':'form_subsystem_safety:scaleOfActions_livevalidation_onchange'}
 
,'actionUrl':'../../sid-base-web-app/main/sid.jsf;jsessionid=1xss4deh2fa52','ignoreDupResponses':true,'requestDelay':250}
 )">
<option value="PER_HOUR" selected="selected" title="PER_HOUR">Pro 
Stunde</option>
<option value="PER_DAY" title="PER_DAY">Pro Tag</option>
<option value="PER_WEEK" title="PER_WEEK">Pro Woche</option>
<option value="PER_MONTH" title="PER_MONTH">Pro Monat</option>
<option value="PER_YEAR" title="PER_YEAR">Pro Jahr</option>
</select>

You see the items are correct localized ...

but rich:combobox render this:

<div id="form_subsystem_safety:scaleOfActions_r"><div class="rich-combobox-font 
rich-combobox smallField" id="form_subsystem_safety:scaleOfActions_rcombobox" 
style="width: 148px; position: static; z-index: 0;" 
onkeyup="if(event.keyCode!=13) return false; 
;A4J.AJAX.Submit('_viewRoot','form_subsystem_safety',event,{'eventsQueue':'sid','parameters':{'form_subsystem_safety:scaleOfActions_r_livevalidation_enterpressed':'form_subsystem_safety:scaleOfActions_r_livevalidation_enterpressed'}
 
,'actionUrl':'../../sid-base-web-app/main/sid.jsf;jsessionid=1xss4deh2fa52','ignoreDupResponses':true,'requestDelay':250}
 )"><div class="rich-combobox-list-cord"/><div class="rich-combobox-font 
rich-combobox-shell" style="width: 150px;"><input type="text" 
autocomplete="off" class="rich-combobox-font-inactive 
rich-combobox-input-inactive" 
id="form_subsystem_safety:scaleOfActions_rcomboboxField" 
name="form_subsystem_safety:scaleOfActions_rcomboboxField" readonly="true" 
style="width: 135px;" value="!
 PER_HOUR"/><input type="text" class="rich-combobox-font-inactive 
rich-combobox-button-background-inactive rich-combobox-button-inactive" 
id="form_subsystem_safety:scaleOfActions_rcomboBoxButtonBG" 
readonly="true"/><input type="text" class="rich-combobox-font-inactive 
rich-combobox-button-icon-inactive rich-combobox-button-inactive" 
id="form_subsystem_safety:scaleOfActions_rcomboboxButton" readonly="true" 
style=""/><div class="rich-combobox-strut rich-combobox-font" style="width: 
140px;">Strut</div></div><input type="hidden" 
id="form_subsystem_safety:scaleOfActions_rcomboboxValue" 
name="form_subsystem_safety:scaleOfActions_r" value="PER_HOUR" class=""/><div 
class="rich-combobox-list-cord" 
id="form_subsystem_safety:scaleOfActions_rlistParent" style="position: 
absolute; z-index: 1000; visibility: visible; left: 458px; top: 173px; display: 
none;"><div class="rich-combobox-shadow"><table cellspacing="0" cellpadding="0" 
border="0" id="form_subsystem_safety:scaleOfActions_rshadow"!
  style="width: 157px; height: 129px;"><tbody><tr><td class="rich-combo
box-shadow-tl"><img height="1" width="10" border="0" 
src="../../sid-base-web-app/a4j/g/3_2_2.SR1images/spacer.gif.jsf"/><br/></td><td
 class="rich-combobox-shadow-tr"><img height="10" width="1" border="0" 
src="../../sid-base-web-app/a4j/g/3_2_2.SR1images/spacer.gif.jsf"/><br/></td></tr><tr><td
 class="rich-combobox-shadow-bl"><img height="10" width="1" border="0" 
src="../../sid-base-web-app/a4j/g/3_2_2.SR1images/spacer.gif.jsf"/><br/></td><td
 class="rich-combobox-shadow-br"><img height="10" width="10" border="0" 
src="../../sid-base-web-app/a4j/g/3_2_2.SR1images/spacer.gif.jsf"/><br/></td></tr></tbody></table></div><div
 class="rich-combobox-list-position" 
id="form_subsystem_safety:scaleOfActions_rlistPosition"><div 
class="rich-combobox-list-decoration" 
id="form_subsystem_safety:scaleOfActions_rlistDecoration"><div 
class="rich-combobox-list-scroll" 
id="form_subsystem_safety:scaleOfActions_rlist" style="height: 120px; width: 
148px;"/></div></div></div></div><script type="text/jav!
 ascript">//<![CDATA[

var clientId = 'form_subsystem_safety:scaleOfActions_r';
                RichComboUtils.execOnLoad( function(){ 
                Richfaces.ComboBox.CLASSES = {
                        BUTTON : {CLASSES :
                                                 {NORMAL : 
"rich-combobox-font-inactive rich-combobox-button-icon-inactive 
rich-combobox-button-inactive  ", 
                                                  ACTIVE : "rich-combobox-font 
rich-combobox-button-icon rich-combobox-button ", 
                                                  DISABLED : 
"rich-combobox-font-disabled rich-combobox-button-icon-disabled 
rich-combobox-button-disabled ",
                                                  HOVERED : 
"rich-combobox-button-hovered"},
                                          STYLE : 
                                                 {NORMAL: "",
                                                  ACTIVE: "",
                                                  DISABLED:     ""}
                                          },     
                        BUTTONBG : {CLASSES :
                                         {NORMAL:"rich-combobox-font-inactive 
rich-combobox-button-background-inactive rich-combobox-button-inactive", 
                          ACTIVE: "rich-combobox-font 
rich-combobox-button-background rich-combobox-button",
                                          DISABLED : 
"rich-combobox-font-disabled rich-combobox-button-background-disabled 
rich-combobox-button-disabled"}
                                 },    
                        BUTTONICON : {STYLE : 
                                                        {NORMAL: "",
                                                         ACTIVE: "",
                                                         DISABLED: ""}
                                          },                                    
                                  
                        FIELD : {CLASSES: 
                                                {NORMAL : 
"rich-combobox-font-inactive rich-combobox-input-inactive ", 
                                                ACTIVE : "rich-combobox-font 
rich-combobox-input ", 
                                                DISABLED : 
"rich-combobox-font-disabled rich-combobox-input-disabled "},
                                         STYLE :        
                                                {NORMAL : "",
                                                  ACTIVE : "",
                                                  DISABLED : ""}
                                         },     
                        COMBO_LIST : {
                                LIST : {CLASSES :{ACTIVE : 
"rich-combobox-list-cord rich-combobox-list-scroll 
rich-combobox-list-decoration rich-combobox-list-position "},
                                            STYLE : {ACTIVE: ""}
                                           },                             
                                ITEM : {NORMAL : "rich-combobox-item ", 
                                        SELECTED : "rich-combobox-item 
rich-combobox-item-selected "
                                }
                        }
                }
                
                var combobox = new Richfaces.ComboBox( 
"form_subsystem_safety:scaleOfActions_r", 
                                                                                
           "form_subsystem_safety:scaleOfActions_rlist", 
                                                                                
           "form_subsystem_safety:scaleOfActions_rlistParent",
                                                                                
           "form_subsystem_safety:scaleOfActions_rcomboboxValue",
                                                                                
           "form_subsystem_safety:scaleOfActions_rcomboboxField", 
                                                                                
           "form_subsystem_safety:scaleOfActions_rcomboboxButton", 
                                                                                
           "form_subsystem_safety:scaleOfActions_rcomboBoxButtonBG",
                                                                                
           "form_subsystem_safety:scaleOfActions_rshadow",
                                                                                
           Richfaces.ComboBox.CLASSES, 
                                                                                
           "150px", "200px",
                                                                                
           ['PER_HOUR','PER_DAY','PER_WEEK','PER_MONTH','PER_YEAR'] , 
                                                                                
           false, 
                                                                                
           true, 
                                                                                
           false,
                                                                                
           null, 
                                                                                
           null,
                                                                                
           "Enter some value",
                                                                                
           false, 'PER_HOUR', 
                                                                                
           0,  0);
          }, 
RichComboUtils.Condition.ElementPresent("form_subsystem_safety:scaleOfActions_r"),
 100);
//
//]]>
</script></div>

The result is a unlocalized ui.

I guess the problem is in org.richfaces.renderkit.ComboBoxBaseRenderer:

public List<Object> encodeItems(FacesContext context, UIComponent component) 
throws IOException, IllegalArgumentException {
        if (!isAcceptableComponent(component)) {
            return null;
        }

        UIComboBox comboBox = (UIComboBox) component;
        Object suggestionValues = comboBox.getSuggestionValues();
        ResponseWriter writer = context.getResponseWriter();
        List <Object>values = encodeSuggestionValues(context, component, 
writer, suggestionValues);
        List<SelectItem> selectItems = SelectUtils.getSelectItems(context, 
component);
        for (SelectItem selectItem : selectItems) {
            String value = getConvertedStringValue(context, comboBox, 
selectItem.getValue());
           // 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           // selectItem.getLabel() will never called - why?
            values.add(value);
            encodeSuggestion(writer, comboBox, value, 
RICH_COMBOBOX_ITEM_CLASSES);
            
        }
        return values;
    }

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

       

_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to