public static com.sun.perseus.j2d.PaintServer | resolve(DocumentNode doc, com.sun.perseus.j2d.PaintTarget paintTarget, java.lang.String traitName, java.lang.String idRef)If the requested idRef is resolved, this method checks it is a reference
to a PaintServer and returns that PaintServer.
If the resquested idRef cannot be resolved, then the method returns and
PaintServerReference.Unresolved instance.
// Check if the paint server reference is already resolved.
ElementNode ref = (ElementNode) doc.getElementById(idRef);
if (ref != null) {
if (!(ref instanceof PaintElement)) {
throw new DOMException(
DOMException.INVALID_STATE_ERR,
Messages.formatMessage(
Messages.ERROR_INVALID_PAINT_SERVER_REFERENCE,
new String[] {
idRef,
ref.getNamespaceURI(),
ref.getLocalName()
}));
} else {
return ((PaintElement) ref).getPaintServer(traitName,
paintTarget);
}
}
// The paint server reference is not resolved yet. We create an
// unresolved PaintServer.
return new PaintServerReference.Unresolved(doc,
paintTarget,
traitName,
idRef);
|