After you installed JReport Designer, you can find the following illustrative sample programs for using the Engine Bean in <install_root>\help\designer\samples.
A sample program. Here is an explanation of how TestEngineBean.java works, and how it uses the methods provided by JReport Engine Bean.
First, the example file TestEngineBean.java contains hard-coded paths. These must be modified before they can be compiled and run. For example, assume that JReport Designer has been installed to C:\JReport\Designer, the Test B section can be modified as follows:
bean.setUID("test"); |
The result file will be saved in the C:\JReport\Designer\temp directory and the result file name will be SalesAnalysisbyRetailStore.rst.
In addition, TestEngineBean.java will also show how to use JReport Engine Bean to export the result file (.rst extension) to the different file formats (HTML, PDF, TEXT, etc.).
Assume that SalesAnalysisbyRetailStore.rst has already been generated by JReport Engine Bean, you can then export it to the different file formats:
|
C:\\JReport\\Designer\\temp\\... is the location where users specify the new generated files. Finally, TestEngineBean.java will call the methods to add, delete, save and get the WHERE portion in the report catalog:
|
To run TestEngineBean.java, you need to use the following command to compile it first:
|
Here, it is assumed that C:\JReport\Designer is the location where JReport Engine Bean has been installed to, and it is the current directory when users execute these commands. The sample program can then be run with the following command:
|
When the sample program is complete, you will notice a temporary file <reportname>.rst. For this particular sample program, it will either be customerlist.rst or phaseorder.rst depending on which report has been executed. These result files can be read and displayed by either JReport Viewer (the thin client viewer) or JReport Result Viewer Bean.
Sample programs purely for the method operated on a WHERE portion. You can add, save and delete a new WHERE portion just as you would with TestEngineBean.java. The difference is that the user can do all of these things in his own report home, catalog and report file. These result files can be read and displayed by either JReport Viewer (the thin client viewer) or JReport Result Viewer Bean.
To compile and run these sample programs, you can use the same way as compiling and running TestEngineBean.java.