* @author Oleg Marshalenko
*/
public class SelectOneRadioRenderer extends SelectManyInputRenderer {
protected void renderWithImages(FacesContext facesContext, ResponseWriter writer, OUISelectManyInputBase selectManyInputBase, List<SelectItem> selectItems, boolean isLineLayout) throws IOException {
SelectOneRadio selectOneRadio = (SelectOneRadio) selectManyInputBase;
String clientId = selectOneRadio.getClientId(facesContext);
if (isLineLayout) {
writer.startElement("tr", selectOneRadio);
}
for (int i = 0; i < selectItems.size(); i++) {
SelectItem selectItem = selectItems.get(i);
if (!isLineLayout) {
writer.startElement("tr", selectOneRadio);
}
writer.startElement("td", selectOneRadio);
String id = getIdIndexed(clientId, i);
String imageId = id + IMAGE_SUFFIX;
writer.startElement(TAG_NAME, selectManyInputBase);
writeAttribute(writer, "id", imageId);
writeAttribute(writer, "type", "image");
writeAttribute(writer, "src", getCurrentImageUrl(facesContext, selectOneRadio, selectItem));
writeCommonAttributes(writer, selectOneRadio, selectItem);
writer.endElement(TAG_NAME);
writer.startElement(TAG_NAME, selectOneRadio);
writeAttribute(writer, "id", id);
writeAttribute(writer, "name", clientId);
writeAttribute(writer, "type", "radio");
writeAttribute(writer, "value", getFormattedValue(selectOneRadio, selectItem.getValue()));
writeAttribute(writer, "style", "display: none;");
if (selectOneRadio.isDisabled() || selectItem.isDisabled()) {
writeAttribute(writer, "disabled", "disabled");
}
if (isValueEquals(selectOneRadio, selectItem)) {
writeAttribute(writer, "checked", "checked");
}