* An example of object handled here are ExtensionAttachments.
* @param obj the Object to be handled.
*/
protected void handleExternallyGeneratedObject(Object obj) {
if (areaStack.size() == 0 && obj instanceof ExtensionAttachment) {
ExtensionAttachment attachment = (ExtensionAttachment)obj;
if (this.currentPageViewport == null) {
this.treeModel.handleOffDocumentItem(
new OffDocumentExtensionAttachment(attachment));
} else {
this.currentPageViewport.addExtensionAttachment(attachment);
}
} else {
Object o = areaStack.peek();
if (o instanceof AreaTreeObject && obj instanceof ExtensionAttachment) {
AreaTreeObject ato = (AreaTreeObject)o;
ExtensionAttachment attachment = (ExtensionAttachment)obj;
ato.addExtensionAttachment(attachment);
} else {
log.warn("Don't know how to handle externally generated object: " + obj);
}
}