TextReportEngine Examples

There are two examples of TextReportEngine usage.

BeverageReport uses a single Beverage object to generate a plain text report. It uses fixed-length fields, specified using hash symbols (#).

BeverageHTMLReport shows a report with a header, a footer, and a repeating subsection, which is generated for each object in a Vector of Beverages. It uses variable-length fields, specified using backticks (`) around the name of the field. To liven it up even more, the format for the report is stored in a configuration file in TOF format (this may look funny in your web browser, since it contains embedded HTML codes - be sure to check it out with a text editor).

To try them out, just:

  1. compile them with javac
  2. make sure the class files are in your classpath somewhere
  3. open a command shell and set your current directory to the directory that BeverageReportFormat.tof is in
  4. run
    java BeverageReport
    	  
    and
    java BeverageHTMLReport
    	  

The programs will create the files BeverageReport.txt and BeverageReport.html.


Last modified: Tue Jun 16 11:27:48 EDT