|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjimm.datavision.layout.LayoutEngine
public abstract class LayoutEngine
A layout engine is responsible for formatting and outputting report data.
LayoutEngine is an abstract class. The Template design
pattern is heavily used to provide a framework for concrete layout
engine subclasses.
| Field Summary | |
|---|---|
protected Section |
currentSection
|
protected boolean |
newPage
|
protected java.io.PrintWriter |
out
|
protected double |
pageHeight
|
protected double |
pageHeightUsed
|
protected int |
pageNumber
|
protected double |
pageWidth
|
static int |
POINTS_PER_INCH
The number of points per inch. |
protected int |
previousSectionArea
|
protected Report |
report
Set by report in Report.setLayoutEngine. |
protected static int |
SECT_DETAIL
|
protected static int |
SECT_GROUP_FOOTER
|
protected static int |
SECT_GROUP_HEADER
|
protected static int |
SECT_PAGE_FOOTER
|
protected static int |
SECT_PAGE_HEADER
|
protected static int |
SECT_REPORT_FOOTER
|
protected static int |
SECT_REPORT_HEADER
|
protected boolean |
wantsMoreData
|
| Constructor Summary | |
|---|---|
LayoutEngine()
Constructor. |
|
LayoutEngine(java.io.PrintWriter out)
Constructor. |
|
| Method Summary | |
|---|---|
protected double |
calcDetailHeight()
Returns the total height of all detail sections. |
protected double |
calcPageFooterHeight()
Returns the total height of all page footer sections. |
protected double |
calcReportFooterHeight()
Returns the total height of all report footer sections. |
protected double |
calcSectionHeights(SectionArea area)
Returns the total height of all sections in the specified list. |
void |
cancel()
Called by someone else running the report to cancel all the hard work this layout engine has performed. |
protected void |
checkRemainingPageLength(boolean isLastRow,
boolean includeDetail)
Checks remaining page length and outputs a new page if we are at the bottom of the page. |
protected void |
closeOutput()
Called by end to let this layout engine clean up a bit. |
protected java.lang.String |
currentSectionTypeAsString()
Returns the current section type (header, footer, detail) as a string. |
void |
detail(boolean isLastRow)
Called by the report when a single detail row needs to be output. |
protected void |
doEnd()
Called by end as a chance to insert behavior when the
report ends. |
protected void |
doEndPage()
Called by endPage as a chance to insert behavior when a
new page ends. |
protected abstract void |
doOutputField(Field field)
Called by outputField as a chance to insert behavior
when a field is output. |
protected abstract void |
doOutputImage(ImageField image)
Called by outputImage as a chance to insert behavior
when a image is output. |
protected abstract void |
doOutputLine(Line line)
Called by outputLine as a chance to insert behavior
when a line is output. |
protected void |
doOutputSection(Section sect)
Called by outputSection as a chance to insert behavior
when a section is output. |
protected void |
doStart()
Called by start as a chance to insert behavior when the
report starts. |
protected void |
doStartPage()
Called by startPage as a chance to insert behavior when a
new page starts. |
void |
end()
Called by the report at the end of a report run. |
protected void |
endPage(boolean isLastPage)
Ends a new page. |
void |
groupFooters(boolean isLastRow)
Called by the report when group footers need to be output. |
void |
groupHeaders(boolean isLastRow)
Called by the report when group headers need to be output. |
protected void |
outputField(Field field)
Outputs a field. |
protected void |
outputImage(ImageField image)
Outputs a image. |
protected void |
outputLine(Line line)
Outputs a line. |
protected void |
outputSection(Section sect,
int which)
Outputs a section. |
double |
pageHeight()
Returns the page height in points. |
int |
pageNumber()
Returns the current page number. |
double |
pageWidth()
Returns the page width in points. |
void |
setReport(Report r)
|
void |
start()
Called by the report at the beginning of a report run. |
protected void |
startPage()
Starts a new page. |
boolean |
wantsMoreData()
Called by a report before retrieving each row of data, this method returns true if this layout engine wants more data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int POINTS_PER_INCH
protected static final int SECT_REPORT_HEADER
protected static final int SECT_REPORT_FOOTER
protected static final int SECT_PAGE_HEADER
protected static final int SECT_PAGE_FOOTER
protected static final int SECT_GROUP_HEADER
protected static final int SECT_GROUP_FOOTER
protected static final int SECT_DETAIL
protected Report report
Report.setLayoutEngine.
protected int pageNumber
protected java.io.PrintWriter out
protected boolean newPage
protected double pageHeight
protected double pageWidth
protected double pageHeightUsed
protected Section currentSection
protected boolean wantsMoreData
protected int previousSectionArea
| Constructor Detail |
|---|
public LayoutEngine()
public LayoutEngine(java.io.PrintWriter out)
out - output print writer| Method Detail |
|---|
public void setReport(Report r)
public double pageWidth()
start() has been called.
public double pageHeight()
start() has been called.
public boolean wantsMoreData()
true if this layout engine wants more data. Concrete
subclasses can set the wantsMoreData instance variable
to false if the user cancells a report run, for example.
true if this layout engine would like more datapublic void cancel()
public void start()
By this time, report will be non-null
because we have been added to a report (which in turn sets our
report instance variable).
protected void doStart()
start as a chance to insert behavior when the
report starts.
public void end()
protected void doEnd()
end as a chance to insert behavior when the
report ends.
protected void closeOutput()
end to let this layout engine clean up a bit.
public void groupHeaders(boolean isLastRow)
We need to explicitly evaluate all formulas in the headers that will be
output because checkRemainingPageLength(boolean, boolean) causes formulas in
detail and footers to be evaluated. Those formulas may depend upon
values in these headers.
isLastRow - if true, this is the last row of the reportpublic void detail(boolean isLastRow)
isLastRow - if true, this is the last row of the reportpublic void groupFooters(boolean isLastRow)
isLastRow - if true, this is the last row of the report
protected void checkRemainingPageLength(boolean isLastRow,
boolean includeDetail)
isLastRow - if true, this is the last row of the reportincludeDetail - if true, include height of detail
sectionspublic int pageNumber()
protected void startPage()
protected void doStartPage()
startPage as a chance to insert behavior when a
new page starts.
protected void endPage(boolean isLastPage)
isLastPage - if true, this is the last page of the reportprotected void doEndPage()
endPage as a chance to insert behavior when a
new page ends.
protected void outputSection(Section sect,
int which)
sect - the section to outputwhich - the type of section (for example,
SECT_PAGE_FOOTER)protected void doOutputSection(Section sect)
outputSection as a chance to insert behavior
when a section is output.
sect - a sectionprotected void outputField(Field field)
field - the field to outputprotected abstract void doOutputField(Field field)
outputField as a chance to insert behavior
when a field is output.
field - a fieldprotected void outputImage(ImageField image)
image - the image field to outputprotected abstract void doOutputImage(ImageField image)
outputImage as a chance to insert behavior
when a image is output.
image - an image fieldprotected void outputLine(Line line)
line - the line to outputprotected abstract void doOutputLine(Line line)
outputLine as a chance to insert behavior
when a line is output.
line - a lineprotected java.lang.String currentSectionTypeAsString()
protected double calcSectionHeights(SectionArea area)
area - a section area
protected double calcDetailHeight()
protected double calcPageFooterHeight()
protected double calcReportFooterHeight()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||