0
我正在使用它們的項目中升級庫(從3.x版本到6.0.0),並且我不知道在哪裏得到這3個缺失變量。他們曾經在舊版本中受到保護。現在他們是私人的。我在哪裏可以找到globalOffsetX,globalOffsetY和放大課程擴展新的JRGraphics2DExporter?
我的舊代碼:
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);
}
}
}
}
發現它在受保護的JR(約3.xx的版本) –
的舊的源代碼 - (變焦不可在這個版本中)http://grepcode.com/file/repo1.maven.org/maven2/net.sf.jasperreports/jasperreports/5.0.4/net/sf/jasperreports/engine/JRAbstractExporter.java#JRAbstractExporter.0globalOffsetX –
我試圖用新的庫來編譯這個代碼......它與舊的一起工作,並與新的一個netbeans告訴我,符號無法找到 - 我應該發送整個班? –