|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.report.function.AbstractFunction | +--com.jrefinery.report.targets.pageable.pagelayout.PageLayouter | +--com.jrefinery.report.targets.pageable.pagelayout.SimplePageLayouter
A simple page layouter. This class replicates the 'old' behaviour of JFreeReport, simple and straightforward.
Layout Constraints used:
Defines whether a PageHeader or ~footer should be printed on the first page.
Defines whether a PageHeader or ~footer should be printed on the last page. A warning: For the PageHeader this works only if the ReportFooter has a pagebreak before printing.
Defines whether this GroupHeader should be repeated on every page as long as this group is active
defines whether to start a new page before the band is printed or after the band is printed. This request is ignored, if the current page is empty (not counting the PageHeader and the repeating GroupHeader).
Nested Class Summary | |
protected static class |
SimplePageLayouter.SimpleLayoutManagerState
Represents the current state of the page layouter. |
Nested classes inherited from class com.jrefinery.report.targets.pageable.pagelayout.PageLayouter |
|
Field Summary |
Fields inherited from interface com.jrefinery.report.function.Expression |
AUTOACTIVATE_PROPERTY |
Constructor Summary | |
SimplePageLayouter()
Creates a new page layouter. |
Method Summary | |
protected void |
clearSaveState()
Clears the layout state. |
java.lang.Object |
clone()
Clones the layouter. |
protected void |
createSaveState(Band b)
Records state information. |
protected java.awt.geom.Rectangle2D |
doLayout(Band band,
boolean fireEvent)
Perform the layout of a band. |
protected boolean |
doPrint(java.awt.geom.Rectangle2D bounds,
Band band,
boolean spool)
Prints a band. |
protected boolean |
endPage(boolean force)
Ends the page. |
protected SimplePageLayoutCursor |
getCursor()
Returns the cursor. |
Expression |
getInstance()
Return a completly separated copy of this function. |
int |
getMaxPage()
Returns the highest pagenumber found during the repagination process. |
void |
groupFinished(ReportEvent event)
Receives notification that a group has finished. |
void |
groupStarted(ReportEvent event)
Receives notification that a group has started. |
boolean |
isNewPageStarted()
Returns true, if the PageLayouter has successfully started a new page. |
boolean |
isSpaceFor(float height)
Determines whether or not there is space remaining on the page for a band of the specified height. |
void |
itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed. |
void |
itemsFinished(ReportEvent event)
Receives notification that a group of item bands has been completed. |
void |
itemsStarted(ReportEvent event)
Receives notification that a group of item bands is about to be processed. |
void |
pageFinished(ReportEvent event)
Receives notification that a page has ended. |
void |
pageStarted(ReportEvent event)
Receives notification that a page has started. |
void |
prepareEvent(ReportEvent event)
Receives notification of a prepare event. |
void |
reportDone(ReportEvent event)
Receives notification that report generation has completed, the report footer was printed, no more output is done. |
void |
reportFinished(ReportEvent event)
Receives notification that the report has finished. |
void |
reportStarted(ReportEvent event)
Receives notification that the report has started. |
void |
restartPage()
Handles the restarting of the page. |
void |
restoreSaveState(ReportState anchestor)
Restores the state. |
protected PageLayouter.LayoutManagerState |
saveCurrentState()
Returns the current state. |
protected void |
setCursor(SimplePageLayoutCursor cursor)
Sets the cursor. |
void |
setLogicalPage(LogicalPage logicalPage)
Sets the logical page and adjust the cursor. |
protected void |
setMaxPage(int maxPage)
Defines the highest pagenumber found during the repagination process. |
void |
setStartNewPage(boolean startNewPage)
Defines whether the PageLayouter has successfully started a new page. |
Methods inherited from class com.jrefinery.report.targets.pageable.pagelayout.PageLayouter |
clearCurrentEvent, clearLogicalPage, endPage, getCurrentEvent, getDependencyLevel, getLayoutManagerState, getLogicalPage, getReport, getValue, isFinishingPage, isGeneratedPageEmpty, isPageEnded, isPageRestartDone, isRestartingPage, setCurrentEvent, setDependencyLevel, setFinishingPage, setGeneratedPageEmpty, setPageRestartDone, setRestartingPage, startPage |
Methods inherited from class com.jrefinery.report.function.AbstractFunction |
getDataRow, getName, getProperties, getProperty, getProperty, initialize, isActive, reportInitialized, setDataRow, setName, setProperties, setProperty |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimplePageLayouter()
Method Detail |
public Expression getInstance()
getInstance
in interface Expression
getInstance
in class AbstractFunction
public int getMaxPage()
protected void setMaxPage(int maxPage)
maxPage
- the highest page number.public void reportStarted(ReportEvent event)
Layout and draw the report header after the PageStartEvent was fired.
reportStarted
in interface ReportListener
reportStarted
in class AbstractFunction
event
- the event.public void itemsFinished(ReportEvent event)
The itemBand is finished, the report starts to close open groups.
itemsFinished
in interface ReportListener
itemsFinished
in class AbstractFunction
event
- The event.public void reportDone(ReportEvent event)
reportDone
in interface ReportListener
reportDone
in class AbstractFunction
event
- The event.public void itemsStarted(ReportEvent event)
The next events will be itemsAdvanced events until the itemsFinished event is raised.
itemsStarted
in interface ReportListener
itemsStarted
in class AbstractFunction
event
- The event.public void pageStarted(ReportEvent event)
This prints the PageHeader. If this is the first page, the header is not printed if the pageheader style-flag DISPLAY_ON_FIRSTPAGE is set to false. If this event is known to be the last pageStarted event, the DISPLAY_ON_LASTPAGE is evaluated and the header is printed only if this flag is set to TRUE.
If there is an active repeating GroupHeader, print the last one. The GroupHeader is searched for the current group and all parent groups, starting at the current group and ascending to the parents. The first goupheader that has the StyleFlag REPEAT_HEADER set to TRUE is printed.
The PageHeader and the repeating GroupHeader are spooled until the first real content is printed. This way, the LogicalPage remains empty until an other band is printed.
pageStarted
in interface ReportListener
pageStarted
in class AbstractFunction
event
- Information about the event.public void pageFinished(ReportEvent event)
This prints the PageFooter. If this is the first page, the footer is not printed if the pagefooter style-flag DISPLAY_ON_FIRSTPAGE is set to false. If this event is known to be the last pageFinished event, the DISPLAY_ON_LASTPAGE is evaluated and the footer is printed only if this flag is set to TRUE.
pageFinished
in interface ReportListener
pageFinished
in class AbstractFunction
event
- the report event.public void reportFinished(ReportEvent event)
Prints the ReportFooter and forces the last pagebreak.
reportFinished
in interface ReportListener
reportFinished
in class AbstractFunction
event
- Information about the event.public void groupStarted(ReportEvent event)
Prints the GroupHeader
groupStarted
in interface ReportListener
groupStarted
in class AbstractFunction
event
- Information about the event.public void groupFinished(ReportEvent event)
Prints the GroupFooter.
groupFinished
in interface ReportListener
groupFinished
in class AbstractFunction
event
- Information about the event.public void itemsAdvanced(ReportEvent event)
prints the ItemBand.
itemsAdvanced
in interface ReportListener
itemsAdvanced
in class AbstractFunction
event
- Information about the event.protected java.awt.geom.Rectangle2D doLayout(Band band, boolean fireEvent)
band
- the band.fireEvent
- a flag to control whether or not a report event is fired.
protected boolean doPrint(java.awt.geom.Rectangle2D bounds, Band band, boolean spool) throws ReportProcessingException
bounds
- the bounds of the band within the logical pageband
- the band that should be printed. The internal band layouting is
already done, all Elements contain a valid BOUNDS property.spool
- a flag that controls whether to print the contents directly
or to cache the printing operation for later usage.
ReportProcessingException
- if the printing caused an detectable error
while printing the bandLogicalPage.spoolBand(java.awt.geom.Rectangle2D, com.jrefinery.report.Band)
public boolean isSpaceFor(float height)
height
- the height (in Java2D user space units).
protected SimplePageLayoutCursor getCursor()
java.lang.IllegalStateException
- if a cursor is requested but no OutputTarget is set.protected void setCursor(SimplePageLayoutCursor cursor)
cursor
- the cursor (null not permitted).
java.lang.NullPointerException
- if the given cursor is nullprotected void createSaveState(Band b)
b
- the band.protected PageLayouter.LayoutManagerState saveCurrentState()
createSaveState(Band b)
method.
saveCurrentState
in class PageLayouter
public void restoreSaveState(ReportState anchestor) throws ReportProcessingException
restoreSaveState
in class PageLayouter
anchestor
- the ancestor state.
ReportProcessingException
- if the printing failed or a pagebreak is
requested while the page is restored.
java.lang.IllegalStateException
- if there is no SavedState but this is not the
first page.public void restartPage() throws ReportProcessingException
ReportProcessingException
- if restarting the page failed.protected void clearSaveState()
clearSaveState
in class PageLayouter
public void setLogicalPage(LogicalPage logicalPage)
setLogicalPage
in class PageLayouter
logicalPage
- the logical page.protected boolean endPage(boolean force) throws ReportProcessingException
force
- set to true, to skip the test whether the logical page is empty and
to enforce an pagebreak. This is a requirement when an completly empty report
(no bands or elements printed) should be finished.
ReportProcessingException
- if finishing the page failed.public boolean isNewPageStarted()
isNewPageStarted
in class PageLayouter
public void setStartNewPage(boolean startNewPage)
startNewPage
- true, if a new page has already been started, false otherwise.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface Function
clone
in class PageLayouter
java.lang.CloneNotSupportedException
- if there is a problem cloning.public void prepareEvent(ReportEvent event)
prepareEvent
in interface PrepareEventListener
event
- the event.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |