if (hasShadow) {
// shadow begin
writer.startElement(HtmlElements.DIV, box);
writer.writeClassAttribute(Classes.create(box, "shadow"));
Style shadow = new Style();
shadow.setWidth(box.getCurrentWidth().subtract(1));
shadow.setHeight(box.getCurrentHeight().subtract(1));
writer.writeStyleAttribute(shadow);
// border begin
writer.startElement(HtmlElements.DIV, box);
writer.writeClassAttribute(Classes.create(box, "border"));
Style border = new Style();
border.setWidth(box.getCurrentWidth().subtract(3));
border.setHeight(box.getCurrentHeight().subtract(3));
writer.writeStyleAttribute(border);
}
UIComponent label = box.getFacet(Facets.LABEL);
writer.startElement(HtmlElements.DIV, null);
writer.writeClassAttribute(Classes.create(box, "header"));
String labelString = (String) box.getAttributes().get(Attributes.LABEL);
if (label != null) {
RenderUtils.encode(facesContext, label);
} else if (labelString != null) {
writer.writeText(labelString);
}
writer.endElement(HtmlElements.DIV);
final UIMenuBar menuBar = getMenuBarFacet(box);
if (menuBar != null) {
RenderUtils.encode(facesContext, menuBar);
}
UIPanel toolbar = (UIPanel) box.getFacet(Facets.TOOL_BAR);
if (toolbar != null) {
renderToolbar(facesContext, writer, box, toolbar);
}
if (hasShadow) {
// border end
writer.endElement(HtmlElements.DIV);
// shadow end
writer.endElement(HtmlElements.DIV);
}
writer.startElement(HtmlElements.DIV, null);
writer.writeClassAttribute(Classes.create(box, "content")); // needed to be scrollable inside of the box
final Style style = new Style(facesContext, box);
final Measure borderLeft = box.getBorderLeft();
final Measure borderRight = box.getBorderRight();
final Measure borderTop = box.getBorderTop();
final Measure borderBottom = box.getBorderBottom();
style.setWidth(style.getWidth().subtract(borderLeft).subtract(borderRight));
style.setHeight(style.getHeight().subtract(borderTop).subtract(borderBottom));
style.setLeft(borderLeft);
style.setTop(borderTop);
writer.writeStyleAttribute(style);
}