public interface JRGroup extends JRCloneable
<groupFooter>
and <groupHeader>
sections are inserted in the resulting document.
You can have as many groups as you want on a report. The order of groups declared in a
report template is important because groups contain each other. One group contains the
following group, and so on. When a larger group encounters a rupture, all subsequent
groups are reinitialized.
Note: Data grouping works as expected only when the records in the data source are already ordered
according to the group expressions used in the report. For example, if you want to group some products by
the country and city of the manufacturer, the engine expects to find the records in the data source already
ordered by country and city.
isStartNewPage
or isStartNewColumn
attribute to true.
These two attributes represent one of the most common ways to control page and column
breaks in a report. The other one is by using the special break element. In all other
situations, the reporting engine introduces page breaks automatically if content overflows
onto a new page or column during the report-filling process.
In some report templates, you may want to introduce page breaks on purpose when a
report section is larger than one page. Using the break element would not help, as the
report template, having a band larger than the page size, would not get past the report
validation process. To do this, you would need to introduce special dummy groups, as
explained in the FAQs section of the freely available documentation published on the
JasperReports web site (http://community.jaspersoft.com/wiki/jasperreports-library-faqs).
However, if you don't want to consistently introduce page or column breaks for a
particular group, but prefer to do that only if the remaining space at the bottom of the
page or column is too small, use the minHeightToStartNewPage
attribute. This
attribute specifies the minimum remaining vertical space that prevents the group from
starting a new page of its own. It is measured in pixels.
PAGE_NUMBER
).
To do this, set the isResetPageNumber
attribute to true.
footerPosition
attribute, as
follows:
Normal
- The group footer section is rendered immediately after the previous section.StackAtBottom
- The group footer section appears at the bottom of
the current page. Remaining space on the page appears above it. The group footer
section of the outer groups is pushed to the bottom of the current page, as well, in
case the current group is a nested inner group. So both the current group footer and
the outer group footers stack at the bottom of the current pageForceAtBottom
- The group footer section is forced to render at the
very bottom of the page and is followed only by the page footer section. All
sections following this type of group footer are forced to render on the next pageCollateAtBottom
- The collate setting is a weak setting. If all outer
group footers are configured to render at the bottom of the page, the group footer
section will also appear at the bottom and any remaining white space will appear
above it. However, if at least one outer group footer has normal rendering position
and its positioning is not overridden by another inner group, the current group
footer renders at the normal position.keepTogether
flag available at group level.
When this flag is turned on, we prevent the group from splitting on its first break
attempt. If a group is long, it will certainly need to break at some point. So, with a first
break only, we avoid a split only when the group attempts to split for the first time, while
subsequent breaks during the current group are allowed.
Note that this a purely visual feature of the engine, because it does not involve reverting
any of the calculations made during the current group iteration . It is only about moving
already-generated content to a new page, making it appear as if the group started there in
the first place. Be advised that in cases where group-, page- or column-related
information is displayed in the group, such as the current page number, their values
might be wrong after they are moved.Modifier and Type | Method and Description |
---|---|
JRVariable |
getCountVariable() |
JRExpression |
getExpression()
Gets the expression that defines what records in the group have in common.
|
FooterPositionEnum |
getFooterPositionValue()
Specifies how the group footer section behaves with regards to its position on the current page.
|
JRSection |
getGroupFooterSection()
Gets the footer section created for this group.
|
JRSection |
getGroupHeaderSection()
Gets the header section created for this group.
|
int |
getMinDetailsToStartFromTop()
Gets the minimum number of details to be rendered on the current column, to avoid starting the group on a new column.
|
int |
getMinHeightToStartNewPage()
Gets the minimum amount of vertical space needed at the bottom of the column in order to place the
group header on the current column.
|
String |
getName()
Gets the group name
|
boolean |
isKeepTogether()
Gets the flag that signals if the group should be prevented from splitting on first break attempt.
|
boolean |
isPreventOrphanFooter()
Gets the flag that signals if the group footer should be prevented from appearing without a detail at the top of a new page/column.
|
boolean |
isReprintHeaderOnEachColumn()
Gets the flag that signals if the group header should be reprinted at the beginning of each column, in vertically filled reports only.
|
boolean |
isReprintHeaderOnEachPage()
Gets the flag that signals if the group header should be reprinted at the beginning of each page.
|
boolean |
isResetPageNumber()
Gets the flag that signals if the group header should be printed always on a new page, along with the
re-initialization of the page number.
|
boolean |
isStartNewColumn()
Gets the flag that signals if the group header should be printed always on a new column.
|
boolean |
isStartNewPage()
Gets the flag that signals if the group header should be printed always on a new page.
|
void |
setFooterPosition(FooterPositionEnum footerPosition)
Specifies the group footer section behavior with regards to its position on the current page.
|
void |
setKeepTogether(boolean keepTogether)
Sets the flag that signals if the group should be prevented from splitting on first break attempt.
|
void |
setMinDetailsToStartFromTop(int minDetails)
Sets the minimum number of details to be rendered on the current column, to avoid starting the group on a new column.
|
void |
setMinHeightToStartNewPage(int minHeight)
Sets the minimum amount of vertical space needed at the bottom of the column in order to place the
group header on the current column.
|
void |
setPreventOrphanFooter(boolean preventOrphanFooter)
Sets the flag that signals if the group should be prevented from appearing without a detail at the top of a new page/column.
|
void |
setReprintHeaderOnEachColumn(boolean isReprint)
Sets the flag that signals if the group header should be reprinted at the beginning of each column, in vertically filled reports only.
|
void |
setReprintHeaderOnEachPage(boolean isReprint)
Sets the flag that signals if the group header should be reprinted at the beginning of each page.
|
void |
setResetPageNumber(boolean isReset)
Sets the flag that signals if the group header should be printed always on a new page, along with the
re-initialization of the page number.
|
void |
setStartNewColumn(boolean isStart)
Sets the flag that signals if the group header should be printed always on a new column.
|
void |
setStartNewPage(boolean isStart)
Sets the flag that signals if the group header should be printed always on a new page.
|
clone
String getName()
boolean isStartNewColumn()
void setStartNewColumn(boolean isStart)
boolean isStartNewPage()
void setStartNewPage(boolean isStart)
boolean isResetPageNumber()
void setResetPageNumber(boolean isReset)
boolean isReprintHeaderOnEachPage()
boolean isReprintHeaderOnEachColumn()
void setReprintHeaderOnEachPage(boolean isReprint)
void setReprintHeaderOnEachColumn(boolean isReprint)
int getMinHeightToStartNewPage()
void setMinHeightToStartNewPage(int minHeight)
int getMinDetailsToStartFromTop()
void setMinDetailsToStartFromTop(int minDetails)
FooterPositionEnum getFooterPositionValue()
void setFooterPosition(FooterPositionEnum footerPosition)
boolean isKeepTogether()
void setKeepTogether(boolean keepTogether)
boolean isPreventOrphanFooter()
void setPreventOrphanFooter(boolean preventOrphanFooter)
JRExpression getExpression()
JRSection getGroupHeaderSection()
JRSection getGroupFooterSection()
JRVariable getCountVariable()
Copyright © 2021 TIBCO Software Inc.. All rights reserved.