protected void encodeOption(FacesContext context, SelectOneMenu menu, SelectItem option, Object values, Object submittedValues, Converter converter) throws IOException {
ResponseWriter writer = context.getResponseWriter();
if(option instanceof SelectItemGroup) {
SelectItemGroup group = (SelectItemGroup) option;
for(SelectItem groupItem : group.getSelectItems()) {
encodeOption(context, menu, groupItem, values, submittedValues, converter);
}
}
else {
String itemValueAsString = getOptionAsString(context, menu, converter, option.getValue());