TestDesignInvoice.java is primarily designed for creating a report with the methods provided by the Designer API. Here is an explanation of how TestDesignInvoice.java works.
The constructor of Designer has two parameters: path and name. They are respectively the path and name of the catalog with which the report will be created.
The output stream log points to the path and file in which to write log messages. Parameter "8859_1" is the encoding for the messages.
This method gets all handles of PAGE type and returns a handle array. Parameter report is the parent handle, and Designer.PAGE is a class type value which is defined in the Designer class.
This method creates a new report and returns its handle. Parameter name is the name of the report that is to be created, and Invoice is the name of the query in the catalog file SampleReports.cat with which the report is created.
This method inserts a new group panel and returns its handle. Parameter handle[0] is the parent node handle. The newly inserted object will be in this node. Designer.GROUP is the class type for this type of insertion. GroupPanel1 is the name of group panel that is to be inserted, and Customers_Customer ID is the mapping name to group by.
This method inserts a label named label1 into the group header. Parameter header is the parent handle, the newly inserted object will be in this node. desg.LABEL is the class type that you want to insert, and Label1 is the object name to be inserted.
This method inserts a DBField named DBField1 into the group header. Parameter header is handle of the parent node; Designer.DBFIELD is class type that is to be inserted, and Orders_Orders ID is the mapping name of the database field.
For example, in the sample program, it is made sure that the parameter PToday, formula customeraddress12, and summary Sum_total9 already exist in the catalog by the following:
|
For example, in the sample program, you can insert the image, box and line as follows:
|
In the sample program, you can set the property value as follows:
|
This method ends the editing status, releases all resources and saves all of the reports and the catalog.
C:\JReport\Designer\help\designer\samples has been run first to generate a catalog file Tutorial.cat in C:\JReport\Designer\Demo\Reports\APITutorial.
For example, you can use the following command to compile the sample program:
|
When you run the sample program, you should provide two or three parameters. If you want to use two parameters, they should be catalog path and catalog name, and the command line should be:
|
If you want to use three parameters, they should be catalog path, catalog name and log file with a full path name, and the command line should be:
|
Here, it is assumed that JReport Designer has been installed to C:\JReport\Designer, and the current directory when you execute these commands is C:\JReport\Designer\help\designer\samples (location of the sample programs). After running the program, you will find a newly created file invoice1.cls in C:\JReport\Designer\Demo\Reports\APITurorial.