bb6cc6e241
- lib/java/: Java renderer (JrxmlRenderer) using JasperReports 6.21.0 - JrxmlDebug for diagnostics, JrxmlGen for format reference - download_jars.sh for one-time dependency setup - agent/nodes.py: _render_jrxml_to_png() and _compute_pixel_similarity() - Pixel comparison integrates into validate node (SSIM < 0.4 fails) - Pixel fidelity context injected into correct_jrxml for targeted fixes - tests/test_pixel_comparison.py: 15 unit tests (render, SSIM, integration) - .gitignore: exclude lib/java/*.jar, lib/java/*.class, tmp/ - CLAUDE.md: v11 changelog documenting the rendering pipeline - All non-LLM tests pass (97/97)
59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
import net.sf.jasperreports.engine.*;
|
|
import net.sf.jasperreports.engine.design.*;
|
|
import net.sf.jasperreports.jackson.util.*;
|
|
import java.io.*;
|
|
|
|
/**
|
|
* Generate a minimal JasperDesign programmatically, then serialize it
|
|
* via JacksonUtil to show the correct 7.x XML format.
|
|
*/
|
|
public class JrxmlGen {
|
|
public static void main(String[] args) throws Exception {
|
|
JasperDesign design = new JasperDesign();
|
|
design.setName("TestReport");
|
|
design.setPageWidth(595);
|
|
design.setPageHeight(842);
|
|
design.setColumnWidth(555);
|
|
design.setLeftMargin(20);
|
|
design.setRightMargin(20);
|
|
design.setTopMargin(20);
|
|
design.setBottomMargin(20);
|
|
design.setWhenNoDataType(com.fasterxml.jackson.databind.node.TextNode.valueOf("AllSectionsNoDetail"));
|
|
|
|
design.setQuery("SELECT 1");
|
|
|
|
JRDesignBand titleBand = new JRDesignBand();
|
|
titleBand.setHeight(50);
|
|
JRDesignStaticText st = new JRDesignStaticText();
|
|
st.setX(0);
|
|
st.setY(0);
|
|
st.setWidth(555);
|
|
st.setHeight(30);
|
|
st.setText("HELLO WORLD");
|
|
titleBand.addElement(st);
|
|
design.setTitle(titleBand);
|
|
|
|
JRDesignBand detailBand = new JRDesignBand();
|
|
detailBand.setHeight(20);
|
|
JRDesignStaticText dt = new JRDesignStaticText();
|
|
dt.setX(0);
|
|
dt.setY(0);
|
|
dt.setWidth(555);
|
|
dt.setHeight(20);
|
|
dt.setText("test row");
|
|
detailBand.addElement(dt);
|
|
design.setDetail(detailBand);
|
|
|
|
JacksonUtil util = JacksonUtil.getInstance(DefaultJasperReportsContext.getInstance());
|
|
String xml = util.saveXml(design);
|
|
System.out.println("=== Serialized 7.x JRXML ===");
|
|
System.out.println(xml);
|
|
|
|
String outPath = "D:/Idea Project/jaspersoft/tmp/test_reference.jrxml";
|
|
try (FileWriter fw = new FileWriter(outPath)) {
|
|
fw.write(xml);
|
|
}
|
|
System.out.println("\nSaved to: " + outPath);
|
|
}
|
|
}
|