// Set id
Element insertedImage = (Element) buffer.getCurrentElement()
.getTail();
if (null == insertedImage) {
throw new ProtocolException(exceptionLocalizer.format(
"missing-policy-failure", content.toString()));
}
String imgId = protocol.getMarinerPageContext()
.generateUniqueFCID();
insertedImage.setAttribute("id", imgId);
// Set required styles
Styles styles = insertedImage.getStyles();
if (null == styles) {
styles = StylingFactory.getDefaultInstance().createStyles(null);
insertedImage.setStyles(styles);
}
styles.getPropertyValues().setComputedAndSpecifiedValue(
StylePropertyDetails.DISPLAY, DisplayKeywords.INLINE);
styles.getPropertyValues().setComputedAndSpecifiedValue(
StylePropertyDetails.VERTICAL_ALIGN,
VerticalAlignKeywords.BOTTOM);
if (!visible) {
insertedImage.setAttribute("style", "display:none");
}
// Extract from policy and set alt text for image
String altText = extractAltText(protocol, component);
insertedImage.setAttribute("alt", altText);
return imgId;
} else {
throw new ProtocolException(exceptionLocalizer
.format("widget-tab-label-incorrect-content-type"));
}
}