|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.report.states.ReportState
Captures state information for a report while it is in the process of being displayed or printed. JFreeReport uses a state transition diagram to track progress through the report generation.
The report processing will usually pass through many states for each page generated. We record the report state at the end of each page, so that we can jump directly to the start of any page without having to regenerate all the preceding pages.
Field Summary | |
static int |
BEFORE_FIRST_GROUP
A group number that is 'before' the first group. |
static int |
BEFORE_FIRST_PAGE
The first page. |
static int |
BEFORE_FIRST_ROW
A row number that is 'before' the first row. |
Constructor Summary | |
protected |
ReportState(JFreeReport reportPar)
Constructs a new state for the specified report. |
protected |
ReportState(ReportState clone)
Constructs a ReportState from an existing ReportState. |
protected |
ReportState(ReportState clone,
boolean reset)
Constructs a ReportState from an existing ReportState and optionally resets the state. |
Method Summary | |
abstract ReportState |
advance()
The advance method performs a transition from the current report state to the next report state. |
void |
advanceItem()
Advances the active data row to the next line. |
java.lang.Object |
clone()
Clones the report state. |
ReportStateProgress |
createStateProgress(ReportStateProgress progress)
Creates a shallow clone. |
void |
enterGroup()
Activates the next group by incrementing the current group index. |
void |
fireGroupFinishedEvent()
Fires a 'group-finished' event. |
void |
fireGroupStartedEvent()
Fires a ' group-started ' event. |
void |
fireItemsAdvancedEvent()
Fires an 'items-advanced' event. |
void |
fireItemsFinishedEvent()
Fires an 'items-finished' event. |
void |
fireItemsStartedEvent()
Fires an 'items-started' event. |
void |
fireLayoutCompleteEvent(Band band,
int type)
Fires an 'layout-complete' event. |
void |
firePageCanceledEvent()
Fires a ' page-canceled ' event. |
void |
firePageFinishedEvent()
Fires a ' page-finished ' event. |
void |
firePageStartedEvent(int baseEvent)
Fires a 'page-started' event. |
void |
firePrepareEvent(int type)
Fires a 'prepare' event. |
void |
fireReportDoneEvent()
Fires a 'report-finished' event. |
void |
fireReportFinishedEvent()
Fires a 'report-finished' event. |
void |
fireReportInitializedEvent()
Fires a 'report-started' event. |
void |
fireReportStartedEvent()
Fires a 'report-started' event. |
int |
getAncestorHashcode()
Returns the ancestor hash code. |
int |
getCurrentDataItem()
Returns the current item (that is, the current row of the data in the TableModel). |
int |
getCurrentDisplayItem()
Returns the current item that should be displayed for this state. |
int |
getCurrentGroupIndex()
Returns the current group index. |
int |
getCurrentPage()
Returns the page number. |
DataRow |
getDataRow()
Returns the current data row. |
protected DataRowBackend |
getDataRowBackend()
Returns the data row backend. |
protected DataRowPreview |
getDataRowPreview()
Implements a singleton datarow preview. |
java.util.List |
getErrors()
Returns the errors that occured during the last event dispatching. |
protected LevelledExpressionList |
getFunctions()
Returns the function collection. |
int |
getLevel()
Returns the current function level. |
java.util.Iterator |
getLevels()
Returns an iterator over the function levels. |
int |
getNumberOfRows()
Returns the number of rows. |
ReportProperties |
getProperties()
Returns the report properties. |
java.lang.Object |
getProperty(java.lang.String key)
Returns the value of a property with the specified name. |
java.lang.Object |
getProperty(java.lang.String key,
java.lang.Object def)
Returns a property with the specified name. |
ReportDefinition |
getReport()
Returns the report this state is assigned to. |
protected ReportDefinitionImpl |
getReportDefinition()
Returns the report definition implementation used as backend when generating the report. |
boolean |
isAncestor(ReportState state)
Returns true if a state is an ancestor of this state, and false
otherwise. |
boolean |
isErrorOccured()
Checks, whether the last report event caused errors. |
boolean |
isFinish()
Tests whether this state is a defined ending point for report generation. |
static boolean |
isLastItemInGroup(Group g,
DataRowBackend currentDataRow,
DataRowBackend nextDataRow)
Returns true if this is the last item in the group, and false otherwise. |
boolean |
isPrefetchState()
Returns the 'prefetch' state for this report state (defaults to false). |
boolean |
isPrepareRun()
Returns a flag indicating whether this is the 'prepare' run. |
boolean |
isProceeding(ReportStateProgress oldstate)
This is a helper function used to detect infinite loops on report processing. |
boolean |
isStart()
Tests whether this state is a defined starting point for report generation. |
void |
leaveGroup()
Deactivates the current group by decrementing the current group index. |
void |
nextPage()
Advances the current page by one. |
protected void |
resetState()
Resets the state, so that the datarow points to the first row. |
protected void |
setAncestorHashcode(int ancestorHashcode)
Sets the ancestor hash code. |
void |
setCurrentGroupIndex(int index)
Sets the current group index (zero is the item group). |
void |
setCurrentItem(int itemIndex)
Sets the current item index (corresponds to a row in the TableModel). |
void |
setCurrentPage(int page)
Sets the current page number. |
void |
setProperty(java.lang.String key,
java.lang.Object o)
Sets a property. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BEFORE_FIRST_ROW
public static final int BEFORE_FIRST_GROUP
public static final int BEFORE_FIRST_PAGE
Constructor Detail |
protected ReportState(JFreeReport reportPar) throws java.lang.CloneNotSupportedException
This constructor is protected, it is intended to be used by subclasses only.
reportPar
- the report.
java.lang.CloneNotSupportedException
- if the initial cloning of the report definition fails.protected ReportState(ReportState clone, boolean reset)
clone
- the base report state from which to initialize.reset
- true, if the state should be reseted, false otherwise.protected ReportState(ReportState clone)
clone
- the existing state.Method Detail |
protected void resetState()
protected DataRowPreview getDataRowPreview()
public int getNumberOfRows()
public DataRow getDataRow()
protected DataRowBackend getDataRowBackend()
public ReportDefinition getReport()
public abstract ReportState advance() throws ReportProcessingException
ReportProcessingException
- if there is a problem processing the report.protected ReportDefinitionImpl getReportDefinition()
public int getCurrentDataItem()
public final int getCurrentDisplayItem()
public boolean isPrefetchState()
Some states will override this method and return true...in this case, any access to the report's TableModel will look to the current row + 1.
public void setCurrentItem(int itemIndex)
itemIndex
- The new item index.public int getCurrentPage()
public void setCurrentPage(int page)
page
- The new page number.public int getCurrentGroupIndex()
This starts at zero for the item group, and increases for each higher level group.
public void setCurrentGroupIndex(int index)
index
- The new group index.protected final LevelledExpressionList getFunctions()
public java.lang.Object getProperty(java.lang.String key)
key
- the property name.
public java.lang.Object getProperty(java.lang.String key, java.lang.Object def)
key
- the property name.def
- the default value.
public void setProperty(java.lang.String key, java.lang.Object o)
key
- the property name.o
- the property value.public ReportProperties getProperties()
public boolean isPrepareRun()
This run is used to do repagination, and is only done when the pageformat changes.
public ReportStateProgress createStateProgress(ReportStateProgress progress)
Don't use that function to store/copy a report state for a longer storage time. The next few advances may render the reportstate copy invalid.
progress
- a carrier for the result.
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if there is a cloning problem.public boolean isProceeding(ReportStateProgress oldstate)
If this method returns false, we need to bail out of processing the report because there is some problem.
oldstate
- the previous state.
public void nextPage()
public boolean isStart()
public boolean isFinish()
public void enterGroup()
public void leaveGroup()
public void advanceItem()
public void fireReportInitializedEvent()
public void fireReportStartedEvent()
public void firePrepareEvent(int type)
type
- the event type of the event that should be prepared.public void fireReportFinishedEvent()
public void fireReportDoneEvent()
public void firePageStartedEvent(int baseEvent)
baseEvent
- the type of the base event which caused the page start to be
triggered.public void firePageFinishedEvent()
page-finished
' event. The pageFinished(...)
method is
called for every report function.
public void firePageCanceledEvent()
page-canceled
' event. The pageCanceled(...)
method is
called for every report function that implements the PageListener interface.
public void fireGroupStartedEvent()
group-started
' event. The groupStarted(...)
method is
called for every report function.
public void fireGroupFinishedEvent()
public void fireItemsStartedEvent()
public void fireItemsFinishedEvent()
public void fireItemsAdvancedEvent()
public void fireLayoutCompleteEvent(Band band, int type)
band
- the band, that completed layouting.type
- the type of the base event fireing the laout complete event.public int getLevel()
public java.util.Iterator getLevels()
public int getAncestorHashcode()
protected void setAncestorHashcode(int ancestorHashcode)
ancestorHashcode
- the ancestor hash code.public boolean isAncestor(ReportState state)
true
if a state is an ancestor of this state, and false
otherwise.
state
- the state.
true
or false
.public java.util.List getErrors()
public boolean isErrorOccured()
public static boolean isLastItemInGroup(Group g, DataRowBackend currentDataRow, DataRowBackend nextDataRow)
g
- the group that should be checked.currentDataRow
- the current data row.nextDataRow
- the next data row, or null, if this is the last datarow.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |