org.tentackle.print
Class ReportSourceAdapter

java.lang.Object
  extended by org.tentackle.print.ReportSourceAdapter
All Implemented Interfaces:
ReportSource

public class ReportSourceAdapter
extends Object
implements ReportSource

Provides some default-implementations for a ReportSource Interface

Author:
harald

Field Summary
 
Fields inherited from interface org.tentackle.print.ReportSource
EOF, ERROR, POP, PRINT, PUSH
 
Constructor Summary
ReportSourceAdapter()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportSourceAdapter

public ReportSourceAdapter()
Method Detail

open

public void open()
Description copied from interface: ReportSource
Opens this report source.

Specified by:
open in interface ReportSource

close

public void close()
Description copied from interface: ReportSource
Closes this report source and do any necessary cleanup.

Specified by:
close in interface ReportSource

rewind

public void rewind()
Description copied from interface: ReportSource
Rewinds this report source.

Specified by:
rewind in interface ReportSource

save

public void save()
Description copied from interface: ReportSource
Saves the current state.

Specified by:
save in interface ReportSource
See Also:
ReportSource.restore()

restore

public void restore()
Description copied from interface: ReportSource
Restores the last saved state.

Specified by:
restore in interface ReportSource
See Also:
ReportSource.save()

hasNext

public boolean hasNext()
Description copied from interface: ReportSource
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!

Specified by:
hasNext in interface ReportSource
Returns:
true if there is more data
See Also:
ReportSource.advance(org.tentackle.print.Report)

advance

public int advance(Report report)
Description copied from interface: ReportSource
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...

Specified by:
advance in interface ReportSource
Parameters:
report - the Report requesting the preparation
Returns:
the new state
See Also:
ReportSource.hasNext()

prepareIntro

public int prepareIntro(Report report)
Description copied from interface: ReportSource
Prepares the intro panel for printing. The intro is printed once at the start of the report.

Specified by:
prepareIntro in interface ReportSource
Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareTrailer

public int prepareTrailer(Report report)
Description copied from interface: ReportSource
Prepares the trailer panel for printing. The trailer is printed once at the end of the report.

Specified by:
prepareTrailer in interface ReportSource
Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareHeader

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

Specified by:
prepareHeader in interface ReportSource
Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareFooter

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

Specified by:
prepareFooter in interface ReportSource
Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareLine

public int prepareLine(Report report)
Description copied from interface: ReportSource
Prepares the line panel for printing. The line panel prints the current "data row".

Specified by:
prepareLine in interface ReportSource
Parameters:
report - the report
Returns:
the pixels +/- to start printing relative to current vertical offset (usually 0)

prepareSubHeader

public int prepareSubHeader(Report report,
                            int level)
Description copied from interface: ReportSource
Prepares the subheader panel for printing. The subheader is printed at start of each logical "data group".

Specified by:
prepareSubHeader in interface ReportSource
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

public int prepareSubFooter(Report report,
                            int level)
Description copied from interface: ReportSource
Prepares the subfooter for printing. The subheader is printed at end of each logical "data group".

Specified by:
prepareSubFooter in interface ReportSource
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