}
@Override
protected void encodeOption(FacesContext context, UIInput component, Object values, Object submittedValues, Converter converter, SelectItem option, int idx) throws IOException {
ResponseWriter writer = context.getResponseWriter();
SelectManyCheckbox checkbox = (SelectManyCheckbox) component;
String itemValueAsString = getOptionAsString(context, component, converter, option.getValue());
String name = checkbox.getClientId(context);
String id = name + UINamingContainer.getSeparatorChar(context) + idx;
boolean disabled = option.isDisabled() || checkbox.isDisabled();
Object valuesArray;
Object itemValue;
if(submittedValues != null) {
valuesArray = submittedValues;
itemValue = itemValueAsString;
} else {
valuesArray = values;
itemValue = option.getValue();
}
boolean selected = isSelected(context, component, itemValue, valuesArray, converter);
if(option.isNoSelectionOption() && values != null && !selected) {
return;
}
writer.startElement("input", null);
writer.writeAttribute("id", id, null);
writer.writeAttribute("name", name, null);
writer.writeAttribute("type", "checkbox", null);
writer.writeAttribute("value", itemValueAsString, null);
renderOnchange(context, checkbox);
renderDynamicPassThruAttributes(context, checkbox);
if (checkbox.getTabindex() != null) writer.writeAttribute("tabindex", checkbox.getTabindex(), null);
if (selected) writer.writeAttribute("checked", "checked", null);
if (disabled) writer.writeAttribute("disabled", "disabled", null);
writer.endElement("input");