|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.report.JFreeReport
This class co-ordinates the process of generating a report from a TableModel
.
The report is made up of 'bands', which are used repeatedly as necessary to generate small
sections of the report.
Accessing the bands and the elements:
The different bands can be accessed using the main report definition (this class):
getReportHeader()
and getReportFooter()
getPageHeader()
and getPageFooter()
getItemBand()
getGroup(int groupLevel)
. The group header and
footer are accessible through the group object, so use
getGroup(int groupLevel).getGroupHeader() and
getGroup(int groupLevel).getGroupFooter().
Elements on a band can be reached by using Band.getElement (String elementName)
or by retrieving all elements using Band.getElements()
and performing a search on
the returned list.
- Author:
- David Gilbert, Thomas Morgner
- See Also:
- Serialized Form
Field Summary
Fields inherited from interface com.jrefinery.report.JFreeReportConstants
NAME_PROPERTY, REPORT_DATE_PROPERTY, REPORT_DEFINITION_CONTENTBASE, REPORT_DEFINITION_SOURCE, REPORT_PAGECOUNT_PROPERTY, REPORT_PAGEFORMAT_PROPERTY, REPORT_PREPARERUN_PROPERTY
Constructor Summary
JFreeReport()
The default constructor.
JFreeReport(java.lang.String name,
ReportHeader reportHeader,
ReportFooter reportFooter,
PageHeader pageHeader,
PageFooter pageFooter,
ItemBand itemBand,
GroupList groups,
java.util.Collection functions,
javax.swing.table.TableModel data,
java.awt.print.PageFormat defaultPageFormat)
Constructs a report with the specified attributes.
JFreeReport(java.lang.String name,
ReportHeader reportHeader,
ReportFooter reportFooter,
PageHeader pageHeader,
PageFooter pageFooter,
ItemBand itemBand,
GroupList groups,
java.util.Collection functions,
javax.swing.table.TableModel data,
java.awt.print.PageFormat defaultPageFormat,
java.util.Collection expressions)
Constructs a report with the specified attributes.
Method Summary
void
addExpression(Expression function)
Adds a function to the report's collection of functions.
void
addFunction(Function function)
Adds a function to the report's collection of functions.
void
addGroup(Group group)
Adds a group to the report.
protected void
checkGroups()
java.lang.Object
clone()
Clones the report.
javax.swing.table.TableModel
getData()
Returns the current data for this report.
java.awt.print.PageFormat
getDefaultPageFormat()
Returns the default page format.
ExpressionCollection
getExpressions()
Returns the expressions for the report.
ExpressionCollection
getFunctions()
Returns the report's collection of functions.
Group
getGroup(int count)
Returns the group at the specified index or null, if there is no such group.
int
getGroupCount()
Returns the number of groups in this report.
GroupList
getGroups()
Returns a clone of the list of groups for the report.
static JFreeReportInfo
getInfo()
Returns information about the JFreeReport class library.
ItemBand
getItemBand()
Returns the report's item band.
java.lang.String
getName()
Returns the name of the report.
PageFooter
getPageFooter()
Returns the page footer.
PageHeader
getPageHeader()
Returns the page header.
ReportProperties
getProperties()
Returns the report properties collection for this report.
java.lang.Object
getProperty(java.lang.String key)
Returns the value of the property with the specified key.
ReportConfiguration
getReportConfiguration()
Returns the report configuration.
ReportFooter
getReportFooter()
Returns the page footer.
ReportHeader
getReportHeader()
Returns the report header.
StyleSheetCollection
getStyleSheetCollection()
boolean
isPropertyMarked(java.lang.String key)
Returns the value of the property with the specified key.
void
setData(javax.swing.table.TableModel data)
Sets the data for the report.
void
setDefaultPageFormat(java.awt.print.PageFormat format)
Defines the default page format for this report.
void
setExpressions(ExpressionCollection expressions)
Sets the expressions for the report.
void
setFunctions(ExpressionCollection functions)
Sets the function collection.
void
setGroups(GroupList groupList)
Sets the groups for this report.
void
setItemBand(ItemBand band)
Sets the item band for the report.
void
setName(java.lang.String name)
Sets the name of the report.
void
setPageFooter(PageFooter footer)
Sets the page footer.
void
setPageHeader(PageHeader header)
Sets the page header.
void
setProperty(java.lang.String key,
java.lang.Object value)
Adds a property to the report.
void
setPropertyMarked(java.lang.String key,
boolean mark)
Returns the value of the property with the specified key.
void
setReportFooter(ReportFooter footer)
Sets the report footer.
void
setReportHeader(ReportHeader header)
Sets the report header.
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
JFreeReport
public JFreeReport()
- The default constructor. Creates an empty but fully initialized report.
JFreeReport
public JFreeReport(java.lang.String name,
ReportHeader reportHeader,
ReportFooter reportFooter,
PageHeader pageHeader,
PageFooter pageFooter,
ItemBand itemBand,
GroupList groups,
java.util.Collection functions,
javax.swing.table.TableModel data,
java.awt.print.PageFormat defaultPageFormat)
throws FunctionInitializeException
- Constructs a report with the specified attributes.
- Parameters:
name
- the name of the report.reportHeader
- the report header not null.reportFooter
- the report footer not null.pageHeader
- the page header not null.pageFooter
- the page footer not null.itemBand
- the item band not null.groups
- the report groups not null.functions
- the report functions.data
- the data for the report not null.defaultPageFormat
- the default page format.
- Throws:
java.lang.NullPointerException
- if one of the not null-parameters is null.
FunctionInitializeException
- if any of the functions cannot be initialized.
JFreeReport
public JFreeReport(java.lang.String name,
ReportHeader reportHeader,
ReportFooter reportFooter,
PageHeader pageHeader,
PageFooter pageFooter,
ItemBand itemBand,
GroupList groups,
java.util.Collection functions,
javax.swing.table.TableModel data,
java.awt.print.PageFormat defaultPageFormat,
java.util.Collection expressions)
throws FunctionInitializeException
- Constructs a report with the specified attributes.
- Parameters:
name
- the name of the report.reportHeader
- the report header not null.reportFooter
- the report footer not null.pageHeader
- the page header not null.pageFooter
- the page footer not null.itemBand
- the item band not null.groups
- the report groups not null.functions
- the report functions.expressions
- the report expressions.data
- the data for the report not null.defaultPageFormat
- the default page format.
- Throws:
java.lang.NullPointerException
- if one of the not null-parameters is null.
FunctionInitializeException
- if any of the functions cannot be initialized.
Method Detail
getName
public java.lang.String getName()
- Returns the name of the report.
You can reference the report name in your XML report template file using the key
'report.name
'.
- Returns:
- the name.
setName
public void setName(java.lang.String name)
- Sets the name of the report.
The report name is stored as a property (key: NAME_PROPERTY = "report.name"
) of
the report. If you supply null
as the name, the property is removed.
- Parameters:
name
- the name of the report.
setProperty
public void setProperty(java.lang.String key,
java.lang.Object value)
- Adds a property to the report. If a property with the given name
already exists, the property will be updated with the new value. If the
supplied value is
null
, the property will be removed.
Developers are free to add any properties they want to a report, and then display those
properties in the report. For example, you might add a 'user.name' property, so that you
can display the username in the header of a report.
- Parameters:
key
- the key.value
- the value.
getProperties
public ReportProperties getProperties()
- Returns the report properties collection for this report.
These properties are inherited to all ReportStates generated for this report.
- Returns:
- the report properties.
getProperty
public java.lang.Object getProperty(java.lang.String key)
- Returns the value of the property with the specified key.
- Parameters:
key
- the key.
- Returns:
- the property value.
isPropertyMarked
public boolean isPropertyMarked(java.lang.String key)
- Returns the value of the property with the specified key.
- Parameters:
key
- the key.
- Returns:
- the property value.
setPropertyMarked
public void setPropertyMarked(java.lang.String key,
boolean mark)
- Returns the value of the property with the specified key.
- Parameters:
key
- the key.mark
- the new marking flag
setReportHeader
public void setReportHeader(ReportHeader header)
- Sets the report header.
- Parameters:
header
- the report header (null
not permitted).
getReportHeader
public ReportHeader getReportHeader()
- Returns the report header.
- Returns:
- the report header (never
null
).
setReportFooter
public void setReportFooter(ReportFooter footer)
- Sets the report footer.
- Parameters:
footer
- the report footer (null
not permitted).
getReportFooter
public ReportFooter getReportFooter()
- Returns the page footer.
- Returns:
- the report footer (never
null
).
setPageHeader
public void setPageHeader(PageHeader header)
- Sets the page header.
- Parameters:
header
- the page header (null
not permitted).
getPageHeader
public PageHeader getPageHeader()
- Returns the page header.
- Returns:
- the page header (never
null
).
setPageFooter
public void setPageFooter(PageFooter footer)
- Sets the page footer.
- Parameters:
footer
- the page footer (null
not permitted).
getPageFooter
public PageFooter getPageFooter()
- Returns the page footer.
- Returns:
- the page footer (never
null
).
setItemBand
public void setItemBand(ItemBand band)
- Sets the item band for the report.
- Parameters:
band
- the new item band (null
not permitted).
getItemBand
public ItemBand getItemBand()
- Returns the report's item band.
- Returns:
- the item band (never
null
).
addGroup
public void addGroup(Group group)
- Adds a group to the report.
- Parameters:
group
- the group.
setGroups
public void setGroups(GroupList groupList)
- Sets the groups for this report. If no list (null) or an
empty list is given, an default group is created. This default
group contains no elements and starts at the first record of the
data and ends on the last record.
- Parameters:
groupList
- the list of groups.
checkGroups
protected void checkGroups()
getGroups
public GroupList getGroups()
- Returns a clone of the list of groups for the report.
- Returns:
- the group list.
getGroupCount
public int getGroupCount()
- Returns the number of groups in this report.
Every report has at least one group defined.
- Returns:
- the group count.
getGroup
public Group getGroup(int count)
- Returns the group at the specified index or null, if there is no such group.
- Parameters:
count
- the group index.
- Returns:
- the requested group.
- Throws:
java.lang.IllegalArgumentException
- if the count is negative.
java.lang.IndexOutOfBoundsException
- if the count is greater than the number of defined groups.
addExpression
public void addExpression(Expression function)
throws FunctionInitializeException
- Adds a function to the report's collection of functions.
- Parameters:
function
- the function.
- Throws:
FunctionInitializeException
- if any of the functions cannot be initialized.
addFunction
public void addFunction(Function function)
throws FunctionInitializeException
- Adds a function to the report's collection of functions.
- Parameters:
function
- the function.
- Throws:
FunctionInitializeException
- if any of the functions cannot be initialized.
getFunctions
public ExpressionCollection getFunctions()
- Returns the report's collection of functions.
- Returns:
- the function collection.
setFunctions
public void setFunctions(ExpressionCollection functions)
- Sets the function collection.
- Parameters:
functions
- the collection of functions.
getDefaultPageFormat
public java.awt.print.PageFormat getDefaultPageFormat()
- Returns the default page format.
- Returns:
- the page format.
setDefaultPageFormat
public void setDefaultPageFormat(java.awt.print.PageFormat format)
- Defines the default page format for this report. The default is a hint
to define at least one suitable format. If no format is defined the system's default
page format is used.
- Parameters:
format
- the default format (null
permitted).
setData
public void setData(javax.swing.table.TableModel data)
- Sets the data for the report.
Reports are generated from a TableModel
(as used by Swing's
JTable
). If you don't want to give data to the report, use an empty
TableModel
instead of null
.
- Parameters:
data
- the data for the report (null
not permitted).
getData
public javax.swing.table.TableModel getData()
- Returns the current data for this report.
- Returns:
- the data in form of a table model.
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Clones the report.
- Overrides:
clone
in class java.lang.Object
- Returns:
- the clone.
- Throws:
java.lang.CloneNotSupportedException
- this should never happen.
getInfo
public static final JFreeReportInfo getInfo()
- Returns information about the JFreeReport class library.
- Returns:
- the information.
getExpressions
public ExpressionCollection getExpressions()
- Returns the expressions for the report.
- Returns:
- the expressions.
setExpressions
public void setExpressions(ExpressionCollection expressions)
- Sets the expressions for the report.
- Parameters:
expressions
- the expressions (null
not permitted).
getReportConfiguration
public ReportConfiguration getReportConfiguration()
- Returns the report configuration.
The report configuration is automatically set up when the report is first created, and uses
the global JFreeReport configuration as its parent.
- Returns:
- the report configuration.
getStyleSheetCollection
public StyleSheetCollection getStyleSheetCollection()
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD