'Where can be found globalOffsetX, globalOffsetY and zoom in class extending new JRGraphics2DExporter?

I am upgrading libraries (from 3.x version to 6.0.0) in my project, which is using them, and I don't know, where get those 3 missing variables. They used to be protected in older version. Now they are private.

My old code:

import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRPrintPage;
import net.sf.jasperreports.engine.export.JRGraphics2DExporter;

public class SRptGraphics2DExporter extends JRGraphics2DExporter {

    Double rotationAngle = 0.0;

    public SRptGraphics2DExporter() throws JRException {
        super();
        this.setParameter(SRptGraphics2DExporterParameter.ROTATION_ANGLE, new Double(0.0));
    }

    @Override
    public void exportReportToGraphics2D() throws JRException {
        boolean printPageBorders = (Boolean) parameters.get(SRptGraphics2DExporterParameter.PRINT_PAGE_BORDERS);
        rotationAngle = (Double) parameters.get(SRptGraphics2DExporterParameter.ROTATION_ANGLE);
        grx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        grx.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
        grx.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);

        AffineTransform atrans = new AffineTransform();
        atrans.translate(globalOffsetX, globalOffsetY);
        atrans.rotate(rotationAngle);
        atrans.scale(zoom, zoom);

        AffineTransform sa = grx.getTransform();
        grx.transform(atrans);

        java.util.List pages = jasperPrint.getPages();
        if (pages != null) {
            Shape oldClipShape = grx.getClip();
            grx.clip(new Rectangle(0, 0, jasperPrint.getPageWidth(), jasperPrint.getPageHeight()));

            try {
                JRPrintPage page = (JRPrintPage) pages.get(startPageIndex);
                exportPage(page);
                if (printPageBorders) {
                    grx.drawRect(0, 0, jasperPrint.getPageWidth(), jasperPrint.getPageHeight());
                }
            } finally {
                grx.setClip(oldClipShape);
                grx.setTransform(sa);
            }
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source