if (!(component instanceof UISelectBoolean)) {
LOG.error("Wrong type: Need " + UISelectBoolean.class.getName() + ", but was " + component.getClass().getName());
return;
}
UISelectBoolean selectBoolean = (UISelectBoolean) component;
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
UIComponent label = ComponentUtil.provideLabel(facesContext, selectBoolean);
boolean inline = ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_INLINE);
if (label != null && !inline) {
writer.startElement(HtmlConstants.TABLE, selectBoolean);
writer.writeAttribute(HtmlAttributes.BORDER, 0);
writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
HtmlRendererUtil.renderTip(component, writer);
writer.startElement(HtmlConstants.TR, null);
writer.startElement(HtmlConstants.TD, null);
}
String currentValue = getCurrentValue(facesContext, selectBoolean);
boolean checked = "true".equals(currentValue);
writer.startElement(HtmlConstants.INPUT, selectBoolean);
writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
writer.writeAttribute(HtmlAttributes.VALUE, "true", false);
writer.writeAttribute(HtmlAttributes.CHECKED, checked);
if (ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_READONLY)) {
writer.writeAttribute(HtmlAttributes.READONLY, true);
if (checked) {
writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=true", false);
} else {
writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=false", false);
}
}
writer.writeNameAttribute(selectBoolean.getClientId(facesContext));
writer.writeClassAttribute();
writer.writeIdAttribute(selectBoolean.getClientId(facesContext));
writer.writeAttribute(HtmlAttributes.DISABLED,
ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_DISABLED));
Integer tabIndex = selectBoolean.getTabIndex();
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
}
String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectBoolean);
if (title != null) {