Java 类net.sf.jasperreports.engine.print.JRPrinterAWT 实例源码

项目:jasperreports    文件:JasperPrintManager.java   
/**
 *
 */
public boolean print(
    JasperPrint jasperPrint,
    int firstPageIndex,
    int lastPageIndex,
    boolean withPrintDialog
    ) throws JRException
{
    return 
        new JRPrinterAWT(jasperReportsContext, jasperPrint).printPages(
            firstPageIndex,
            lastPageIndex,
            withPrintDialog
            );
}
项目:jasperreports    文件:JasperPrintManager.java   
/**
 *
 */
public Image printToImage(
    JasperPrint jasperPrint,
    int pageIndex,
    float zoom
    ) throws JRException
{
    return new JRPrinterAWT(jasperReportsContext, jasperPrint).printPageToImage(pageIndex, zoom);
}
项目:openbravo-pos    文件:JRViewer300.java   
/**
*/
protected void refreshPage()
{
    if (
        jasperPrint == null ||
        jasperPrint.getPages() == null ||
        jasperPrint.getPages().size() == 0
        )
    {
        pnlPage.setVisible(false);
        btnSave.setEnabled(false);
        btnPrint.setEnabled(false);
        btnActualSize.setEnabled(false);
        btnFitPage.setEnabled(false);
        btnFitWidth.setEnabled(false);
        btnZoomIn.setEnabled(false);
        btnZoomOut.setEnabled(false);
        cmbZoom.setEnabled(false);

        if (jasperPrint != null)
        {
            JOptionPane.showMessageDialog(this, getBundleString("no.pages"));
        }

        return;
    }

    pnlPage.setVisible(true);
    btnSave.setEnabled(true);
    btnPrint.setEnabled(true);
    btnActualSize.setEnabled(true);
    btnFitPage.setEnabled(true);
    btnFitWidth.setEnabled(true);
    btnZoomIn.setEnabled(zoom < MAX_ZOOM);
    btnZoomOut.setEnabled(zoom > MIN_ZOOM);
    cmbZoom.setEnabled(true);

    Dimension dim = new Dimension(
        (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image
        (int)(jasperPrint.getPageHeight() * realZoom) + 8
        );
    pnlPage.setMaximumSize(dim);
    pnlPage.setMinimumSize(dim);
    pnlPage.setPreferredSize(dim);

    long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE);
    boolean renderImage;
    if (maxImageSize <= 0)
    {
        renderImage = false;
    }
    else
    {
        long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom);
        renderImage = imageSize <= maxImageSize;
    }

    lblPage.setRenderImage(renderImage);

    if (renderImage)
    {
        setPageImage();
    }

    pnlLinks.removeAll();
    linksMap = new HashMap();

    createHyperlinks();

    if (!renderImage)
    {
        lblPage.setIcon(null);

        pnlMain.validate();
        pnlMain.repaint();
    }
}
项目:wifepos    文件:JRViewer300.java   
/**
*/
protected void refreshPage()
{
    if (
        jasperPrint == null ||
        jasperPrint.getPages() == null ||
        jasperPrint.getPages().isEmpty()
        )
    {
        pnlPage.setVisible(false);
        btnSave.setEnabled(false);
        btnPrint.setEnabled(false);
        btnActualSize.setEnabled(false);
        btnFitPage.setEnabled(false);
        btnFitWidth.setEnabled(false);
        btnZoomIn.setEnabled(false);
        btnZoomOut.setEnabled(false);
        cmbZoom.setEnabled(false);

        if (jasperPrint != null)
        {
            JOptionPane.showMessageDialog(this, getBundleString("no.pages"));
        }

        return;
    }

    pnlPage.setVisible(true);
    btnSave.setEnabled(true);
    btnPrint.setEnabled(true);
    btnActualSize.setEnabled(true);
    btnFitPage.setEnabled(true);
    btnFitWidth.setEnabled(true);
    btnZoomIn.setEnabled(zoom < MAX_ZOOM);
    btnZoomOut.setEnabled(zoom > MIN_ZOOM);
    cmbZoom.setEnabled(true);

    Dimension dim = new Dimension(
        (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image
        (int)(jasperPrint.getPageHeight() * realZoom) + 8
        );
    pnlPage.setMaximumSize(dim);
    pnlPage.setMinimumSize(dim);
    pnlPage.setPreferredSize(dim);

    long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE);
    boolean renderImage;
    if (maxImageSize <= 0)
    {
        renderImage = false;
    }
    else
    {
        long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom);
        renderImage = imageSize <= maxImageSize;
    }

    lblPage.setRenderImage(renderImage);

    if (renderImage)
    {
        setPageImage();
    }

    pnlLinks.removeAll();
    linksMap = new HashMap();

    createHyperlinks();

    if (!renderImage)
    {
        lblPage.setIcon(null);

        pnlMain.validate();
        pnlMain.repaint();
    }
}
项目:micro-Blagajna    文件:JRViewer300.java   
/**
*/
protected void refreshPage()
{
    if (
        jasperPrint == null ||
        jasperPrint.getPages() == null ||
        jasperPrint.getPages().isEmpty()
        )
    {
        pnlPage.setVisible(false);
        btnSave.setEnabled(false);
        btnPrint.setEnabled(false);
        btnActualSize.setEnabled(false);
        btnFitPage.setEnabled(false);
        btnFitWidth.setEnabled(false);
        btnZoomIn.setEnabled(false);
        btnZoomOut.setEnabled(false);
        cmbZoom.setEnabled(false);

        if (jasperPrint != null)
        {
            JOptionPane.showMessageDialog(this, getBundleString("no.pages"));
        }

        return;
    }

    pnlPage.setVisible(true);
    btnSave.setEnabled(true);
    btnPrint.setEnabled(true);
    btnActualSize.setEnabled(true);
    btnFitPage.setEnabled(true);
    btnFitWidth.setEnabled(true);
    btnZoomIn.setEnabled(zoom < MAX_ZOOM);
    btnZoomOut.setEnabled(zoom > MIN_ZOOM);
    cmbZoom.setEnabled(true);

    Dimension dim = new Dimension(
        (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image
        (int)(jasperPrint.getPageHeight() * realZoom) + 8
        );
    pnlPage.setMaximumSize(dim);
    pnlPage.setMinimumSize(dim);
    pnlPage.setPreferredSize(dim);

    long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE);
    boolean renderImage;
    if (maxImageSize <= 0)
    {
        renderImage = false;
    }
    else
    {
        long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom);
        renderImage = imageSize <= maxImageSize;
    }

    lblPage.setRenderImage(renderImage);

    if (renderImage)
    {
        setPageImage();
    }

    pnlLinks.removeAll();
    linksMap = new HashMap();

    createHyperlinks();

    if (!renderImage)
    {
        lblPage.setIcon(null);

        pnlMain.validate();
        pnlMain.repaint();
    }
}
项目:unicenta    文件:JRViewer300.java   
/**
*/
protected void refreshPage()
{
    if (
        jasperPrint == null ||
        jasperPrint.getPages() == null ||
        jasperPrint.getPages().isEmpty()
        )
    {
        pnlPage.setVisible(false);
        btnSave.setEnabled(false);
        btnPrint.setEnabled(false);
        btnActualSize.setEnabled(false);
        btnFitPage.setEnabled(false);
        btnFitWidth.setEnabled(false);
        btnZoomIn.setEnabled(false);
        btnZoomOut.setEnabled(false);
        cmbZoom.setEnabled(false);

        if (jasperPrint != null)
        {
            JOptionPane.showMessageDialog(this, getBundleString("no.pages"));
        }

        return;
    }

    pnlPage.setVisible(true);
    btnSave.setEnabled(true);
    btnPrint.setEnabled(true);
    btnActualSize.setEnabled(true);
    btnFitPage.setEnabled(true);
    btnFitWidth.setEnabled(true);
    btnZoomIn.setEnabled(zoom < MAX_ZOOM);
    btnZoomOut.setEnabled(zoom > MIN_ZOOM);
    cmbZoom.setEnabled(true);

    Dimension dim = new Dimension(
        (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image
        (int)(jasperPrint.getPageHeight() * realZoom) + 8
        );
    pnlPage.setMaximumSize(dim);
    pnlPage.setMinimumSize(dim);
    pnlPage.setPreferredSize(dim);

    long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE);
    boolean renderImage;
    if (maxImageSize <= 0)
    {
        renderImage = false;
    }
    else
    {
        long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom);
        renderImage = imageSize <= maxImageSize;
    }

    lblPage.setRenderImage(renderImage);

    if (renderImage)
    {
        setPageImage();
    }

    pnlLinks.removeAll();
    linksMap = new HashMap();

    createHyperlinks();

    if (!renderImage)
    {
        lblPage.setIcon(null);

        pnlMain.validate();
        pnlMain.repaint();
    }
}
项目:OpenbravoPOS    文件:JRViewer300.java   
/**
*/
protected void refreshPage()
{
    if (
        jasperPrint == null ||
        jasperPrint.getPages() == null ||
        jasperPrint.getPages().size() == 0
        )
    {
        pnlPage.setVisible(false);
        btnSave.setEnabled(false);
        btnPrint.setEnabled(false);
        btnActualSize.setEnabled(false);
        btnFitPage.setEnabled(false);
        btnFitWidth.setEnabled(false);
        btnZoomIn.setEnabled(false);
        btnZoomOut.setEnabled(false);
        cmbZoom.setEnabled(false);

        if (jasperPrint != null)
        {
            JOptionPane.showMessageDialog(this, getBundleString("no.pages"));
        }

        return;
    }

    pnlPage.setVisible(true);
    btnSave.setEnabled(true);
    btnPrint.setEnabled(true);
    btnActualSize.setEnabled(true);
    btnFitPage.setEnabled(true);
    btnFitWidth.setEnabled(true);
    btnZoomIn.setEnabled(zoom < MAX_ZOOM);
    btnZoomOut.setEnabled(zoom > MIN_ZOOM);
    cmbZoom.setEnabled(true);

    Dimension dim = new Dimension(
        (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image
        (int)(jasperPrint.getPageHeight() * realZoom) + 8
        );
    pnlPage.setMaximumSize(dim);
    pnlPage.setMinimumSize(dim);
    pnlPage.setPreferredSize(dim);

    long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE);
    boolean renderImage;
    if (maxImageSize <= 0)
    {
        renderImage = false;
    }
    else
    {
        long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom);
        renderImage = imageSize <= maxImageSize;
    }

    lblPage.setRenderImage(renderImage);

    if (renderImage)
    {
        setPageImage();
    }

    pnlLinks.removeAll();
    linksMap = new HashMap();

    createHyperlinks();

    if (!renderImage)
    {
        lblPage.setIcon(null);

        pnlMain.validate();
        pnlMain.repaint();
    }
}