String value;
value = attributes.getProperty(ElementTags.URL);
if (value == null)
throw new MalformedURLException(MessageLocalization.getComposedMessage("the.url.of.the.image.is.missing"));
LwgImage image = LwgImage.getInstance(value);
value = attributes.getProperty(ElementTags.ALIGN);
int align = 0;
if (value != null) {
if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(value))
align |= LwgImage.LEFT;
else if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(value))
align |= LwgImage.RIGHT;
else if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(value))
align |= LwgImage.MIDDLE;
}
if ("true".equalsIgnoreCase(attributes
.getProperty(ElementTags.UNDERLYING)))
align |= LwgImage.UNDERLYING;
if ("true".equalsIgnoreCase(attributes
.getProperty(ElementTags.TEXTWRAP)))
align |= LwgImage.TEXTWRAP;
image.setAlignment(align);
value = attributes.getProperty(ElementTags.ALT);
if (value != null) {
image.setAlt(value);
}
String x = attributes.getProperty(ElementTags.ABSOLUTEX);
String y = attributes.getProperty(ElementTags.ABSOLUTEY);
if ((x != null) && (y != null)) {
image.setAbsolutePosition(Float.parseFloat(x + "f"), Float
.parseFloat(y + "f"));
}
value = attributes.getProperty(ElementTags.PLAINWIDTH);
if (value != null) {
image.scaleAbsoluteWidth(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(ElementTags.PLAINHEIGHT);
if (value != null) {
image.scaleAbsoluteHeight(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(ElementTags.ROTATION);
if (value != null) {
image.setRotation(Float.parseFloat(value + "f"));
}
return image;
}