if (mapId == null) {
throw new ProtocolException("widget:map-location-markers element "
+ "placed outside widget:map element");
}
MapLocationMarkersAttributes mapLocationMarkersAttributes
= (MapLocationMarkersAttributes)attributes;
// retrive list of attributes of <map-location-marker> element which are
// within the <w:map-location-markers> element.
List mapLocationMarkerAttributes = mapLocationMarkersAttributes.getContentAttributes();
// create ClockContentHandler to merge contents
MapLocationMarkerContextHandler mapLocationMarkerHandler
= new MapLocationMarkerContextHandler();
mapLocationMarkerHandler.mergeMapLocationMarkerAttributes(mapLocationMarkerAttributes);
List markersList = mapLocationMarkerHandler.getMarkersList();
String markers = getMarkersIds(markersList);
StringBuffer textBuffer = new StringBuffer();
textBuffer.append(
createJavaScriptWidgetRegistrationOpening(
mapLocationMarkersAttributes.getId()))
.append("new Widget.MapLocationMarkers(")
.append(createJavaScriptString(mapLocationMarkersAttributes.getId()))
.append(", {")
.append("mapId: ").append(createJavaScriptString(mapId))
.append(", markers: [").append(markers).append("]")
.append("})")
.append(createJavaScriptWidgetRegistrationClosure());
addCreatedWidgetId(mapLocationMarkersAttributes.getId());
addUsedWidgetIds(markersList);
addUsedWidgetId(mapId);
writeJavaScript(textBuffer.toString());
}