String value = String.valueOf(foldingPanel.isExpanded());
Rendering.renderHiddenField(writer, component.getClientId(context) + STATE_SUFFIX, value);
}
private void renderInitScript(FacesContext context, UIComponent component) throws IOException {
FoldingPanel foldingPanel = (FoldingPanel) component;
LoadingMode loadingMode = foldingPanel.getLoadingMode();
String defaultClass = Styles.getCSSClass(context, foldingPanel, Rendering.DEFAULT_FOCUSED_STYLE, StyleGroup.selectedStyleGroup(0));
String focusedClass = Styles.getCSSClass(context,
foldingPanel,
foldingPanel.getFocusedStyle(), StyleGroup.selectedStyleGroup(1), foldingPanel.getFocusedClass(), defaultClass);
String focusedContentClass = Styles.getCSSClass(context, foldingPanel,
foldingPanel.getFocusedContentStyle(), StyleGroup.selectedStyleGroup(0), foldingPanel.getFocusedContentClass(), null);
String focusedCaptionClass = Styles.getCSSClass(context, foldingPanel,
foldingPanel.getFocusedCaptionStyle(), StyleGroup.selectedStyleGroup(0), foldingPanel.getFocusedCaptionClass(), null);
String rolloverTogglableCaptionClass = Styles.getCSSClass(context, foldingPanel,
foldingPanel.getRolloverTogglableCaptionStyle(), StyleGroup.rolloverStyleGroup(),
foldingPanel.getRolloverTogglableCaptionClass(),
DEFAULT_CAPTION_TOGGLABLE_ROLLOVER_CLASS);
ScriptBuilder sb = new ScriptBuilder();
sb.initScript(context, foldingPanel, "O$.FoldingPanel._init",
foldingPanel.isExpanded(),
foldingPanel.getFoldingDirection(),
Rendering.getRolloverClass(context, foldingPanel),
loadingMode,
foldingPanel.isFocusable(),
focusedClass,
focusedContentClass,
focusedCaptionClass,
foldingPanel.getToggleOnCaptionClick(),
rolloverTogglableCaptionClass);
Rendering.renderInitScript(context, sb, Resources.utilJsURL(context),
Resources.internalURL(context, "panel/foldingPanel.js"));
}