@Override
protected void encodeScriptsAndStyles(FacesContext context, PopupLayer component) throws IOException {
super.encodeScriptsAndStyles(context, component);
Confirmation confirmation = (Confirmation) component;
String invokerId;
String aFor = confirmation.getFor();
if (aFor != null)
invokerId = Components.referenceIdToClientId(context, confirmation, aFor);
else if (!confirmation.isStandalone())
invokerId = confirmation.getParent().getClientId(context);
else
invokerId = null;
String iconAreaStyle = Styles.getCSSClass(context, component, confirmation.getIconAreaStyle(),
DEFAULT_ICON_BACKPLANE_CLASS, confirmation.getIconAreaClass());
String rolloverIconAreaStyle = Styles.getCSSClass(context, component, confirmation.getRolloverIconAreaStyle(),
StyleGroup.rolloverStyleGroup(), confirmation.getRolloverIconAreaClass());
rolloverIconAreaStyle = Styles.mergeClassNames(iconAreaStyle, rolloverIconAreaStyle);
String textAreaStyle = Styles.getCSSClass(context, component, confirmation.getContentStyle(), DEFAULT_TEXT_BACKPLANE_CLASS, confirmation.getContentClass());
String rolloverTextAreaStyle = Styles.getCSSClass(context, component, confirmation.getRolloverContentStyle(), StyleGroup.rolloverStyleGroup(), confirmation.getRolloverContentClass());
rolloverTextAreaStyle = Styles.mergeClassNames(textAreaStyle, rolloverTextAreaStyle);
String headerTextStyle = Styles.getCSSClass(context, component, confirmation.getMessageStyle(), DEFAULT_HEADER_TEXT_CLASS, confirmation.getMessageClass());
String rolloverHeaderTextStyle = Styles.getCSSClass(context, component, confirmation.getRolloverMessageStyle(), StyleGroup.rolloverStyleGroup(), confirmation.getRolloverMessageClass());
rolloverHeaderTextStyle = Styles.mergeClassNames(headerTextStyle, rolloverHeaderTextStyle);
String messageHeaderText = confirmation.getMessage();
boolean hasMessage = messageHeaderText != null && messageHeaderText.length() > 0;
String defaultDetailsTextClass = hasMessage ? DEFAULT_DETAILS_TEXT_MESSAGE_CLASS : DEFAULT_DETAILS_TEXT_CLASS;
String detailsTextStyle = Styles.getCSSClass(context, component, confirmation.getDetailsStyle(), defaultDetailsTextClass, confirmation.getDetailsClass());
String rolloverDetailsTextStyle = Styles.getCSSClass(context, component, confirmation.getRolloverDetailsStyle(), StyleGroup.rolloverStyleGroup(), confirmation.getRolloverDetailsClass());
rolloverDetailsTextStyle = Styles.mergeClassNames(detailsTextStyle, rolloverDetailsTextStyle);
String buttonAreaStyle = Styles.getCSSClass(context, component, confirmation.getButtonAreaStyle(), DEFAULT_BUTTON_BACKPLANE_CLASS, confirmation.getButtonAreaClass());
String rolloverButtonAreaStyle = Styles.getCSSClass(context, component, confirmation.getRolloverButtonAreaStyle(), StyleGroup.rolloverStyleGroup(), confirmation.getRolloverButtonAreaClass());
rolloverButtonAreaStyle = Styles.mergeClassNames(buttonAreaStyle, rolloverButtonAreaStyle);
String okButtonStyle = Styles.getCSSClass(context, component, confirmation.getOkButtonStyle(), DEFAULT_YES_BUTTON_CLASS, confirmation.getOkButtonClass());
String rolloverOkButtonStyle = Styles.getCSSClass(context, component, confirmation.getRolloverOkButtonStyle(), StyleGroup.rolloverStyleGroup(), confirmation.getRolloverOkButtonClass(), DEFAULT_ROLLOVER_BUTTON_CLASS);
rolloverOkButtonStyle = Styles.mergeClassNames(okButtonStyle, rolloverOkButtonStyle);
String cancelButtonStyle = Styles.getCSSClass(context, component, confirmation.getCancelButtonStyle(), DEFAULT_NO_BUTTON_CLASS, confirmation.getCancelButtonClass());
String rolloverCancelButtonStyle = Styles.getCSSClass(context, component, confirmation.getRolloverCancelButtonStyle(), StyleGroup.rolloverStyleGroup(), confirmation.getRolloverCancelButtonClass(), DEFAULT_ROLLOVER_BUTTON_CLASS);
rolloverCancelButtonStyle = Styles.mergeClassNames(cancelButtonStyle, rolloverCancelButtonStyle);
ScriptBuilder sb = new ScriptBuilder();
String event = Rendering.getEventWithOnPrefix(context, confirmation, "o:confirmation");
sb.initScript(context, confirmation, "O$.Confirmation._init",
invokerId,
event,
confirmation.getDefaultButton(),
confirmation.getAlignToInvoker(),
new Object[]{
iconAreaStyle,
rolloverIconAreaStyle,
textAreaStyle,
rolloverTextAreaStyle,