Package org.xhtmlrenderer.layout

Examples of org.xhtmlrenderer.layout.Layer


            paintDefaultBackground(g);
            return;
        }
       
        // if this is the first time painting this document, then calc layout
        Layer root = getRootLayer();
        if (root == null || isPendingResize()) {
            doDocumentLayout(getGraphics());
            root = getRootLayer();
        }
        setPendingResize(false);
View Full Code Here


    private int calcCenteredPageLeftOffset(int maxPageWidth) {
        return (getWidth() - maxPageWidth) / 2;
    }

    public void paintPage(Graphics2D g, int pageNo) {
        Layer root = getRootLayer();

        if (root == null) {
            throw new RuntimeException("Document needs layout");
        }
       
        if (pageNo < 0 || pageNo >= root.getPages().size()) {
            throw new IllegalArgumentException("Page " + pageNo + " is not between 0 " +
                    "and " + root.getPages().size());
        }

        RenderingContext c = newRenderingContext(g);

        PageBox page = (PageBox)root.getPages().get(pageNo);
        c.setPageCount(root.getPages().size());
        c.setPage(pageNo, page);
       
        page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT);
        page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT);
        page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);
       
        Shape working = g.getClip();
       
        Rectangle content = page.getPrintClippingBounds(c);
        g.clip(content);
       
        int top = -page.getPaintingTop() +
            page.getMarginBorderPadding(c, CalculatedStyle.TOP);
       
        int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT);
       
        g.translate(left, top);
        root.paint(c);
        g.translate(-left, -top);
       
        g.setClip(working);
    }
View Full Code Here

    public Box find(MouseEvent e) {
        return find(e.getX(), e.getY());
    }
   
    public Box find(int x, int y) {
        Layer l = getRootLayer();
        if (l != null) {
            return l.find(layout_context, x, y, false);
        }
        return null;
    }
View Full Code Here

   * @param x The displayed x position
   * @param y the displayed y position
   */
  public Box find(int x, int y) {
    Point p = convertFromScaled(x, y);
    Layer l = getRootLayer();
    if (l != null) {
      return l.find(getLayoutContext(), p.x, p.y, false);
    }
    return null;
  }
View Full Code Here

            paintDefaultBackground(g);
            return;
        }
       
        // if this is the first time painting this document, then calc layout
        Layer root = getRootLayer();
        if (root == null || isPendingResize()) {
            doDocumentLayout(getGraphics());
            root = getRootLayer();
        }
        setPendingResize(false);
View Full Code Here

    private int calcCenteredPageLeftOffset(int maxPageWidth) {
        return (getWidth() - maxPageWidth) / 2;
    }

    public void paintPage(Graphics2D g, int pageNo) {
        Layer root = getRootLayer();

        if (root == null) {
            throw new RuntimeException("Document needs layout");
        }
       
        if (pageNo < 0 || pageNo >= root.getPages().size()) {
            throw new IllegalArgumentException("Page " + pageNo + " is not between 0 " +
                    "and " + root.getPages().size());
        }

        RenderingContext c = newRenderingContext(g);

        PageBox page = (PageBox)root.getPages().get(pageNo);
        c.setPageCount(root.getPages().size());
        c.setPage(pageNo, page);
       
        page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT);
        page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT);
        page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);
       
        Shape working = g.getClip();
       
        Rectangle content = page.getPrintClippingBounds(c);
        g.clip(content);
       
        int top = -page.getPaintingTop() +
            page.getMarginBorderPadding(c, CalculatedStyle.TOP);
       
        int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT);
       
        g.translate(left, top);
        root.paint(c);
        g.translate(-left, -top);
       
        g.setClip(working);
    }
View Full Code Here

            paintDefaultBackground(g);
            return;
        }

        // if this is the first time painting this document, then calc layout
        Layer root = getRootLayer();
        if (root == null || isNeedRelayout()) {
            doDocumentLayout(g.create());
            root = getRootLayer();
        }
        setNeedRelayout(false);
View Full Code Here

    private int calcCenteredPageLeftOffset(int maxPageWidth) {
        return (getWidth() - maxPageWidth) / 2;
    }

    public void paintPage(Graphics2D g, int pageNo) {
        Layer root = getRootLayer();

        if (root == null) {
            throw new RuntimeException("Document needs layout");
        }

        if (pageNo < 0 || pageNo >= root.getPages().size()) {
            throw new IllegalArgumentException("Page " + pageNo + " is not between 0 " +
                    "and " + root.getPages().size());
        }

        RenderingContext c = newRenderingContext(g);

        PageBox page = (PageBox)root.getPages().get(pageNo);
        c.setPageCount(root.getPages().size());
        c.setPage(pageNo, page);

        page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT);
        page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT);
        page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);

        Shape working = g.getClip();

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

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

        int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT);

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

        g.setClip(working);
    }
View Full Code Here

   * @param x The displayed x position
   * @param y the displayed y position
   */
  public Box find(int x, int y) {
    Point p = convertFromScaled(x, y);
    Layer l = getRootLayer();
    if (l != null) {
      return l.find(getLayoutContext(), p.x, p.y, false);
    }
    return null;
  }
View Full Code Here

    public Box find(MouseEvent e) {
        return find(e.getX(), e.getY());
    }

    public Box find(int x, int y) {
        Layer l = getRootLayer();
        if (l != null) {
            return l.find(layoutContext, x, y, false);
        }
        return null;
    }
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.