The AbstractReportDefinition serves as base-implementation for both the SubReport and the global JFreeReport
instance. There's no point to subclass this class any further.
ReportDefinitions define the query string to "default" by default, change this to reflect the accepted queries
in your data-source.
| Method from org.jfree.report.AbstractReportDefinition Detail: |
public void addExpression(Expression function) {
if (expressions == null)
{
throw new NullPointerException("AbstractReporDefinition.addExpression(..) : Null not permitted");
}
expressions.add(function);
}
Adds a function to the report's collection of expressions. |
public void addGroup(Group group) {
if (group == null)
{
throw new NullPointerException("AbstractReporDefinition.addGroup(..) : Null not permitted");
}
Group existingGroup = rootGroup;
GroupBody gb = existingGroup.getBody();
while (gb instanceof SubGroupBody)
{
final SubGroupBody sgb = (SubGroupBody) gb;
existingGroup = sgb.getGroup();
gb = existingGroup.getBody();
}
existingGroup.setBody(new SubGroupBody(group));
group.setBody(gb);
}
Adds a group to the report. This replaces the group body on the group with a new data-group-body composed
of the existing itemband and no-databand. |
public Object clone() throws CloneNotSupportedException {
final AbstractReportDefinition report = (AbstractReportDefinition) super.clone();
report.rootGroup = (Group) rootGroup.clone();
report.watermark = (Watermark) watermark.clone();
report.pageFooter = (PageFooter) pageFooter.clone();
report.pageHeader = (PageHeader) pageHeader.clone();
report.reportFooter = (ReportFooter) reportFooter.clone();
report.reportHeader = (ReportHeader) reportHeader.clone();
report.properties = (ReportProperties) properties.clone();
report.expressions = (ExpressionCollection) expressions.clone();
report.styleSheetCollection = (StyleSheetCollection) styleSheetCollection.clone();
report.rootGroup.setParent(report);
report.reportHeader.setParent(report);
report.reportFooter.setParent(report);
report.pageHeader.setParent(report);
report.pageFooter.setParent(report);
report.watermark.setParent(report);
report.preProcessor = (ReportPreProcessor) preProcessor.clone();
report.bundleMetaData = (DefaultBundleMetaData) bundleMetaData.clone();
return report;
}
|
public ResourceKey getContentBase() {
final Object attribute = getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.CONTENT_BASE);
if (attribute instanceof ResourceKey)
{
return (ResourceKey) attribute;
}
return null;
}
Returns the content base of this report. The content base is used to resolve relative URLs during the report
generation and resource loading. If there is no content base defined, it will be impossible to resolve relative
paths. |
public DataRow getDataRow() {
return new ParameterDataRow(properties);
}
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. |
public ResourceKey getDefinitionSource() {
final Object attribute = getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE);
if (attribute instanceof ResourceKey)
{
return (ResourceKey) attribute;
}
return null;
}
|
public DetailsFooter getDetailsFooter() {
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
return dataBody.getDetailsFooter();
}
Returns the details header band. |
public DetailsHeader getDetailsHeader() {
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
return dataBody.getDetailsHeader();
}
Returns the details header band. |
public DefaultBundleMetaData getDocumentMetaData() {
return bundleMetaData;
}
|
public ReportElement getElement(int index) {
switch (index)
{
case 0:
return pageHeader;
case 1:
return watermark;
case 2:
return reportHeader;
case 3:
return rootGroup;
case 4:
return reportFooter;
case 5:
return pageFooter;
default:
throw new IndexOutOfBoundsException();
}
}
|
public int getElementCount() {
return 6;
}
|
public ExpressionCollection getExpressions() {
return expressions;
}
Returns the expressions for the report. |
public Group getGroup(int groupIndex) {
if (groupIndex < 0)
{
throw new IllegalArgumentException("GroupCount must not be negative");
}
if (groupIndex == 0)
{
return rootGroup;
}
int count = 0; // we always have at least a default-group.
GroupBody gb = rootGroup.getBody();
while (gb instanceof SubGroupBody)
{
final SubGroupBody sgb = (SubGroupBody) gb;
final Group group = sgb.getGroup();
count += 1;
if (count == groupIndex)
{
return group;
}
gb = group.getBody();
}
throw new IndexOutOfBoundsException("No group defined at the given index. " + count);
}
Returns the group at the specified index or null, if there is no such group. |
public Group getGroupByName(String name) {
if (name == null)
{
throw new NullPointerException("AbstractReporDefinition.getGroupByName(..) : Null not permitted");
}
if (rootGroup.getName().equals(name))
{
return rootGroup;
}
GroupBody gb = rootGroup.getBody();
while (gb instanceof SubGroupBody)
{
final SubGroupBody sgb = (SubGroupBody) gb;
final Group group = sgb.getGroup();
if (name.equals(group.getName()))
{
return group;
}
gb = group.getBody();
}
return null;
}
Searches a group by its defined name. This method returns null, if the group was not found. |
public int getGroupCount() {
int count = 1; // we always have at least a default-group.
GroupBody gb = rootGroup.getBody();
while (gb instanceof SubGroupBody)
{
final SubGroupBody sgb = (SubGroupBody) gb;
gb = sgb.getGroup().getBody();
count += 1;
}
return count;
}
|
public ItemBand getItemBand() {
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
return dataBody.getItemBand();
}
Returns the report's item band. |
public NoDataBand getNoDataBand() {
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
return dataBody.getNoDataBand();
}
Returns the report's watermark band. |
public PageFooter getPageFooter() {
return pageFooter;
}
|
public PageHeader getPageHeader() {
return pageHeader;
}
|
public ReportPreProcessor getPreProcessor() {
return preProcessor;
}
|
public ReportProperties getProperties() {
return properties;
} Deprecated! Report-Properties - should not be used anymore.
Returns the report properties collection for this report.
These properties are inherited to all ReportStates generated for this report. |
public Object getProperty(String key) {
if (key == null)
{
throw new NullPointerException();
}
return this.properties.get(key);
} Deprecated! Do - not use this method anymore. Use the master report's parameters instead.
Returns the value of the property with the specified key. |
public String getQuery() {
return query;
}
Returns a new query or query-name that is used when retrieving the data from the data-factory. |
public int getQueryLimit() {
return queryLimit;
}
|
public int getQueryTimeout() {
return queryTimeout;
}
|
public ReportDefinition getReportDefinition() {
return this;
}
Returns the currently assigned report definition. |
public ReportFooter getReportFooter() {
return reportFooter;
}
|
public ReportHeader getReportHeader() {
return reportHeader;
}
Returns the report header. |
public Group getRootGroup() {
return rootGroup;
}
|
public StyleSheetCollection getStyleSheetCollection() {
return styleSheetCollection;
}
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. |
public Watermark getWatermark() {
return this.watermark;
}
Returns the report's watermark band. |
protected void removeElement(Element element) {
if (element == null)
{
throw new NullPointerException("AbstractReporDefinition.removeElement(..) : Null not permitted");
}
if (pageHeader == element)
{
this.pageHeader.setParent(null);
this.pageHeader = new PageHeader();
this.pageHeader.setParent(this);
}
else if (watermark == element)
{
this.watermark.setParent(null);
this.watermark = new Watermark();
this.watermark.setParent(this);
}
else if (reportHeader == element)
{
this.reportHeader.setParent(null);
this.reportHeader = new ReportHeader();
this.reportHeader.setParent(this);
}
else if (rootGroup == element)
{
removeGroup(rootGroup);
}
else if (reportFooter == element)
{
this.reportFooter.setParent(null);
this.reportFooter = new ReportFooter();
this.reportFooter.setParent(this);
}
else if (pageFooter == element)
{
this.pageFooter.setParent(null);
this.pageFooter = new PageFooter();
this.pageFooter.setParent(this);
}
}
|
public void removeGroup(Group group) {
if (group == null)
{
throw new NullPointerException("AbstractReporDefinition.addGroup(..) : Null not permitted");
}
if (rootGroup == group)
{
final GroupBody rootBody = rootGroup.getBody();
if (rootBody instanceof SubGroupBody)
{
final SubGroupBody newRootGroup = (SubGroupBody) rootBody;
rootGroup.removeElement(rootBody);
rootGroup = newRootGroup.getGroup();
registerAsChild(rootGroup);
}
else
{
rootGroup = new RelationalGroup();
rootGroup.setBody(rootBody);
}
unregisterAsChild(group);
return;
}
Group existingGroup = rootGroup;
GroupBody gb = existingGroup.getBody();
while (gb instanceof SubGroupBody && existingGroup != group)
{
final SubGroupBody sgb = (SubGroupBody) gb;
existingGroup = sgb.getGroup();
gb = existingGroup.getBody();
}
if (existingGroup == group)
{
group.setBody(gb);
final SubGroupBody subGroupBody = (SubGroupBody) existingGroup.getParentSection();
subGroupBody.setGroup(group);
}
}
|
public void setContentBase(ResourceKey key) {
setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.CONTENT_BASE, key);
}
Defines the content base for the report. The content base will be used to resolve relative URLs during the report
generation and resource loading. If there is no content base defined, it will be impossible to resolve relative
paths. |
public void setDefinitionSource(ResourceKey key) {
setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE, key);
}
|
public void setDetailsFooter(DetailsFooter band) {
if (band == null)
{
throw new NullPointerException("AbstractReportDefinition.setDetailsFooter(...) : null not permitted.");
}
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
dataBody.setDetailsFooter(band);
}
Sets the item band for the report. |
public void setDetailsHeader(DetailsHeader band) {
if (band == null)
{
throw new NullPointerException("AbstractReportDefinition.setDetailsHeader(...) : null not permitted.");
}
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
dataBody.setDetailsHeader(band);
}
Sets the item band for the report. |
public void setDocumentMetaData(DefaultBundleMetaData bundleMetaData) {
if (bundleMetaData == null)
{
throw new NullPointerException("Bundle meta-data must never be null.");
}
this.bundleMetaData = bundleMetaData;
}
|
public void setExpressions(ExpressionCollection expressions) {
if (expressions == null)
{
throw new NullPointerException("AbstractReportDefinition.setExpressions(...) : null not permitted.");
}
this.expressions = expressions;
}
Sets the expressions for the report. |
public void setGroups(GroupList groupList) {
if (groupList == null)
{
throw new NullPointerException("GroupList must not be null");
}
final ItemBand ib = getItemBand();
final NoDataBand nd = getNoDataBand();
final Group newRootGroup = groupList.constructRootGroup();
if (this.rootGroup == newRootGroup)
{
return;
}
validateLooping(newRootGroup);
if (unregisterParent(newRootGroup))
{
return;
}
this.rootGroup.setParent(null);
this.rootGroup = newRootGroup;
this.rootGroup.setParent(this);
setItemBand(ib);
setNoDataBand(nd);
}
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. |
public void setItemBand(ItemBand band) {
if (band == null)
{
throw new NullPointerException("AbstractReportDefinition.setItemBand(...) : null not permitted.");
}
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
dataBody.setItemBand(band);
}
Sets the item band for the report. |
public void setNoDataBand(NoDataBand band) {
if (band == null)
{
throw new NullPointerException("AbstractReportDefinition.setNoDataBand(...) : null not permitted.");
}
final Group group = getInnerMostGroup();
final GroupDataBody dataBody = (GroupDataBody) group.getBody();
dataBody.setNoDataBand(band);
}
Sets the watermark band for the report. |
public void setPageFooter(PageFooter footer) {
if (footer == null)
{
throw new NullPointerException("AbstractReportDefinition.setPageFooter(...) : null not permitted.");
}
validateLooping(footer);
if (unregisterParent(footer))
{
return;
}
this.pageFooter.setParent(null);
this.pageFooter = footer;
this.pageFooter.setParent(this);
}
|
public void setPageHeader(PageHeader header) {
if (header == null)
{
throw new NullPointerException("AbstractReportDefinition.setPageHeader(...) : null not permitted.");
}
validateLooping(header);
if (unregisterParent(header))
{
return;
}
this.pageHeader.setParent(null);
this.pageHeader = header;
this.pageHeader.setParent(this);
}
|
public void setPreProcessor(ReportPreProcessor preProcessor) {
if (preProcessor == null)
{
throw new NullPointerException();
}
this.preProcessor = preProcessor;
}
|
public void setProperty(String key,
Object value) {
if (key == null)
{
throw new NullPointerException();
}
if ("report.name".equals(key))
{
this.bundleMetaData.putBundleAttribute
(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE, value);
}
this.properties.put(key, value);
} Deprecated! Properties - should not be used. Use the master-report's parameters instead.
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. |
public void setQuery(String query) {
if (query == null)
{
throw new NullPointerException("Query cannot be null.");
}
this.query = query;
}
Defines a new query or query-name that is used when retrieving the data from the data-factory. |
public void setQueryLimit(int queryLimit) {
this.queryLimit = queryLimit;
}
|
public void setQueryTimeout(int queryTimeout) {
this.queryTimeout = queryTimeout;
}
|
public void setReportFooter(ReportFooter footer) {
if (footer == null)
{
throw new NullPointerException("AbstractReportDefinition.setReportFooter(...) : null not permitted.");
}
validateLooping(footer);
if (unregisterParent(footer))
{
return;
}
this.reportFooter.setParent(null);
this.reportFooter = footer;
this.reportFooter.setParent(this);
}
|
public void setReportHeader(ReportHeader header) {
if (header == null)
{
throw new NullPointerException("AbstractReportDefinition.setReportHeader(...) : null not permitted.");
}
validateLooping(header);
if (unregisterParent(header))
{
return;
}
this.reportHeader.setParent(null);
this.reportHeader = header;
this.reportHeader.setParent(this);
}
|
public void setRootGroup(Group rootGroup) {
if (rootGroup == null)
{
throw new NullPointerException();
}
this.rootGroup.setParent(null);
this.rootGroup = rootGroup;
this.rootGroup.setParent(this);
}
|
public void setWatermark(Watermark band) {
if (band == null)
{
throw new NullPointerException("AbstractReportDefinition.setWatermark(...) : null not permitted.");
}
validateLooping(band);
if (unregisterParent(band))
{
return;
}
this.watermark.setParent(null);
this.watermark = band;
this.watermark.setParent(this);
}
Sets the watermark band for the report. |