{
// RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
ResponseWriter writer = facesContext.getResponseWriter();
HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel)uiComponent;
HtmlCommandLink link = getLink(facesContext, collapsiblePanel);
collapsiblePanel.getChildren().add(link);
// Always render the link to toggle the collapsed state
RendererUtils.renderChild(facesContext, link);
link.setRendered(false);
// conditionally render the rest of the children
if (!collapsiblePanel.isCollapsed()) {
HtmlRendererUtils.writePrettyLineSeparator(facesContext);
// TODO apply styles from the parent element to this DIV
writer.startElement(HTML.DIV_ELEM, null);
RendererUtils.renderChildren(facesContext, uiComponent);
writer.endElement(HTML.DIV_ELEM );
HtmlRendererUtils.writePrettyLineSeparator(facesContext);
}
link.setRendered(true);
}