@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) return;
super.encodeBegin(context, component);
ResponseWriter writer = context.getResponseWriter();
SidePanel sidePanel = (SidePanel) component;
String clientId = sidePanel.getClientId(context);
writer.startElement("div", sidePanel);
writer.writeAttribute("id", clientId, null);
writer.writeAttribute("class", "o_sidepanel_container o_sidepanel_container_" + sidePanel.getAlignment().toString(), null);
//splitter
writer.startElement("div", sidePanel);
writer.writeAttribute("id", clientId + SPLITTER_SUFFIX, null);
String splitterDefaultClass = Styles.getCSSClass(context,
sidePanel, sidePanel.getSplitterStyle(),
"o_sidepanel_splitter o_sidepanel_splitter_" + sidePanel.getAlignment().toString(), sidePanel.getSplitterClass()
);
writer.writeAttribute("class", splitterDefaultClass, null);
writer.endElement("div");
//panel
writer.startElement("div", sidePanel);
writer.writeAttribute("id", clientId + PANEL_SUFFIX, null);
Rendering.writeStandardEvents(writer, sidePanel);
String panelDefaultClass = Styles.getCSSClass(context,
sidePanel, sidePanel.getStyle(),
"o_sidepanel_panel o_sidepanel_panel_" + sidePanel.getAlignment().toString(), sidePanel.getStyleClass()
);
writer.writeAttribute("class", panelDefaultClass, null);
UIComponent captionFacet = sidePanel.getCaptionFacet();
String caption = sidePanel.getCaption();
if (captionFacet != null || caption != null) {
writer.startElement("div", sidePanel);
writer.writeAttribute("id", clientId + CAPTION_SUFFIX, null);
panelDefaultClass = Styles.getCSSClass(context,
sidePanel, sidePanel.getCaptionStyle(),
"o_sidepanel_caption", sidePanel.getCaptionClass()
);
writer.writeAttribute("class", panelDefaultClass, null);
if (captionFacet != null)
captionFacet.encodeAll(context);
else
writer.writeText(caption, null);
writer.endElement("div");
}
//content
writer.startElement("div", sidePanel);
writer.writeAttribute("id", clientId + CONTENT_SUFFIX, "id");
String contentDefaultClass = Styles.getCSSClass(context,
sidePanel, sidePanel.getContentStyle(),
"o_sidepanel_content", sidePanel.getContentClass()
);
writer.writeAttribute("class", contentDefaultClass, null);
encodeInitScript(context, component);
}