Dj2JrCrosstabBuilder djcb = new Dj2JrCrosstabBuilder();
JRDesignCrosstab crosst = djcb.createCrosstab(djcross,this);
JRDesignBand band = (JRDesignBand) jgroup.getGroupHeader();
if (djcross.getBottomSpace() != 0){
JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), 0);
LayoutUtils.moveBandsElemnts(rect.getHeight(), band);
band.addElement(rect);
}
LayoutUtils.moveBandsElemnts(crosst.getHeight(), band);
band.addElement(crosst);
DJLabel caption = djcross.getCaption();
if (caption!=null){
JRDesignExpression captExp = null;
if (caption.isJasperExpression()) //a text with things like "$F{myField}"
captExp = ExpressionUtils.createStringExpression(caption.getText());
else if (caption.getLabelExpression() != null){
String name = "expression_for_label_at_header_of_group[" + getReport().getColumnsGroups().indexOf(columnsGroup)+"]_crosstab["+columnsGroup.getHeaderCrosstabs().indexOf(djcross)+"]";
LayoutUtils.registerCustomExpressionParameter((DynamicJasperDesign) getDesign(), name , caption.getLabelExpression());
captExp = ExpressionUtils.createExpression(ExpressionUtils.createCustomExpressionInvocationText(name), caption.getLabelExpression().getClassName()) ;
log.debug(ExpressionUtils.createCustomExpressionInvocationText(name));
} else //a simple text
captExp = ExpressionUtils.createStringExpression("\""+ Utils.escapeTextForExpression(caption.getText())+ "\"");
JRDesignTextField captTf = new JRDesignTextField();
captTf.setExpression(captExp );
captTf.setHeight(caption.getHeight());
captTf.setWidth(getReport().getOptions().getPrintableWidth());
LayoutUtils.moveBandsElemnts(caption.getHeight(), band);
band.addElement(captTf);
}
if (djcross.getTopSpace() != 0){
LayoutUtils.moveBandsElemnts(djcross.getTopSpace(), band);
JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), 0);
band.addElement(rect);
}
}
for (Iterator iterator = columnsGroup.getFooterCrosstabs().iterator(); iterator.hasNext();) {
DJCrosstab djcross = (DJCrosstab) iterator.next();
Dj2JrCrosstabBuilder djcb = new Dj2JrCrosstabBuilder();
JRDesignCrosstab crosst = djcb.createCrosstab(djcross,this);
JRDesignBand band = (JRDesignBand) jgroup.getGroupFooter();
int yOffset = LayoutUtils.findVerticalOffset(band);
if (djcross.getTopSpace() != 0){
// moveBandsElemnts(djcross.getTopSpace(), band);
JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), yOffset);
rect.setPositionType(JRDesignElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP);
band.addElement(rect);
crosst.setY(rect.getY() + rect.getHeight());
}
band.addElement(crosst);
if (djcross.getBottomSpace() != 0){
JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), crosst.getY() + crosst.getHeight());
band.addElement(rect);
}
}