org.tentackle.print
Interface ReportSource

All Known Implementing Classes:
ReportSourceAdapter

public interface ReportSource

Datasource for a Report.
Reports are implemented as state machines and get the data to be printed from a ReportSource.

Author:
harald

Field Summary
static int EOF
          end of data: print "trailer"
static int ERROR
          some error, abort!
static int POP
          print subfooter, decrement level
static int PRINT
          print "data"
static int PUSH
          increment "level", print subheader
 
Method Summary
 int advance(Report report)
          Prepare the data in this report source so that it can be printed.
 void close()
          Closes this report source and do any necessary cleanup.
 boolean hasNext()
          Checks if there is more data to print.
Notice that advance() may still be invoked even if hasNext() has returned false! Furthermore, advance() will not always be invoked after hasNext(), thus hasNext() must not change any state!
 void open()
          Opens this report source.
 int prepareFooter(Report report)
          Prepares the footer panel for printing.
 int prepareHeader(Report report)
          Prepares the header panel for printing.
 int prepareIntro(Report report)
          Prepares the intro panel for printing.
 int prepareLine(Report report)
          Prepares the line panel for printing.
 int prepareSubFooter(Report report, int level)
          Prepares the subfooter for printing.
 int prepareSubHeader(Report report, int level)
          Prepares the subheader panel for printing.
 int prepareTrailer(Report report)
          Prepares the trailer panel for printing.
 void restore()
          Restores the last saved state.
 void rewind()
          Rewinds this report source.
 void save()
          Saves the current state.
 

Field Detail

ERROR

static final int ERROR
some error, abort!

See Also:
Constant Field Values

EOF

static final int EOF
end of data: print "trailer"

See Also:
Constant Field Values

PRINT

static final int PRINT
print "data"

See Also:
Constant Field Values

PUSH

static final int PUSH
increment "level", print subheader

See Also:
Constant Field Values

POP

static final int POP
print subfooter, decrement level

See Also:
Constant Field Values
Method Detail

open

void open()
Opens this report source.


close

void close()
Closes this report source and do any necessary cleanup.


rewind

void rewind()
Rewinds this report source.


save

void save()
Saves the current state.

See Also:
restore()

restore

void restore()
Restores the last saved state.

See Also:
save()

hasNext

boolean hasNext()
Checks if there is more data to print.
Notice that advance() may still be invoked even if hasNext() has returned false! Furthermore, advance() will not always be invoked after hasNext(), thus hasNext() must not change any state!

Returns:
true if there is more data
See Also:
advance(org.tentackle.print.Report)

advance

int advance(Report report)
Prepare the data in this report source so that it can be printed. This method is the basic workhorse to setup the print panels, switch logical levels, sum up, etc...

Parameters:
report - the Report requesting the preparation
Returns:
the new state
See Also:
hasNext()

prepareIntro

int prepareIntro(Report report)
Prepares the intro panel for printing. The intro is printed once at the start of the report.

Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareTrailer

int prepareTrailer(Report report)
Prepares the trailer panel for printing. The trailer is printed once at the end of the report.

Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareHeader

int prepareHeader(Report report)
Prepares the header panel for printing. The header is printed at the beginning of each page, except the first if an intro is defined.

Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareFooter

int prepareFooter(Report report)
Prepares the footer panel for printing. The footer is printed at the end of each page, except the last if a trailer is defined.

Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareLine

int prepareLine(Report report)
Prepares the line panel for printing. The line panel prints the current "data row".

Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareSubHeader

int prepareSubHeader(Report report,
                     int level)
Prepares the subheader panel for printing. The subheader is printed at start of each logical "data group".

Parameters:
report - the report
level - the logical group level (starting at 1)
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareSubFooter

int prepareSubFooter(Report report,
                     int level)
Prepares the subfooter for printing. The subheader is printed at end of each logical "data group".

Parameters:
report - the report
level - the logical group level (starting at 1)
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de