Package org.xhtmlrenderer.render

Examples of org.xhtmlrenderer.render.BlockBox


       
        blocks.add(block);
       
        Collections.sort(blocks, new Comparator() {
            public int compare(Object o1, Object o2) {
                BlockBox b1 = (BlockBox)o1;
                BlockBox b2 = (BlockBox)o2;
               
                return b1.getAbsY() - b2.getAbsY();
            }
        });
    }
View Full Code Here


        if (blocks == null) {
            return null;
        }
       
        if (which == PageElementPosition.START) {
            BlockBox prev = null;
            for (Iterator i = blocks.iterator(); i.hasNext(); ) {
                BlockBox b = (BlockBox)i.next();
                if (b.getStaticEquivalent().getAbsY() >= page.getTop()) {
                    break;
                }
                prev = b;
            }
            return prev;
        } else if (which == PageElementPosition.FIRST) {
            for (Iterator i = blocks.iterator(); i.hasNext(); ) {
                BlockBox b = (BlockBox)i.next();
                int absY = b.getStaticEquivalent().getAbsY();
                if (absY >= page.getTop() && absY < page.getBottom()) {
                    return b;
                }
            }
            return getRunningBlock(identifer, page, PageElementPosition.START);
        } else if (which == PageElementPosition.LAST) {
            BlockBox prev = null;
            for (Iterator i = blocks.iterator(); i.hasNext(); ) {
                BlockBox b = (BlockBox)i.next();
                if (b.getStaticEquivalent().getAbsY() > page.getBottom()) {
                    break;
                }
                prev = b;
            }
            return prev;
        } else if (which == PageElementPosition.LAST_EXCEPT) {
            BlockBox prev = null;
            for (Iterator i = blocks.iterator(); i.hasNext(); ) {
                BlockBox b = (BlockBox)i.next();
                int absY = b.getStaticEquivalent().getAbsY();
                if (absY >= page.getTop() && absY < page.getBottom()) {
                    return null;
                }
                if (absY > page.getBottom()) {
                    break;
View Full Code Here

        if (_sortedPageSequences == null) {
            List result = new ArrayList(_pageSequences);
           
            Collections.sort(result, new Comparator() {
                public int compare(Object o1, Object o2) {
                    BlockBox b1 = (BlockBox)o1;
                    BlockBox b2 = (BlockBox)o2;
                   
                    return b1.getAbsY() - b2.getAbsY();
                }
            });
           
            _sortedPageSequences  = result;
        }
View Full Code Here

            initial = c.getInitialPageNo() - 1;
        }
        if ((sequences == null) || sequences.isEmpty()) {
            return initial + getPage(c, absY).getPageNo();
        } else {
            BlockBox pageSequence = findPageSequence(sequences, absY);
            int sequenceStartAbsolutePageNo = getPage(c, pageSequence.getAbsY()).getPageNo();
            int absoluteRequiredPageNo = getPage(c, absY).getPageNo();
            return absoluteRequiredPageNo - sequenceStartAbsolutePageNo;
        }
    }
View Full Code Here

            return absoluteRequiredPageNo - sequenceStartAbsolutePageNo;
        }
    }
   
    private BlockBox findPageSequence(List sequences, int absY) {
        BlockBox result = null;
       
        for (int i = 0; i < sequences.size(); i++) {
            result = (BlockBox) sequences.get(i);
            if ((i < sequences.size() - 1) && (((BlockBox) sequences.get(i + 1)).getAbsY() > absY)) {
                break;
View Full Code Here

        } else {
            int sequenceStartIndex = getPageSequenceStart(c, sequences, c.getPage());
            if (sequenceStartIndex == -1) {
                return initial + c.getPageNo();
            } else {
                BlockBox block = (BlockBox)sequences.get(sequenceStartIndex);
                return c.getPageNo() - getFirstPage(c, block).getPageNo();
            }
        }
    }
View Full Code Here

            int sequenceStartIndex = getPageSequenceStart(c, sequences, c.getPage());
           
            if (sequenceStartIndex == -1) {
                firstPage = 0;
            } else {
                BlockBox block = (BlockBox)sequences.get(sequenceStartIndex);
                firstPage = getFirstPage(c, block).getPageNo();
            }
           
            if (sequenceStartIndex < sequences.size() - 1) {
                BlockBox block = (BlockBox)sequences.get(sequenceStartIndex+1);
                lastPage = getFirstPage(c, block).getPageNo();
            } else {
                lastPage = c.getPageCount();
            }
           
View Full Code Here

        }
    }   
   
    private int getPageSequenceStart(RenderingContext c, List sequences, PageBox page) {
        for (int i = sequences.size() - 1; i >= 0; i--) {
            BlockBox start = (BlockBox)sequences.get(i);
            if (start.getAbsY() < page.getBottom() - 1) {
                return i;
            }
        }
       
        return -1;
View Full Code Here

           
            if (b.intersects(c, clip)) {
                if (b instanceof InlineLayoutBox) {
                    inlineContent.add(b);
                } else {
                    BlockBox bb = (BlockBox)b;
                    if (bb.isInline()) {
                        if (intersectsAny(c, clip, b)) {
                            inlineContent.add(b);
                        }
                    } else {
                        collect(c, clip, layer, bb, blockContent, inlineContent, rangeLists);
View Full Code Here

    private void saveRangeData(
            CssContext c, Box container, List blockContent, List inlineContent,
            BoxRangeLists rangeLists, boolean isBlock, int blockStart, int inlineStart,
            int blockRangeStart, int inlineRangeStart) {
        if (isBlock && c instanceof RenderingContext) {
            BlockBox blockBox = (BlockBox)container;
            if (blockBox.isNeedsClipOnPaint((RenderingContext)c)) {
                int blockEnd = blockContent.size();
                if (blockStart != blockEnd) {
                    BoxRange range = new BoxRange(blockStart, blockEnd);
                    rangeLists.getBlock().add(blockRangeStart, new BoxRangeData(blockBox, range));
                }
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.render.BlockBox

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.