public class SeparatorRenderer extends LayoutComponentRendererBase {
public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
final UISeparator separator = (UISeparator) component;
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
String label = getLabel(separator);
if (label != null) {
if (VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().isMsie()) {
label = StringUtils.replace(label, " ", HtmlUtils.CHAR_NON_BEAKING_SPACE);
}
writer.startElement(HtmlElements.TABLE, component);
writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.PRESENTATION.toString(), false);
writer.writeIdAttribute(separator.getClientId(facesContext));
writer.writeClassAttribute(Classes.create(component));
HtmlRendererUtils.writeDataAttributes(facesContext, writer, component);
final Style style = new Style(facesContext, separator);
writer.writeStyleAttribute(style);
writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", false);
writer.writeAttribute(HtmlAttributes.CELLSPACING, "0", false);
writer.startElement(HtmlElements.TR, component);
writer.startElement(HtmlElements.TD, component);
writer.writeClassAttribute(Classes.create(component, "start"));
writer.startElement(HtmlElements.HR , component);
writer.endElement(HtmlElements.HR);
writer.endElement(HtmlElements.TD);
writer.startElement(HtmlElements.TD, component);
writer.writeClassAttribute(Classes.create(component, "label"));
writer.writeText(label);
writer.endElement(HtmlElements.TD);
writer.startElement(HtmlElements.TD, component);
writer.writeClassAttribute(Classes.create(component, "end"));
writer.startElement(HtmlElements.HR , component);
writer.endElement(HtmlElements.HR);
writer.endElement(HtmlElements.TD);
writer.endElement(HtmlElements.TR);
writer.endElement(HtmlElements.TABLE);
} else {
writer.startElement(HtmlElements.HR , component);
writer.writeIdAttribute(separator.getClientId(facesContext));
writer.writeClassAttribute(Classes.create(component));
final Style style = new Style(facesContext, separator);
style.setHeight(Measure.ZERO); // not nice
writer.writeStyleAttribute(style);
writer.endElement(HtmlElements.HR);