Package org.apache.fop.render.afp.extensions

Examples of org.apache.fop.render.afp.extensions.AFPPageSetup


            Iterator i = pageViewport.getExtensionAttachments().iterator();
            while (i.hasNext()) {
                ExtensionAttachment attachment = (ExtensionAttachment)i.next();
                if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
                    if (attachment instanceof AFPPageSetup) {
                        AFPPageSetup aps = (AFPPageSetup)attachment;
                        if (log.isDebugEnabled()) {
                            log.debug(aps);
                        }
                        String element = aps.getElementName();
                        if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
                            String overlay = aps.getName();
                            if (overlay != null) {
                                _afpDataStream.createIncludePageOverlay(overlay);
                            }
                        } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
                            String name = aps.getName();
                            String source = aps.getValue();
                            if (_pageSegmentsMap == null) {
                                _pageSegmentsMap = new HashMap();
                            }
                            _pageSegmentsMap.put(source, name);
                        } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
                            String name = aps.getName();
                            String value = aps.getValue();
                            if (_pageSegmentsMap == null) {
                                _pageSegmentsMap = new HashMap();
                            }
                            _afpDataStream.createTagLogicalElement(name, value);
                        } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
                            String content = aps.getContent();
                            if (content != null) {
                                _afpDataStream.createNoOperation(content);
                            }
                        }
                    }
View Full Code Here


            // the s-p-m
            Iterator i = pageViewport.getExtensionAttachments().iterator();
            while (i.hasNext()) {
                ExtensionAttachment attachment = (ExtensionAttachment)i.next();
                if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
                    AFPPageSetup aps = (AFPPageSetup) attachment;
                    String element = aps.getElementName();
                    if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
                        String overlay = aps.getName();
                        if (overlay != null) {
                            afpDataStream.createIncludePageOverlay(overlay);
                        }
                    } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT
                            .equals(element)) {
                        String name = aps.getName();
                        String source = aps.getValue();
                        if (pageSegmentsMap == null) {
                            pageSegmentsMap = new HashMap();
                        }
                        pageSegmentsMap.put(source, name);
                    } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT
                            .equals(element)) {
                        String name = aps.getName();
                        String value = aps.getValue();
                        if (pageSegmentsMap == null) {
                            pageSegmentsMap = new HashMap();
                        }
                        afpDataStream.createTagLogicalElement(name, value);
                    } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
                        String content = aps.getContent();
                        if (content != null) {
                            afpDataStream.createNoOperation(content);
                        }
                    }
                }
View Full Code Here

            // the s-p-m
            Iterator i = pageViewport.getExtensionAttachments().iterator();
            while (i.hasNext()) {
                ExtensionAttachment attachment = (ExtensionAttachment)i.next();
                if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
                    AFPPageSetup aps = (AFPPageSetup) attachment;
                    String element = aps.getElementName();
                    if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
                        String overlay = aps.getName();
                        if (overlay != null) {
                            afpDataStream.createIncludePageOverlay(overlay);
                        }
                    } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT
                            .equals(element)) {
                        String name = aps.getName();
                        String source = aps.getValue();
                        if (pageSegmentsMap == null) {
                            pageSegmentsMap = new HashMap();
                        }
                        pageSegmentsMap.put(source, name);
                    } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT
                            .equals(element)) {
                        String name = aps.getName();
                        String value = aps.getValue();
                        if (pageSegmentsMap == null) {
                            pageSegmentsMap = new HashMap();
                        }
                        afpDataStream.createTagLogicalElement(name, value);
                    } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
                        String content = aps.getContent();
                        if (content != null) {
                            afpDataStream.createNoOperation(content);
                        }
                    }
                }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void handleExtensionObject(Object extension) throws IFException {
        if (extension instanceof AFPPageSetup) {
            AFPPageSetup aps = (AFPPageSetup)extension;
            String element = aps.getElementName();
            if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
                if (this.location != LOC_IN_PAGE_HEADER
                        && this.location != LOC_FOLLOWING_PAGE_SEQUENCE) {
                    throw new IFException(
                        "TLE extension must be in the page header or between page-sequence"
                            + " and the first page: " + aps, null);
                }
                String name = aps.getName();
                String value = aps.getValue();
                dataStream.createTagLogicalElement(name, value);
            } else {
                if (this.location != LOC_IN_PAGE_HEADER) {
                    throw new IFException(
                        "AFP page setup extension encountered outside the page header: " + aps,
                        null);
                }
                if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
                    String name = aps.getName();
                    String source = aps.getValue();
                    pageSegmentMap.put(source, name);
                } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
                    String content = aps.getContent();
                    if (content != null) {
                        dataStream.createNoOperation(content);
                    }
                }
            }
View Full Code Here

                    String mediumMap = imm.getName();
                    if (mediumMap != null) {
                        dataStream.createInvokeMediumMap(mediumMap);
                    }
                } else if (attachment instanceof AFPPageSetup) {
                    AFPPageSetup aps = (AFPPageSetup)attachment;
                    String name = aps.getName();
                    String value = aps.getValue();
                    dataStream.createTagLogicalElement(name, value);
                }
            }
        }
    }
View Full Code Here

            Iterator it = pageViewport.getExtensionAttachments().iterator();
            while (it.hasNext()) {
                ExtensionAttachment attachment = (ExtensionAttachment) it.next();
                if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
                    if (attachment instanceof AFPPageSetup) {
                        AFPPageSetup aps = (AFPPageSetup) attachment;
                        String element = aps.getElementName();
                        if (AFPElementMapping.INCLUDE_PAGE_SEGMENT
                                .equals(element)) {
                            String name = aps.getName();
                            String source = aps.getValue();
                            pageSegmentMap.put(source, name);
                        } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT
                                .equals(element)) {
                            String name = aps.getName();
                            String value = aps.getValue();
                            dataStream.createTagLogicalElement(name, value);
                        } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
                            String content = aps.getContent();
                            if (content != null) {
                                dataStream.createNoOperation(content);
                            }
                        }
                    } else if (attachment instanceof AFPPageOverlay) {
View Full Code Here

    public void endPageSequence() throws IFException {
        try {
            //Process deferred page-sequence-level extensions
            Iterator<AFPPageSetup> iter = this.deferredPageSequenceExtensions.iterator();
            while (iter.hasNext()) {
                AFPPageSetup aps = iter.next();
                iter.remove();
                if (AFPElementMapping.NO_OPERATION.equals(aps.getElementName())) {
                    handleNOP(aps);
                } else {
                    throw new UnsupportedOperationException("Don't know how to handle " + aps);
                }
            }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void handleExtensionObject(Object extension) throws IFException {
        if (extension instanceof AFPPageSetup) {
            AFPPageSetup aps = (AFPPageSetup)extension;
            String element = aps.getElementName();
            if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
                switch (this.location) {
                case FOLLOWING_PAGE_SEQUENCE:
                case IN_PAGE_HEADER:
                    String name = aps.getName();
                    String value = aps.getValue();
                    dataStream.createTagLogicalElement(name, value);
                    break;
                default:
                    throw new IFException(
                        "TLE extension must be in the page header or between page-sequence"
                            + " and the first page: " + aps, null);
                }
            } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
                switch (this.location) {
                case FOLLOWING_PAGE_SEQUENCE:
                    if (aps.getPlacement() == ExtensionPlacement.BEFORE_END) {
                        this.deferredPageSequenceExtensions.add(aps);
                        break;
                    }
                case IN_DOCUMENT_HEADER:
                case IN_PAGE_HEADER:
View Full Code Here

            //Extract all AFPPageSetup instances from the attachment list on the s-p-m
            Iterator i = page.getExtensionAttachments().iterator();
            while (i.hasNext()) {
                ExtensionAttachment attachment = (ExtensionAttachment)i.next();
                if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
                    AFPPageSetup aps = (AFPPageSetup)attachment;
                    String element = aps.getElementName();
                    if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
                        String overlay = aps.getName();
                        if (overlay != null) {
                            _afpDataStream.createIncludePageOverlay(overlay);
                        }
                    } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
                        String name = aps.getName();
                        String source = aps.getValue();
                        if (_pageSegmentsMap == null) {
                            _pageSegmentsMap = new HashMap();
                        }
                        _pageSegmentsMap.put(source, name);
                    } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
                        String name = aps.getName();
                        String value = aps.getValue();
                        if (_pageSegmentsMap == null) {
                            _pageSegmentsMap = new HashMap();
                        }
                        _afpDataStream.createTagLogicalElement(name, value);
                    }
View Full Code Here

    public void endPageSequence() throws IFException {
        try {
            //Process deferred page-sequence-level extensions
            Iterator<AFPPageSetup> iter = this.deferredPageSequenceExtensions.iterator();
            while (iter.hasNext()) {
                AFPPageSetup aps = iter.next();
                iter.remove();
                if (AFPElementMapping.NO_OPERATION.equals(aps.getElementName())) {
                    handleNOP(aps);
                } else {
                    throw new UnsupportedOperationException("Don't know how to handle " + aps);
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.fop.render.afp.extensions.AFPPageSetup

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.