if(!isWidgetSupported(protocol)) {
return;
}
ItemDisplayAttributes itemDisplayAttributes = (ItemDisplayAttributes) attributes;
// Render popup closure.
getWidgetDefaultModule(protocol).getPopupRenderer().renderClose(protocol, popupAttributes);
// Prepare Javascript content.
StringWriter scriptWriter = new StringWriter();
// Finally, render the JavaScript part.
if (itemDisplayAttributes.getId() != null) {
scriptWriter.write(createJavaScriptWidgetRegistrationOpening(itemDisplayAttributes.getId()));
addCreatedWidgetId(itemDisplayAttributes.getId());
}
scriptWriter.write("Ticker.createItemDisplay({");
scriptWriter.write("popupId:" + createJavaScriptString(popupAttributes.getId()));
addUsedWidgetId(popupAttributes.getId());
StringWriter propertyIdWriter = new StringWriter();
Iterator itemPropertyIterator = itemDisplayAttributes.getItemProperties().iterator();
boolean firstItemProperty = true;
while (itemPropertyIterator.hasNext()) {
ItemPropertyAttributes itemPropertyAttributes =
(ItemPropertyAttributes) itemPropertyIterator.next();
if (firstItemProperty) {
firstItemProperty = false;
} else {
propertyIdWriter.write(",");
}
propertyIdWriter.write(itemPropertyAttributes.getId());
}
scriptWriter.write(",itemPropertyId:" + createJavaScriptString(propertyIdWriter.toString()));
scriptWriter.write("})");
if (itemDisplayAttributes.getId() != null) {
scriptWriter.write(createJavaScriptWidgetRegistrationClosure());
}
// Write JavaScript content to DOM.
writeJavaScript(scriptWriter.toString());