1 17 18 19 20 package org.apache.fop.fo.extensions.xmp; 21 22 import org.apache.fop.fo.FONode; 23 import org.apache.fop.fo.FObj; 24 import org.apache.fop.fo.extensions.ExtensionAttachment; 25 import org.apache.fop.util.ContentHandlerFactory; 26 import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener; 27 import org.apache.xmlgraphics.xmp.Metadata; 28 29 32 public abstract class AbstractMetadataElement extends FONode implements ObjectBuiltListener { 33 34 private XMPMetadata attachment; 35 36 40 public AbstractMetadataElement(FONode parent) { 41 super(parent); 42 } 43 44 47 public ContentHandlerFactory getContentHandlerFactory() { 48 return new XMPContentHandlerFactory(); 49 } 50 51 52 public ExtensionAttachment getExtensionAttachment() { 53 if (parent instanceof FObj) { 54 if (attachment == null) { 55 attachment = new XMPMetadata(); 56 } 57 return attachment; 58 } else { 59 return super.getExtensionAttachment(); 60 } 61 } 62 63 64 public void notifyObjectBuilt(Object obj) { 65 attachment.setMetadata((Metadata)obj); 66 } 67 68 69 } 70 | Popular Tags |