ComponentUtils.addCurrentMarkup(((UISelectOneRadio) select), Markup.INLINE);
}
}
public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
final UISelectOneRadio select = (UISelectOneRadio) component;
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
final String id = select.getClientId(facesContext);
final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, select);
final boolean disabled = select.isDisabled();
final boolean readonly = select.isReadonly();
final Style style = new Style(facesContext, select);
final boolean required = select.isRequired();
// fixme: use CSS, not the Style Attribute for "display"
style.setDisplay(null);
writer.startElement(HtmlElements.OL, select);
writer.writeIdAttribute(id);
writer.writeStyleAttribute(style);
writer.writeClassAttribute(Classes.create(select));
HtmlRendererUtils.writeDataAttributes(facesContext, writer, select);
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
boolean first = true;
final Object value = select.getValue();
for (final SelectItem item : items) {
final String itemId = id + ComponentUtils.SUB_SEPARATOR + item.getValue().toString();
writer.startElement(HtmlElements.LI, select);
writer.startElement(HtmlElements.INPUT, select);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.RADIO, false);
final boolean checked = item.getValue().equals(value);
writer.writeAttribute(HtmlAttributes.CHECKED, checked);
writer.writeNameAttribute(id);
writer.writeIdAttribute(itemId);
final String formattedValue = RenderUtils.getFormattedValue(facesContext, select, item.getValue());
writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
writer.writeAttribute(HtmlAttributes.DISABLED, item.isDisabled() || disabled);
writer.writeAttribute(HtmlAttributes.READONLY, readonly);
writer.writeAttribute(HtmlAttributes.REQUIRED, required);
if (first) {
HtmlRendererUtils.renderFocus(id, select.isFocus(), ComponentUtils.isError(select), facesContext, writer);
first = false;
}
final Integer tabIndex = select.getTabIndex();
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
}
HtmlRendererUtils.renderCommandFacet(select, itemId, facesContext, writer);
writer.endElement(HtmlElements.INPUT);