// require AJAX script module
if ( ((DeckAttributes)attributes).getLoadAttributes() != null ) {
require(WidgetScriptModules.BASE_AJAX, protocol, attributes);
}
JavaScriptArrayAttributes listAttributes = (JavaScriptArrayAttributes) getCurrentAttributes(protocol);
renderWidgetClose(protocol, listAttributes);
BlockContainerAttributes blockContainerAttributes = new BlockContainerAttributes();
blockContainerAttributes.copy(attributes);
blockContainerAttributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
renderWidgetOpen(protocol, blockContainerAttributes);
renderWidgetClose(protocol, blockContainerAttributes);
DeckAttributes deckAttributes = (DeckAttributes) attributes;
// Prepare Javascript content.
StringBuffer buffer = new StringBuffer();
if (attributes.getId() != null) {
buffer.append(createJavaScriptWidgetRegistrationOpening(attributes.getId()));
addCreatedWidgetId(attributes.getId());
}
buffer.append("new Widget.Deck(")
.append(createJavaScriptWidgetReference(blockContainerAttributes.getId()))
.append(",{");
// Render display mode.
buffer.append("mode:")
.append(createJavaScriptString(deckAttributes.getStyles()
.getPropertyValues().getComputedValue(StylePropertyDetails.MCS_DECK_MODE)
.getStandardCSS()));
// Render deck pages: loaded or embeeded in static way
LoadAttributes loadAttributes = deckAttributes.getLoadAttributes();
if (loadAttributes != null) {
String when = loadAttributes.getWhen();
if (when == null) when = "onload";
buffer.append(",load: new Widget.DeckLoad({src:")
.append(createJavaScriptString(loadAttributes.getSrc()))
.append(",when:")
.append(createJavaScriptString(when))
.append("})");
} else {
buffer.append(",pages:")
.append(createJavaScriptWidgetReference(listAttributes.getId()));
}
buffer.append("})");
addUsedWidgetId(blockContainerAttributes.getId());
addUsedWidgetId(listAttributes.getId());
if (attributes.getId() != null) {
buffer.append(createJavaScriptWidgetRegistrationClosure());
}