* @throws LayoutException
*/
protected void layoutGroups() {
log.debug("Starting groups layout...");
for (Iterator iter = getReport().getColumnsGroups().iterator(); iter.hasNext();) {
DJGroup columnsGroup = (DJGroup) iter.next();
JRDesignGroup jgroup = getJRGroupFromDJGroup(columnsGroup);
jgroup.setStartNewPage(columnsGroup.getStartInNewPage().booleanValue());
jgroup.setStartNewColumn(columnsGroup.getStartInNewColumn().booleanValue());
jgroup.setReprintHeaderOnEachPage(columnsGroup.getReprintHeaderOnEachPage().booleanValue());
JRDesignBand header = (JRDesignBand) jgroup.getGroupHeader();
JRDesignBand footer = (JRDesignBand) jgroup.getGroupFooter();
//double check to prevent NPE
if (header == null){
header = new JRDesignBand();
jgroup.setGroupHeader(header);
}
if (footer == null){
footer = new JRDesignBand();
jgroup.setGroupFooter(footer);
}
header.setHeight(columnsGroup.getHeaderHeight().intValue());
// footer.setHeight( getFooterVariableHeight(columnsGroup));
footer.setHeight( columnsGroup.getFooterHeight().intValue());
header.setSplitAllowed(columnsGroup.isAllowHeaderSplit());
footer.setSplitAllowed(columnsGroup.isAllowFooterSplit());
if (columnsGroup.getLayout().isPrintHeaders()) {
boolean found = false;
boolean skipPreviousGroupHeaders = false;
int groupIdx = getReport().getColumnsGroups().indexOf(columnsGroup);
if (groupIdx>0){
DJGroup prevG = (DJGroup) getReport().getColumnsGroups().get(groupIdx-1);
if(!(prevG.getColumnToGroupBy() instanceof GlobalGroupColumn))
skipPreviousGroupHeaders = !prevG.getLayout().isShowValueForEachRow();
}
for (Iterator iterator = getVisibleColumns().iterator(); iterator.hasNext();) {
AbstractColumn col = (AbstractColumn) iterator.next();
//If in a nested group, header for column prior to this groups column