Package org.apache.fop.fo

Examples of org.apache.fop.fo.FONode


     * Returns the fo:table-header/footer/body element containing this cell.
     *
     * @return the enclosing table part
     */
    public TablePart getTablePart() {
        FONode node = cell.getParent();
        if (node instanceof TableRow) {
            node = node.getParent();
        }
        return (TablePart) node;
    }
View Full Code Here


        if (foNode instanceof PageSequence) {
            PageSequence pageSequence = (PageSequence) foNode;

            Region regionBefore = pagemaster.getRegion(Constants.FO_REGION_BEFORE);
            if (regionBefore != null) {
                FONode staticBefore = (FONode) pageSequence.getFlowMap().get(
                        regionBefore.getRegionName());
                if (staticBefore != null) {
                    recurseFONode(staticBefore);
                }
            }
            Region regionAfter = pagemaster.getRegion(Constants.FO_REGION_AFTER);
            if (regionAfter != null) {
                FONode staticAfter = (FONode) pageSequence.getFlowMap().get(
                        regionAfter.getRegionName());
                if (staticAfter != null) {
                    recurseFONode(staticAfter);
                }
            }


            recurseFONode( pageSequence.getMainFlow() );
        } else if (foNode instanceof Table) {
            Table table = (Table) foNode;

            //recurse all table-columns
            if (table.getColumns() != null) {
              //Calculation for column-widths which are not set
              prepareTable(table);

              for (Iterator it = table.getColumns().iterator(); it.hasNext();) {
                  recurseFONode( (FONode) it.next() );
              }
            } else {
                //TODO Implement implicit column setup handling!
                RTFEventProducer eventProducer = RTFEventProducer.Provider.get(
                        getUserAgent().getEventBroadcaster());
                eventProducer.explicitTableColumnsRequired(this, table.getLocator());
            }

            //recurse table-header
            if (table.getTableHeader() != null) {
                recurseFONode( table.getTableHeader() );
            }

            //recurse table-footer
            if (table.getTableFooter() != null) {
                recurseFONode( table.getTableFooter() );
            }

            if (foNode.getChildNodes() != null) {
                for (Iterator it = foNode.getChildNodes(); it.hasNext();) {
                    recurseFONode( (FONode) it.next() );
                }
            }
        } else if (foNode instanceof ListItem) {
            ListItem item = (ListItem) foNode;

            recurseFONode(item.getLabel());
            recurseFONode(item.getBody());
        } else if (foNode instanceof Footnote) {
            Footnote fn = (Footnote)foNode;

            recurseFONode(fn.getFootnoteCitation());
            recurseFONode(fn.getFootnoteBody());
        } else {
            //Any other FO-Object: Simply recurse through all childNodes.
            if (foNode.getChildNodes() != null) {
                for (Iterator it = foNode.getChildNodes(); it.hasNext();) {
                    FONode fn = (FONode)it.next();
                    if (log.isTraceEnabled()) {
                        log.trace("  ChildNode for " + fn + " (" + fn.getName() + ")");
                    }
                    recurseFONode(fn);
                }
            }
        }
View Full Code Here

        if (breakValue != Constants.EN_AUTO) {
            //"sect" Creates a new section and a page break,
            //a simple page break with control word "page" caused
            //some problems
            boolean bHasTableCellParent = false;
            FONode f = fobj;
            while (f.getParent() != null) {
                f = f.getParent();
                if (f instanceof TableCell) {
                    bHasTableCellParent = true;
                    break;
                }
            }
View Full Code Here

    public void instreamForeignObjectHasAltText() throws FOPException {
        testAltTextGetter(new InstreamForeignObject(mockFONode()));
    }

    private FONode mockFONode() {
        FONode mockFONode = FONodeMocks.mockFONode();
        FOUserAgent mockFOUserAgent = mockFONode.getFOEventHandler().getUserAgent();
        when(mockFOUserAgent.isAccessibilityEnabled()).thenReturn(true);
        return mockFONode;
    }
View Full Code Here

         return createPageSequenceMaster(mock(LayoutMasterSet.class), blockLevelEventProducer);
     }

     private PageSequenceMaster createPageSequenceMaster(LayoutMasterSet layoutMasterSet,
             BlockLevelEventProducer blockLevelEventProducer) throws FOPException {
         FONode mockParent = mock(FONode.class);
         Root mockRoot = mock(Root.class);

         //Stub generic components
         when(mockParent.getRoot()).thenReturn(mockRoot);
         when(mockRoot.getLayoutMasterSet()).thenReturn(layoutMasterSet);

         PageSequenceMaster psm =  new PageSequenceMaster(mockParent, blockLevelEventProducer);
         psm.startOfNode();
View Full Code Here

        }
        List<LayoutManager> newLMs = new ArrayList<LayoutManager>(size);
        while (fobjIter.hasNext() && newLMs.size() < size ) {
            Object theobj = fobjIter.next();
            if (theobj instanceof FONode) {
                FONode foNode = (FONode) theobj;
                if (foNode instanceof RetrieveMarker) {
                    foNode = getPSLM().resolveRetrieveMarker(
                        (RetrieveMarker) foNode);
                }
                if (foNode != null) {
View Full Code Here

    private void cloneSingleNode(FONode child, FONode newParent,
                            Marker marker, PropertyList parentPropertyList)
        throws FOPException {

        if (child != null) {
            FONode newChild = child.clone(newParent, true);
            if (child instanceof FObj) {
                Marker.MarkerPropertyList pList;
                PropertyList newPropertyList = createPropertyListFor(
                            (FObj) newChild, parentPropertyList);

                pList = marker.getPropertyListFor(child);
                newChild.processNode(
                        child.getLocalName(),
                        getLocator(),
                        pList,
                        newPropertyList);
                addChildTo(newChild, newParent);
                switch ( newChild.getNameId() ) {
                case FO_TABLE:
                    Table t = (Table) child;
                    cloneSubtree(t.getColumns().iterator(),
                                 newChild, marker, newPropertyList);
                    cloneSingleNode(t.getTableHeader(),
                                    newChild, marker, newPropertyList);
                    cloneSingleNode(t.getTableFooter(),
                                    newChild, marker, newPropertyList);
                    cloneSubtree(child.getChildNodes(),
                                    newChild, marker, newPropertyList);
                    break;
                case FO_LIST_ITEM:
                    ListItem li = (ListItem) child;
                    cloneSingleNode(li.getLabel(),
                                    newChild, marker, newPropertyList);
                    cloneSingleNode(li.getBody(),
                                    newChild, marker, newPropertyList);
                    break;
                default:
                    cloneSubtree(child.getChildNodes(),
                                    newChild, marker, newPropertyList);
                    break;
                }
            } else if (child instanceof FOText) {
                FOText ft = (FOText) newChild;
                ft.bind(parentPropertyList);
                addChildTo(newChild, newParent);
            } else if (child instanceof XMLObj) {
                addChildTo(newChild, newParent);
            }

            // trigger end-of-node white-space handling
            // and finalization for table-FOs
            newChild.finalizeNode();
        }
    }
View Full Code Here

     */
    private void cloneSubtree(Iterator parentIter, FONode newParent,
                              Marker marker, PropertyList parentPropertyList)
        throws FOPException {
        if (parentIter != null) {
            FONode child;
            while (parentIter.hasNext()) {
                child = (FONode) parentIter.next();
                cloneSingleNode(child, newParent,
                        marker, parentPropertyList);
            }
View Full Code Here

     * @return a list of text intervals as described above
     */
    private static final Log log = LogFactory.getLog(BidiResolver.class); // CSOK: ConstantNameCheck
    private List assignLevels ( TextInterval ti, int[] levels ) {
        Vector tiv = new Vector();
        FONode fn = ti.getNode();
        int fnStart = ti.getStart();                                     // start of node's text in delimited text range
        for ( int i = fnStart, n = ti.getEnd(); i < n; ) {
            int s = i;                                              // inclusive start index of interval in delimited text range
            int e = s;                                              // exclusive end index of interval in delimited text range
            int l = levels [ s ];                                   // current run level
View Full Code Here

         * white-space), then check whether the nearest non-wrapper
         * ancestor allows this.
         */
        if (child instanceof FOText
                && ((FOText)child).willCreateArea()) {
            FONode ancestor = parent;
            while (ancestor.getNameId() == Constants.FO_WRAPPER) {
                ancestor = ancestor.getParent();
            }
            if (!(ancestor instanceof FObjMixed)) {
                invalidChildError(
                        getLocator(),
                        getLocalName(),
View Full Code Here

TOP

Related Classes of org.apache.fop.fo.FONode

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.