Package org.xhtmlrenderer.layout

Examples of org.xhtmlrenderer.layout.Layer


            // just draw background
            e.gc.fillRectangle(getClientArea());
        }

        // if this is the first time painting this document, then calc layout
        Layer root = getRootLayer();
        if (root == null || _needRelayout) {
            doLayout();
            root = getRootLayer();
            if (_offscreen != null) {
                // invalidate offscreen image
View Full Code Here


        } catch (Throwable e) {
            XRLog.exception(e.getMessage(), e);
            e.printStackTrace();
        }

        Layer rootLayer = _rootBox.getLayer();
        _hasFixedContent = rootLayer.containsFixedContent();

        XRLog.layout(Level.FINEST, "after layout: " + _rootBox);

        // update scrollbars
        Dimension intrinsic_size = rootLayer.getPaintingDimension(_layout_context);
        if (_layout_context.isPrint()) {
            rootLayer.trimEmptyPages(_layout_context, intrinsic_size.height);
            if (rootLayer.getLastPage() != null) {
                rootLayer.assignPagePaintingPositions(_layout_context, Layer.PAGED_MODE_SCREEN,
                        PAGE_PAINTING_CLEARANCE);
                _drawnSize = new Point(rootLayer.getMaxPageWidth(_layout_context,
                        PAGE_PAINTING_CLEARANCE), rootLayer.getLastPage().getPaintingBottom()
                        + PAGE_PAINTING_CLEARANCE);
            } else {
                _drawnSize = new Point(0, 0);
            }
        } else {
View Full Code Here

    public LayoutContext getLayoutContext() {
        return _layout_context;
    }

    public Box find(int x, int y) {
        Layer l = getRootLayer();
        if (l != null) {
            return l.find(_layout_context, x + _origin.x, y + _origin.y, false);
        }
        return null;
    }
View Full Code Here

            } catch (Throwable e) {
                XRLog.exception(e.getMessage(), e);
                return;
            }

            Layer root = rootBox.getLayer();
            Dimension intrinsic_size = root.getPaintingDimension(layout);
            root.trimEmptyPages(layout, intrinsic_size.height);
            root.assignPagePaintingPositions(layout, Layer.PAGED_MODE_PRINT);

            // RENDER
            c = newRenderingContext(gc);
            List pages = root.getPages();
            c.setPageCount(pages.size());
            if (startPage < 0) {
                startPage = 0;
            } else if (startPage >= pages.size()) {
                startPage = pages.size() - 1;
            }
            if (endPage < 0 || endPage >= pages.size()) {
                endPage = pages.size() - 1;
            }

            Shape working = c.getOutputDevice().getClip();

            for (int i = startPage; i <= endPage; i++) {
                PageBox page = (PageBox) pages.get(i);
                c.setPage(i, page);

                if (!_printer.startPage()) {
                    return;
                }
               
                page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT);
                page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT);
                page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);

                Rectangle content = page.getPrintClippingBounds(c);
                c.getOutputDevice().clip(content);

                int top = -page.getPaintingTop()
                        + page.getMarginBorderPadding(c, CalculatedStyle.TOP);
                int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT);

                c.getOutputDevice().translate(left, top);
                root.paint(c);
                c.getOutputDevice().translate(-left, -top);

                c.getOutputDevice().setClip(working);

                _printer.endPage();
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.layout.Layer

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.