Package org.jfree.report
Interface ReportData
-
- All Superinterfaces:
DataSet
- All Known Implementing Classes:
EmptyReportData,SQLReportData,TableReportData
public interface ReportData extends DataSet
A report data source is a ordered set of rows. For a report, we assume that the report dataset does not change while the report is processed. Concurrent updates will invalidate the whole precomputed layout. A report dataset will be accessed in a linear fashion. On certain points, the cursor will be reset to the a previously read position, and processing the data will restart from there. It is guaranteed, that the cursor will never be set to a row that is beyond the last row that has been read with 'next()'. If the cursor is out of range, any call to get must return 'null'.- Author:
- Thomas Morgner
-
-
Field Summary
Fields Modifier and Type Field Description static intBEFORE_FIRST_ROW
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the datasource.intgetCursorPosition()booleanisAdvanceable()This operation checks, whether a call to next will be likely to succeed.booleanisReadable()Checks, whether this report-data instance is currently readable.booleannext()This method produces the same result as 'setCursorPosition(getCursorPosition() + 1);'booleansetCursorPosition(int cursor)Moves the cursor back to an already visited position.-
Methods inherited from interface org.jfree.report.DataSet
get, getColumnCount, getColumnName
-
-
-
-
Field Detail
-
BEFORE_FIRST_ROW
static final int BEFORE_FIRST_ROW
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCursorPosition
int getCursorPosition() throws DataSourceException- Throws:
DataSourceException
-
setCursorPosition
boolean setCursorPosition(int cursor) throws DataSourceExceptionMoves the cursor back to an already visited position. Calling this method for an row number that has not yet been read using 'next' is undefined, whether that call succeeds is implementation dependent. Calls to position zero (aka BEFORE_FIRST_ROW) will always succeeed (unless there is a physical error, which invalidated the whole report-data object).- Parameters:
cursor-- Returns:
- true, if moving the cursor succeeded, false otherwise.
- Throws:
DataSourceException
-
isAdvanceable
boolean isAdvanceable() throws DataSourceExceptionThis operation checks, whether a call to next will be likely to succeed. If there is a next data row, this should return true.- Returns:
- Throws:
DataSourceException
-
next
boolean next() throws DataSourceExceptionThis method produces the same result as 'setCursorPosition(getCursorPosition() + 1);'- Returns:
- Throws:
DataSourceException
-
close
void close() throws DataSourceExceptionCloses the datasource. This should be called at the end of each report processing run. Whether this closes the underlying data-source backend depends on the ReportDataFactory. Calling 'close()' on the ReportDataFactory *must* close all report data objects.- Throws:
DataSourceException
-
isReadable
boolean isReadable() throws DataSourceExceptionChecks, whether this report-data instance is currently readable. A report-data instance cannot be readable if it is positioned before the first row. (The look-ahead system of 'isAdvanceable()' will prevent that the datasource is positioned behind the last row.)- Returns:
- true, if the datarow is valid, false otherwise.
- Throws:
DataSourceException
-
-