Package org.apache.fop.afp

Examples of org.apache.fop.afp.AFPResourceLevel


    private void setDefaultToInlineResourceLevel(AFPGraphicsObjectInfo graphicsObjectInfo) {
        AFPResourceInfo resourceInfo = graphicsObjectInfo.getResourceInfo();
        //level not explicitly set/changed so default to inline for GOCA graphic objects
        // (due to a bug in the IBM AFP Workbench Viewer (2.04.01.07), hard copy works just fine)
        if (!resourceInfo.levelChanged()) {
            resourceInfo.setLevel(new AFPResourceLevel(AFPResourceLevel.INLINE));
        }
    }
View Full Code Here


        if (foreignAttributes != null && !foreignAttributes.isEmpty()) {
            String resourceName = (String)foreignAttributes.get(RESOURCE_NAME);
            if (resourceName != null) {
                resourceInfo.setName(resourceName);
            }
            AFPResourceLevel level = getResourceLevel(foreignAttributes);
            if (level != null) {
                resourceInfo.setLevel(level);
            }
        }
        return resourceInfo;
View Full Code Here

     *
     * @param foreignAttributes the foreign attributes
     * @return the resource level
     */
    public AFPResourceLevel getResourceLevel(Map/*<QName, String>*/ foreignAttributes) {
        AFPResourceLevel resourceLevel = null;
        if (foreignAttributes != null && !foreignAttributes.isEmpty()) {
            if (foreignAttributes.containsKey(RESOURCE_LEVEL)) {
                String levelString = (String)foreignAttributes.get(RESOURCE_LEVEL);
                resourceLevel = AFPResourceLevel.valueOf(levelString);
                // if external get resource group file attributes
                if (resourceLevel != null && resourceLevel.isExternal()) {
                    String resourceGroupFile
                        = (String)foreignAttributes.get(RESOURCE_GROUP_FILE);
                    if (resourceGroupFile == null) {
                        String msg = RESOURCE_GROUP_FILE + " not specified";
                        log.error(msg);
                        throw new UnsupportedOperationException(msg);
                    }
                    File resourceExternalGroupFile = new File(resourceGroupFile);
                    SecurityManager security = System.getSecurityManager();
                    try {
                        if (security != null) {
                            security.checkWrite(resourceExternalGroupFile.getPath());
                        }
                    } catch (SecurityException ex) {
                        String msg = "unable to gain write access to external resource file: "
                        + resourceGroupFile;
                        log.error(msg);
                    }

                    try {
                        boolean exists = resourceExternalGroupFile.exists();
                        if (exists) {
                            log.warn("overwriting external resource file: "
                                    + resourceGroupFile);
                        }
                        resourceLevel.setExternalFilePath(resourceGroupFile);
                    } catch (SecurityException ex) {
                        String msg = "unable to gain read access to external resource file: "
                            + resourceGroupFile;
                        log.error(msg);
                    }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void setViewport(AFPDataObjectInfo dataObjectInfo) {
        AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
        AFPResourceLevel resourceLevel = resourceInfo.getLevel();

        // only need to set MCD and CDD when OC when is inlined (pre-2000 apps)
        if (resourceLevel.isInline()) {
            super.setViewport(dataObjectInfo);

            MapContainerData mapContainerData
            = factory.createMapContainerData(MappingOptionTriplet.SCALE_TO_FIT);
            getObjectEnvironmentGroup().setMapContainerData(mapContainerData);
View Full Code Here

        if (foreignAttributes != null && !foreignAttributes.isEmpty()) {
            String resourceName = (String)foreignAttributes.get(RESOURCE_NAME);
            if (resourceName != null) {
                resourceInfo.setName(resourceName);
            }
            AFPResourceLevel level = getResourceLevel(foreignAttributes);
            if (level != null) {
                resourceInfo.setLevel(level);
            }
        }
        return resourceInfo;
View Full Code Here

     *
     * @param foreignAttributes the foreign attributes
     * @return the resource level
     */
    public AFPResourceLevel getResourceLevel(Map/*<QName, String>*/ foreignAttributes) {
        AFPResourceLevel resourceLevel = null;
        if (foreignAttributes != null && !foreignAttributes.isEmpty()) {
            if (foreignAttributes.containsKey(RESOURCE_LEVEL)) {
                String levelString = (String)foreignAttributes.get(RESOURCE_LEVEL);
                resourceLevel = AFPResourceLevel.valueOf(levelString);
                // if external get resource group file attributes
                if (resourceLevel != null && resourceLevel.isExternal()) {
                    String resourceGroupFile
                        = (String)foreignAttributes.get(RESOURCE_GROUP_FILE);
                    if (resourceGroupFile == null) {
                        String msg = RESOURCE_GROUP_FILE + " not specified";
                        LOG.error(msg);
                        throw new UnsupportedOperationException(msg);
                    }
                    File resourceExternalGroupFile = new File(resourceGroupFile);
                    SecurityManager security = System.getSecurityManager();
                    try {
                        if (security != null) {
                            security.checkWrite(resourceExternalGroupFile.getPath());
                        }
                    } catch (SecurityException ex) {
                        String msg = "unable to gain write access to external resource file: "
                        + resourceGroupFile;
                        LOG.error(msg);
                    }

                    try {
                        boolean exists = resourceExternalGroupFile.exists();
                        if (exists) {
                            LOG.warn("overwriting external resource file: "
                                    + resourceGroupFile);
                        }
                        resourceLevel.setExternalFilePath(resourceGroupFile);
                    } catch (SecurityException ex) {
                        String msg = "unable to gain read access to external resource file: "
                            + resourceGroupFile;
                        LOG.error(msg);
                    }
View Full Code Here

                height, widthRes, heightRes);
        getObjectEnvironmentGroup().setObjectAreaDescriptor(objectAreaDescriptor);

        // object area position
        AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
        AFPResourceLevel resourceLevel = resourceInfo.getLevel();
        ObjectAreaPosition objectAreaPosition = null;
        int rotation = objectAreaInfo.getRotation();
        if (resourceLevel.isInline()) {
            int x = objectAreaInfo.getX();
            int y = objectAreaInfo.getY();
            objectAreaPosition = factory.createObjectAreaPosition(x, y, rotation);
        } else {
            // positional values are specified in the oaOffset of the include object
View Full Code Here

    }

    /** {@inheritDoc} */
    public void setViewport(AFPDataObjectInfo dataObjectInfo) {
        AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
        AFPResourceLevel resourceLevel = resourceInfo.getLevel();

        // only need to set MCD and CDD when OC when is inlined (pre-2000 apps)
        if (resourceLevel.isInline()) {
            super.setViewport(dataObjectInfo);

            MapContainerData mapContainerData
            = factory.createMapContainerData(MappingOptionTriplet.SCALE_TO_FIT);
            getObjectEnvironmentGroup().setMapContainerData(mapContainerData);
View Full Code Here

    private void setDefaultToInlineResourceLevel(AFPGraphicsObjectInfo graphicsObjectInfo) {
        AFPResourceInfo resourceInfo = graphicsObjectInfo.getResourceInfo();
        //level not explicitly set/changed so default to inline for GOCA graphic objects
        // (due to a bug in the IBM AFP Workbench Viewer (2.04.01.07), hard copy works just fine)
        if (!resourceInfo.levelChanged()) {
            resourceInfo.setLevel(new AFPResourceLevel(AFPResourceLevel.INLINE));
        }
    }
View Full Code Here

            = factory.createObjectAreaDescriptor(width, height, widthRes, heightRes);
        getObjectEnvironmentGroup().setObjectAreaDescriptor(objectAreaDescriptor);

        // object area position
        AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
        AFPResourceLevel resourceLevel = resourceInfo.getLevel();
        ObjectAreaPosition objectAreaPosition = null;
        int rotation = objectAreaInfo.getRotation();
        if (resourceLevel.isInline()) {
            int x = objectAreaInfo.getX();
            int y = objectAreaInfo.getY();
            objectAreaPosition = factory.createObjectAreaPosition(x, y, rotation);
        } else {
            // positional values are specified in the oaOffset of the include object
View Full Code Here

TOP

Related Classes of org.apache.fop.afp.AFPResourceLevel

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.