*/
public Object getValue(ClassLoader classLoader, Class objectClass, Element propertyElement)
throws InvalidPropertyException {
Element fillImageElement = DomUtil.getChildElementByTagName(propertyElement, "fill-image");
if (fillImageElement == null) {
throw new InvalidPropertyException("Invalid FillImage property.", null);
}
Extent offsetX = fillImageElement.hasAttribute("horizontal")
? ExtentPeer.toExtent(fillImageElement.getAttribute("horizontal")) : null;
Extent offsetY = fillImageElement.hasAttribute("vertical")
? ExtentPeer.toExtent(fillImageElement.getAttribute("vertical")) : null;
int repeat;
String repeatString = fillImageElement.getAttribute("repeat");
if ("horizontal".equals(repeatString)) {
repeat = FillImage.REPEAT_HORIZONTAL;
} else if ("vertical".equals(repeatString)) {
repeat = FillImage.REPEAT_VERTICAL;
} else if ("none".equals(repeatString)) {
repeat = FillImage.NO_REPEAT;
} else {
repeat = FillImage.REPEAT;
}
Element imageElement = DomUtil.getChildElementByTagName(fillImageElement, "image");
if (imageElement == null) {
throw new InvalidPropertyException("Invalid FillImage property.", null);
}
String imageType = imageElement.getAttribute("type");
PropertyLoader propertyLoader = PropertyLoader.forClassLoader(classLoader);
Class propertyClass;
try {
propertyClass = Class.forName(imageType, true, classLoader);
} catch (ClassNotFoundException ex) {
throw new InvalidPropertyException("Invalid FillImage property (type \"" + imageType + "\" not found.", ex);
}
Object imagePropertyValue = propertyLoader.getPropertyValue(FillImage.class, propertyClass, imageElement);
if (!(imagePropertyValue instanceof ImageReference)) {
throw new InvalidPropertyException("Invalid FillImage property (type \"" + imageType
+ "\" is not an ImageReference.", null);
}
ImageReference imageReference = (ImageReference) imagePropertyValue;
FillImage fillImage = new FillImage(imageReference, offsetX, offsetY, repeat);