} else if (cl == InternalLink.class) {
area.addTrait(trait, new InternalLink(value));
} else if (cl == Trait.ExternalLink.class) {
area.addTrait(trait, Trait.ExternalLink.makeFromTraitValue(value));
} else if (cl == Background.class) {
Background bkg = new Background();
try {
Color col = ColorUtil.parseColorString(
this.userAgent, attributes.getValue("bkg-color"));
bkg.setColor(col);
} catch (PropertyException e) {
throw new IllegalArgumentException(e.getMessage());
}
String uri = attributes.getValue("bkg-img");
if (uri != null) {
bkg.setURL(uri);
try {
ImageManager manager = userAgent.getFactory().getImageManager();
ImageSessionContext sessionContext
= userAgent.getImageSessionContext();
ImageInfo info = manager.getImageInfo(uri, sessionContext);
bkg.setImageInfo(info);
} catch (ImageException e) {
ResourceEventProducer eventProducer
= ResourceEventProducer.Provider.get(
this.userAgent.getEventBroadcaster());
eventProducer.imageError(this, uri, e, getLocator());
} catch (FileNotFoundException fnfe) {
ResourceEventProducer eventProducer
= ResourceEventProducer.Provider.get(
this.userAgent.getEventBroadcaster());
eventProducer.imageNotFound(this, uri, fnfe, getLocator());
} catch (IOException ioe) {
ResourceEventProducer eventProducer
= ResourceEventProducer.Provider.get(
this.userAgent.getEventBroadcaster());
eventProducer.imageIOError(this, uri, ioe, getLocator());
}
String repeat = attributes.getValue("bkg-repeat");
if (repeat != null) {
bkg.setRepeat(repeat);
}
bkg.setHoriz(XMLUtil.getAttributeAsInt(attributes,
"bkg-horz-offset", 0));
bkg.setVertical(XMLUtil.getAttributeAsInt(attributes,
"bkg-vert-offset", 0));
}
area.addTrait(trait, bkg);
} else if (cl == BorderProps.class) {
area.addTrait(trait, BorderProps.valueOf(this.userAgent, value));