From 030cd56ed235409e5fe6d2914d7224d9a58380c1 Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Thu, 17 Jul 2008 19:13:56 +0000 Subject: * Added new DataObjectFactory to take care of MO:DCA DataObject creation/instantiation. * Created a DataObjectCache which is now used to cache all resource objects such as images to a RandomAccessFile so all the memory isn't eaten by them during rendering. * Added new GraphicsObjectPainter class invoked by DataObjectFactory on creation of GraphicsObject. * Added Category and Type inner interfaces and handy copySF() to base AbstractAFPObject with more code reuse, simplifications/optimizations of writeStart() and writeEnd(). * SVG entry and isImage() isGraphic() convenience methods added to MO:DCA Registry. * Updated AFPSVGHandler to use similar fox:conversion-mode foreign attribute mechanism for bitmap painting fallback used by PCLRenderer and PDFRenderer. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@677689 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/render/afp/DataObjectInfo.java | 64 ++++++++++++---------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'src/java/org/apache/fop/render/afp/DataObjectInfo.java') diff --git a/src/java/org/apache/fop/render/afp/DataObjectInfo.java b/src/java/org/apache/fop/render/afp/DataObjectInfo.java index b25470551..021e5fef6 100644 --- a/src/java/org/apache/fop/render/afp/DataObjectInfo.java +++ b/src/java/org/apache/fop/render/afp/DataObjectInfo.java @@ -39,18 +39,14 @@ public class DataObjectInfo { private static final String RESOURCE_LEVEL = "afp:resource-level"; private static final String RESOURCE_GROUP_FILE = "afp:resource-group-file"; - private static final ResourceInfo DEFAULT_RESOURCE_INFO = new ResourceInfo(); - - private String uri; - /** the object area info */ private ObjectAreaInfo objectAreaInfo; /** object type entry */ - private ObjectType objectType; + private Registry.ObjectType objectType; /** resource info */ - private ResourceInfo resourceInfo = DEFAULT_RESOURCE_INFO; + private ResourceInfo resourceInfo; /** * Default constructor @@ -58,24 +54,9 @@ public class DataObjectInfo { public DataObjectInfo() { } - /** - * Sets the data object uri - * @param uri the data object uri - */ - public void setUri(String uri) { - this.uri = uri; - } - - - /** - * @return the uri of this data object - */ - public String getUri() { - return uri; - } - /** * Sets the object type + * * @param objectType the object type */ public void setObjectType(Registry.ObjectType objectType) { @@ -83,6 +64,8 @@ public class DataObjectInfo { } /** + * Returns the object type MOD:CA Registry entry + * * @return the object type MOD:CA Registry entry */ public ObjectType getObjectType() { @@ -90,14 +73,20 @@ public class DataObjectInfo { } /** + * Returns the resource level at which this data object should reside + * * @return the resource level at which this data object should reside */ public ResourceInfo getResourceInfo() { + if (resourceInfo == null) { + this.resourceInfo = new ResourceInfo(); + } return resourceInfo; } /** * Sets the resource level at which this object should reside + * * @param resourceInfo the resource level at which this data object should reside */ public void setResourceInfo(ResourceInfo resourceInfo) { @@ -106,6 +95,7 @@ public class DataObjectInfo { /** * Sets the object area info + * * @param objectAreaInfo the object area info */ public void setObjectAreaInfo(ObjectAreaInfo objectAreaInfo) { @@ -113,6 +103,8 @@ public class DataObjectInfo { } /** + * Returns the object area info + * * @return the object area info */ public ObjectAreaInfo getObjectAreaInfo() { @@ -121,6 +113,7 @@ public class DataObjectInfo { /** * Sets the resource group settings using the given foreign attributes + * * @param foreignAttributes a mapping of element attributes names to values */ public void setResourceInfoFromForeignAttributes(Map/**/ foreignAttributes) { @@ -165,7 +158,7 @@ public class DataObjectInfo { log.warn("overwritting external resource file: " + resourceExternalDest); } - resourceLevel.setExternalResourceGroupFile(resourceExternalGroupFile); + resourceLevel.setExternalFilePath(resourceExternalDest); } catch (SecurityException ex) { log.error("unable to gain read access to external resource file: " + resourceExternalDest); @@ -180,13 +173,28 @@ public class DataObjectInfo { } } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public String toString() { - return "uri=" + uri - + (objectAreaInfo != null ? "objectAreaInfo=" + objectAreaInfo : "") + return (objectAreaInfo != null ? ", objectAreaInfo=" + objectAreaInfo : "") + (objectType != null ? ", objectType=" + objectType : "") + (resourceInfo != null ? ", resourceInfo=" + resourceInfo : ""); } + + /** + * Returns the uri of this data object + * + * @return the uri of this data object + */ + public String getUri() { + return getResourceInfo().getUri(); + } + + /** + * Sets the data object uri + * + * @param uri the data object uri + */ + public void setUri(String uri) { + getResourceInfo().setUri(uri); + } } -- cgit v1.2.3