boolean isSelectItemGroup = (selectItem instanceof SelectItemGroup);
Object itemValue = selectItem.getValue(); // TODO : Check here for getSubmittedValue. Look at RendererUtils.getValue
UISelectMany selectMany = (UISelectMany)uiComponent;
String itemStrValue;
if (converter == null) {
itemStrValue = itemValue.toString();
} else {
itemStrValue = converter.getAsString(facesContext, selectMany,
itemValue);
}
if (isSelectItemGroup) {
if (pageDirectionLayout)
writer.startElement(HTML.TR_ELEM, selectMany);
writer.startElement(HTML.TD_ELEM, selectMany);
writer.write(selectItem.getLabel());
writer.endElement(HTML.TD_ELEM);
if (pageDirectionLayout) {
writer.endElement(HTML.TR_ELEM);
writer.startElement(HTML.TR_ELEM, selectMany);
}
writer.startElement(HTML.TD_ELEM, selectMany);
writer.startElement(HTML.TABLE_ELEM, selectMany);
writer.writeAttribute(HTML.BORDER_ATTR, "0", null);
SelectItemGroup group = (SelectItemGroup) selectItem;
SelectItem[] selectItems = group.getSelectItems();
for (int i=0; i<selectItems.length; i++) {
renderGroupOrItemCheckbox(facesContext, selectMany, selectItems[i], useSubmittedValues, lookupSet, converter, pageDirectionLayout);
}
writer.endElement(HTML.TD_ELEM);
writer.endElement(HTML.TR_ELEM);
writer.endElement(HTML.TABLE_ELEM);
writer.endElement(HTML.TD_ELEM);
if (pageDirectionLayout)
writer.endElement(HTML.TR_ELEM);
} else {
writer.write("\t\t");
if (pageDirectionLayout)
writer.startElement(HTML.TR_ELEM, selectMany);
writer.startElement(HTML.TD_ELEM, selectMany);
writer.startElement(HTML.LABEL_ELEM, selectMany);
boolean checked = (useSubmittedValues && lookupSet
.contains(itemStrValue))
|| (!useSubmittedValues && lookupSet.contains(itemValue));
boolean disabled = selectItem.isDisabled();
String labelClass = null;
boolean componentDisabled = isDisabled(facesContext, selectMany);
if (componentDisabled || disabled) {
labelClass = (String) selectMany.getAttributes().get(JSFAttr.DISABLED_CLASS_ATTR);
} else {
labelClass = (String) selectMany.getAttributes().get(JSFAttr.ENABLED_CLASS_ATTR);
}
if (labelClass != null) {
writer.writeAttribute("class", labelClass, "labelClass");
}