if(!isWidgetSupported(protocol)) {
return;
}
DigitalClockAttributes digitalClockAttributes = (DigitalClockAttributes)attributes;
// require AJAX script module
if( digitalClockAttributes.getRefreshAttributes() != null ) {
require(WidgetScriptModules.BASE_AJAX, protocol, attributes);
}
protocol.writeCloseSpan(clockSpanAttributes);
//retrive list of attributes of clock content element which are
// within the timer element.
List contentAttributes = digitalClockAttributes.getContentAttributes();
// create ClockContentHandler to merge contents
ClockContextHandler clockContextHandler = new ClockContextHandler();
clockContextHandler.mergeContentAttributes(contentAttributes);
String[] digits = clockContextHandler.getClockContentIds("digits");
String[] days = clockContextHandler.getClockContentIds("days");
String[] months = clockContextHandler.getClockContentIds("months");
String[] ampm = clockContextHandler.getClockContentIds("ampm");
String[] separators = clockContextHandler.getClockContentIds("separators");
Styles styles = digitalClockAttributes.getStyles();
StylesExtractor stylesExtractor = createStylesExtractor(
protocol, styles);
String dateTimeFormat =
getDateTimeFormat(stylesExtractor.getDateTimeFormat(),specialMarks);
RefreshAttributes refreshAttributes =
digitalClockAttributes.getRefreshAttributes();
StringBuffer textRefreshAttr = new StringBuffer();
if(refreshAttributes != null) {
textRefreshAttr.append(", refreshURL: ")
.append(createJavaScriptString(refreshAttributes.getSrc()))
.append(", refreshInterval: "+ refreshAttributes.getInterval());
}
StringBuffer textBuffer = new StringBuffer();
textBuffer.append(createJavaScriptWidgetRegistrationOpening(digitalClockAttributes.getId()))
.append("new Widget.Clock(")
.append(createJavaScriptString(clockSpanAttributes.getId()))
.append(", {")
.append("format: [").append(dateTimeFormat).append("], ")
.append("digits: [").append(splitIds(digits)).append("], ")