A GenJ report is a Java class that implements the interface genj.report.Report. Writing your own functionality starts by defining your own class in a source-file and placing that file into the reports-subdirectory (its name has to start with Report*).
Let's assume we want to write a test-report named "Test1". First create a text-file named ReportTest1.java in ./reports. Then compile it by running the compile-script in the same directory. This script runs javac - the java compiler. The end-result is a file named ReportTest1.class which GenJ can load and execute after it's selected in the Report View.
Let's have a look at the sample ReportTest1.java. It contains one public class-definition that conforms to the Report contract (implements Report). Part of that contract is to supply behaviour for all of the following methods:
See the example below or the downloadable API to learn more about what those methods are there for. The most important one is start - it's the main entrypoint into the report's logic:getName getInfo start usesStandardOut getAuthor isReadOnly
import genj.gedcom.*; import genj.report.*; import java.io.*; public class ReportTest1 implements Report { public String getName() { return "Test1"; } public String getInfo() { return "This report is oh so good"; } public boolean start( ReportView view, Gedcom gedcom, ReportWriter out) throws InterruptedException { out.println("Hello World"); return true; } public boolean usesStandardOut() { return true; } public String getAuthor() { return "Nils Meier"; } public boolean isReadOnly() { return true; } }
Inside the start-method all the information in the Gedcom-object can be accessed. You will have to download the GenJ API (a HTML class reference) to explore the possibilities captured in the GenJ core-classes. For starters you should try to extend the already existing reports.