protected void encodeMarkup(FacesContext context, Panel panel) throws IOException {
ResponseWriter writer = context.getResponseWriter();
String clientId = panel.getClientId(context);
String widgetVar = panel.resolveWidgetVar();
Menu optionsMenu = panel.getOptionsMenu();
boolean collapsed = panel.isCollapsed();
boolean visible = panel.isVisible();
writer.startElement("div", null);
writer.writeAttribute("id", clientId, null);
String styleClass = panel.getStyleClass() == null ? Panel.PANEL_CLASS : Panel.PANEL_CLASS + " " + panel.getStyleClass();
if(collapsed) {
styleClass += " ui-hidden-container";
if(panel.getToggleOrientation().equals("horizontal")) {
styleClass += " ui-panel-collapsed-h";
}
}
if(!visible) {
styleClass += " ui-helper-hidden";
}
writer.writeAttribute("class", styleClass, "styleClass");
if(panel.getStyle() != null) {
writer.writeAttribute("style", panel.getStyle(), "style");
}
writer.writeAttribute(HTML.WIDGET_VAR, widgetVar, null);
renderDynamicPassThruAttributes(context, panel);
encodeHeader(context, panel);
encodeContent(context, panel);
encodeFooter(context, panel);
if(panel.isToggleable()) {
encodeStateHolder(context, panel, clientId + "_collapsed", String.valueOf(collapsed));
}
if(panel.isClosable()) {
encodeStateHolder(context, panel, clientId + "_visible", String.valueOf(visible));
}
if (optionsMenu != null) {
optionsMenu.setOverlay(true);
optionsMenu.setTrigger("@(" + ComponentUtils.escapeJQueryId(clientId) + "_menu)");
optionsMenu.setMy("left top");
optionsMenu.setAt("left bottom");
optionsMenu.encodeAll(context);
}
writer.endElement("div");
}