Package org.apache.fop.afp.modca

Examples of org.apache.fop.afp.modca.ResourceObject


            throw new IOException("Cannot handle resource: " + fieldBegin);
        }

        //Copy structured fields (wrapped or as is)
        if (wrapInResource) {
            ResourceObject resourceObject =  new ResourceObject(name) {
                protected void writeContent(OutputStream os) throws IOException {
                    copyNamedStructuredFields(name, fieldBegin, parser, out);
                }
            };
            resourceObject.setType(ResourceObject.TYPE_PAGE_SEGMENT);
            resourceObject.writeToStream(out);
        } else {
            copyNamedStructuredFields(name, fieldBegin, parser, out);
        }
    }
View Full Code Here


     * @param objectType the object type
     * @return a new resource object wrapper
     */
    public ResourceObject createResource(AbstractNamedAFPObject namedObj,
            AFPResourceInfo resourceInfo, Registry.ObjectType objectType) {
        ResourceObject resourceObj = null;
        String resourceName = resourceInfo.getName();
        if (resourceName != null) {
            resourceObj = factory.createResource(resourceName);
        } else {
            resourceObj = factory.createResource();
        }

        if (namedObj instanceof Document) {
            resourceObj.setType(ResourceObject.TYPE_DOCUMENT);
        } else if (namedObj instanceof PageSegment) {
            resourceObj.setType(ResourceObject.TYPE_PAGE_SEGMENT);
        } else if (namedObj instanceof Overlay) {
            resourceObj.setType(ResourceObject.TYPE_OVERLAY_OBJECT);
        } else if (namedObj instanceof AbstractDataObject) {
            AbstractDataObject dataObj = (AbstractDataObject)namedObj;
            if (namedObj instanceof ObjectContainer) {
                resourceObj.setType(ResourceObject.TYPE_OBJECT_CONTAINER);

                // set object classification
                final boolean dataInContainer = true;
                final boolean containerHasOEG = false; // must be included
                final boolean dataInOCD = true;
                // mandatory triplet for object container
                resourceObj.setObjectClassification(
                    ObjectClassificationTriplet.CLASS_TIME_INVARIANT_PAGINATED_PRESENTATION_OBJECT,
                    objectType, dataInContainer, containerHasOEG, dataInOCD);
            } else if (namedObj instanceof ImageObject) {
                // ioca image type
                resourceObj.setType(ResourceObject.TYPE_IMAGE);
            } else if (namedObj instanceof GraphicsObject) {
                resourceObj.setType(ResourceObject.TYPE_GRAPHIC);
            } else {
                throw new UnsupportedOperationException(
                        "Unsupported resource object for data object type " + dataObj);
            }
        } else {
            throw new UnsupportedOperationException(
              "Unsupported resource object type " + namedObj);
        }

        // set the resource information/classification on the data object
        resourceObj.setDataObject(namedObj);
        return resourceObj;
    }
View Full Code Here

                log.debug("Adding included resource: " + resourceName);
            }
            IncludedResourceObject resourceContent = new IncludedResourceObject(
                        resourceName, accessor, uri);

            ResourceObject resourceObject = factory.createResource(resourceName);
            resourceObject.setDataObject(resourceContent);
            resourceObject.setType(resourceObjectType);

            ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel);
            resourceGroup.addObject(resourceObject);
            // record mapping of resource info to data object resource name
            includeNameMap.put(resourceInfo, resourceName);
View Full Code Here

     *
     * @param resourceName the resource object name
     * @return a new {@link ResourceObject}
     */
    public ResourceObject createResource(String resourceName) {
        return new ResourceObject(resourceName);
    }
View Full Code Here

     *
     * @param resourceName the resource object name
     * @return a new {@link ResourceObject}
     */
    public ResourceObject createResource(String resourceName) {
        return new ResourceObject(resourceName);
    }
View Full Code Here

     * @param objectType the object type
     * @return a new resource object wrapper
     */
    public ResourceObject createResource(AbstractNamedAFPObject namedObj,
            AFPResourceInfo resourceInfo, Registry.ObjectType objectType) {
        ResourceObject resourceObj = null;
        String resourceName = resourceInfo.getName();
        if (resourceName != null) {
            resourceObj = factory.createResource(resourceName);
        } else {
            resourceObj = factory.createResource();
        }

        if (namedObj instanceof Document) {
            resourceObj.setType(ResourceObject.TYPE_DOCUMENT);
        } else if (namedObj instanceof PageSegment) {
            resourceObj.setType(ResourceObject.TYPE_PAGE_SEGMENT);
        } else if (namedObj instanceof Overlay) {
            resourceObj.setType(ResourceObject.TYPE_OVERLAY_OBJECT);
        } else if (namedObj instanceof AbstractDataObject) {
            AbstractDataObject dataObj = (AbstractDataObject)namedObj;
            if (namedObj instanceof ObjectContainer) {
                resourceObj.setType(ResourceObject.TYPE_OBJECT_CONTAINER);

                // set object classification
                final boolean dataInContainer = true;
                final boolean containerHasOEG = false; // must be included
                final boolean dataInOCD = true;
                // mandatory triplet for object container
                resourceObj.setObjectClassification(
                    ObjectClassificationTriplet.CLASS_TIME_INVARIANT_PAGINATED_PRESENTATION_OBJECT,
                    objectType, dataInContainer, containerHasOEG, dataInOCD);
            } else if (namedObj instanceof ImageObject) {
                // ioca image type
                resourceObj.setType(ResourceObject.TYPE_IMAGE);
            } else if (namedObj instanceof GraphicsObject) {
                resourceObj.setType(ResourceObject.TYPE_GRAPHIC);
            } else {
                throw new UnsupportedOperationException(
                        "Unsupported resource object for data object type " + dataObj);
            }
        } else {
            throw new UnsupportedOperationException(
              "Unsupported resource object type " + namedObj);
        }

        // set the resource information/classification on the data object
        resourceObj.setDataObject(namedObj);
        return resourceObj;
    }
View Full Code Here

                log.debug("Adding included resource: " + resourceName);
            }
            IncludedResourceObject resourceContent = new IncludedResourceObject(
                        resourceName, accessor, uri);

            ResourceObject resourceObject = factory.createResource(resourceName);
            resourceObject.setDataObject(resourceContent);
            resourceObject.setType(resourceObjectType);

            ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel);
            resourceGroup.addObject(resourceObject);
            // record mapping of resource info to data object resource name
            includeNameMap.put(resourceInfo, resourceName);
View Full Code Here

TOP

Related Classes of org.apache.fop.afp.modca.ResourceObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.