protected int elementStartImpl(
MarinerRequestContext context,
BlockAttributes blockAttributes)
throws PAPIException {
AbstractImageAttributes attributes
= (AbstractImageAttributes) blockAttributes;
String url = attributes.getUrl();
String urlc = attributes.getUrlc();
// The src is actually the component name.
String imageComponentName = attributes.getSrc();
int notNullCount = 0;
if (url != null) {
notNullCount++;
}
if (imageComponentName != null) {
notNullCount++;
}
if (urlc != null) {
notNullCount++;
}
if (notNullCount > 1) {
throw new IllegalArgumentException
("Only one of url, urlc and src may be set");
} else if (notNullCount == 0) {
throw new IllegalArgumentException
("Either url, urlc or src must be set");
}
MarinerPageContext pageContext
= ContextInternals.getMarinerPageContext(context);
VolantisProtocol protocol = pageContext.getProtocol();
PolicyReferenceResolver resolver =
pageContext.getPolicyReferenceResolver();
TextAssetReference altText = resolver.resolveQuotedTextExpression(
attributes.getAltText());
pattributes.setId(attributes.getId());
pattributes.setTitle(attributes.getTitle());
pattributes.setAltText(altText);
pattributes.setPane(pageContext.getCurrentPane());
pattributes.setAssetURLSuffix(attributes.getAssetURLsuffix());
// Add any event attributes.
PAPIInternals.initialiseGeneralEventAttributes(pageContext,
attributes,
pattributes);