.
All report elements share the same stylesheet collection. Report elements
cannot be shared between two different report instances.
For dynamic computation of content you can add Expressions and Functions to the report.
Static content can also be added by using the ReportProperties.
Properties, which have been marked using setPropertyMarked(String,
boolean) can be accessed during the report processing as if they were static
columns from the tablemodel.
Creating a new instance of JFreeReport seems to lock down the JDK on some
Windows Systems, where no printer driver is installed. To prevent that
behaviour on these systems, you can set the ReportConfiguration key
"org.jfree.report.NoPrinterAvailable" to "false" and JFreeReport will use a
hardcoded default page format instead.
- Author:
- David Gilbert, Thomas Morgner
- See Also:
- Serialized Form
|
Constructor Summary |
JFreeReport()
The default constructor. |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
NAME_PROPERTY
public static final java.lang.String NAME_PROPERTY
- Key for the 'report name' property.
QUERY_PROPERTY
public static final java.lang.String QUERY_PROPERTY
- Key for the 'report name' property.
REPORT_DATE_PROPERTY
public static final java.lang.String REPORT_DATE_PROPERTY
- Key for the 'report date' property.
REPORT_PAGEFORMAT_PROPERTY
public static final java.lang.String REPORT_PAGEFORMAT_PROPERTY
- Key for the 'report page format' property.
REPORT_PREPARERUN_PROPERTY
public static final java.lang.String REPORT_PREPARERUN_PROPERTY
- Key for the 'report prepare run' property.
REPORT_DEFINITION_SOURCE
public static final java.lang.String REPORT_DEFINITION_SOURCE
- Key for the 'report definition source' property.
REPORT_DEFINITION_CONTENTBASE
public static final java.lang.String REPORT_DEFINITION_CONTENTBASE
- Key for the 'report definition content base' property.
REPORT_LAYOUT_SUPPORT
public static final java.lang.String REPORT_LAYOUT_SUPPORT
- A reference to the currently used layout support implementation. This can
be used to compute text sizes from within functions.
REPORT_DATASOURCE_PROPERTY
public static final java.lang.String REPORT_DATASOURCE_PROPERTY
- This report property holds a reference to the raw datasource. Right now,
this contains the TableModel used in the report object.
REPORT_LOCALIZATION_PROPERTY
public static final java.lang.String REPORT_LOCALIZATION_PROPERTY
- Deprecated. Since JFreeReport 0.8.7 Expressions have full access to report
locales
- This report property contains the ResourceBundleFactory, allowing
expressions to use the available localization information.
JFreeReport
public JFreeReport()
- The default constructor. Creates an empty but fully initialized report.
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) inside the report properties. 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.
- Specified by:
- getProperties in interface ReportDefinition
- 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.
- Specified by:
- getReportHeader in interface ReportDefinition
- 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.
- Specified by:
- getReportFooter in interface ReportDefinition
- 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.
- Specified by:
- getPageHeader in interface ReportDefinition
- 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.
- Specified by:
- getPageFooter in interface ReportDefinition
- Returns:
- the page footer (never
null).
setWatermark
public void setWatermark(Watermark band)
- Sets the watermark band for the report.
- Parameters:
band - the new watermark band (null not permitted).
getNoDataBand
public NoDataBand getNoDataBand()
- Returns the report's watermark band.
- Specified by:
- getNoDataBand in interface ReportDefinition
- Returns:
- the watermark band (never
null).
setNoDataBand
public void setNoDataBand(NoDataBand band)
- Sets the watermark band for the report.
- Parameters:
band - the new watermark band (null not permitted).
getWatermark
public Watermark getWatermark()
- Returns the report's watermark band.
- Specified by:
- getWatermark in interface ReportDefinition
- Returns:
- the watermark band (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.
- Specified by:
- getItemBand in interface ReportDefinition
- 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.
getGroups
public GroupList getGroups()
- Returns a clone of the list of groups for the report.
- Specified by:
- getGroups in interface ReportDefinition
- Returns:
- the group list.
getGroupCount
public int getGroupCount()
- Returns the number of groups in this report.
Every report has at least
one group defined.
- Specified by:
- getGroupCount in interface ReportDefinition
- 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.
- Specified by:
- getGroup in interface ReportDefinition
- 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.
getGroupByName
public Group getGroupByName(java.lang.String name)
- Searches a group by its defined name. This method returns null, if the
group was not found.
- Parameters:
name - the name of the group.- Returns:
- the group or null if not found.
- See Also:
GroupList.getGroupByName(java.lang.String)
addExpression
public void addExpression(Expression function)
- Adds a function to the report's collection of expressions.
- Parameters:
function - the function.
getPageDefinition
public PageDefinition getPageDefinition()
- Returns the logical page definition for this report.
- Specified by:
- getPageDefinition in interface ReportDefinition
- Returns:
- the page definition.
setPageDefinition
public void setPageDefinition(PageDefinition format)
- Defines the logical page definition for this report. If no format is
defined the system's default page format is used.
If there is no printer available and the JDK blocks during the printer
discovery, you can set the
ReportConfiguration key
"org.jfree.report.NoPrinterAvailable" to "false" and JFreeReport will use a
hardcoded default page format instead.
- 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 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 org.jfree.base.config.ModifiableConfiguration 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.
- Specified by:
- getReportConfiguration in interface ReportDefinition
- Returns:
- the report configuration.
getStyleSheetCollection
public StyleSheetCollection getStyleSheetCollection()
- Returns the stylesheet collection of this report. The stylesheet collection
is fixed for the report and all elements of the report. When a band or
group is added to the report it will get registered with this stylesheet
collection and cannot be used in an different report.
- Specified by:
- getStyleSheetCollection in interface ReportDefinition
- Returns:
- the stylesheet collection of the report, never null.
getReportBuilderHints
public ReportBuilderHints getReportBuilderHints()
- Returns the report builder hint collection, that is assigned with this
report. Be aware that these hints are not cloned and that during the
cloning all references to this ReportBuilderHints instance get replaced by
an newly created instance.
The report builder hints are used by the report writer to preserve the
original layout of the XML files.
- Returns:
- the report builder hints.
setReportBuilderHints
public void setReportBuilderHints(ReportBuilderHints reportBuilderHints)
- Redefines the report builder hints. If null is given, the old hints get
removed without a replacement.
- Parameters:
reportBuilderHints - the new report builder hints.
getResourceBundleFactory
public ResourceBundleFactory getResourceBundleFactory()
- Returns the resource bundle factory for this report definition. The
ResourceBundleFactory is used in internationalized reports to create the
resourcebundles holding the localized resources.
- Specified by:
- getResourceBundleFactory in interface ReportDefinition
- Returns:
- the assigned resource bundle factory.
setResourceBundleFactory
public void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
- Redefines the resource bundle factory for the report.
- Parameters:
resourceBundleFactory - the new resource bundle factory, never null.- Throws:
- java.lang.NullPointerException - if the given ResourceBundleFactory is null.
getResourceBundle
public java.util.ResourceBundle getResourceBundle(java.lang.String key)
- Queries the current resource bundle factory for the resource bundle
specified by the given key.
- Specified by:
- getResourceBundle in interface ReportDefinition
- Parameters:
key - the base name of the resource bundle.- Returns:
- the resource bundle
- Throws:
- java.util.MissingResourceException - if no resource bundle for the specified base name can be found
getDataRow
public DataRow getDataRow()
- Returns the current datarow assigned to this report definition. JFreeReport
objects do not hold a working DataRow, as the final contents of the data
cannot be known, until the reporting has started.
- Specified by:
- getDataRow in interface ReportDefinition
- Returns:
- the default implementation for non-processed reports.
getDataFactory
public DataFactory getDataFactory()
setDataFactory
public void setDataFactory(DataFactory dataFactory)
getQuery
public java.lang.String getQuery()
setQuery
public void setQuery(java.lang.String query)