* The cell with null/null is the inner most cell in the crosstab<br>
*
* @param djcross
*/
protected void createCells() {
DJCrosstabColumn auxCol = new DJCrosstabColumn();
DJCrosstabRow auxRow = new DJCrosstabRow();
try {
BeanUtils.copyProperties(auxCol, djcross.getColumns().get(djcross.getColumns().size()-1));
BeanUtils.copyProperties(auxRow, djcross.getRows().get(djcross.getRows().size()-1));
} catch (Exception e) {
log.error(e.getMessage(),e); //must not happend
}
auxCol.setProperty(null);
auxRow.setProperty(null);
List auxColsList = new ArrayList(djcross.getColumns());
auxColsList.add(auxCol);
List auxRowsList = new ArrayList(djcross.getRows());
auxRowsList.add(auxRow);
DJCrosstabColumn[] auxCols = (DJCrosstabColumn[]) auxColsList.toArray(new DJCrosstabColumn[]{});
DJCrosstabRow[] auxRows = (DJCrosstabRow[]) auxRowsList.toArray(new DJCrosstabRow[]{});
for (int i = auxCols.length-1; i >= 0; i--) {
for (int j = auxRows.length-1; j >= 0; j--) {
DJCrosstabColumn crosstabColumn = auxCols[i];
DJCrosstabRow crosstabRow = auxRows[j];
JRDesignCrosstabCell cell = new JRDesignCrosstabCell();
cell.setWidth(new Integer(crosstabColumn.getWidth()));
cell.setHeight(new Integer(crosstabRow.getHeight()));
if (crosstabColumn.getProperty() != null)
cell.setColumnTotalGroup(crosstabColumn.getProperty().getProperty());
if (crosstabRow.getProperty() != null)
cell.setRowTotalGroup(crosstabRow.getProperty().getProperty());
JRDesignCellContents contents = new JRDesignCellContents();
int counter = 0;
int measureHeight = crosstabRow.getHeight() / djcross.getMeasures().size();
for (Iterator iterator = djcross.getMeasures().iterator(); iterator.hasNext(); counter++) {
DJCrosstabMeasure djmeasure = (DJCrosstabMeasure) iterator.next();
JRDesignTextField element = new JRDesignTextField();
element.setWidth(crosstabColumn.getWidth());
element.setHeight(measureHeight);
element.setY(counter*measureHeight);
JRDesignExpression measureExp = new JRDesignExpression();
// DJCrosstabMeasure measure = djcross.getMeasure(0);
measureExp.setValueClassName(djmeasure.getProperty().getValueClassName());
measureExp.setText("$V{"+djmeasure.getProperty().getProperty()+"}");
element.setExpression(measureExp);
/**
* Is there any style for this object?
*/
if (crosstabRow.getProperty() == null && crosstabColumn.getProperty() == null && djmeasure.getStyle() != null ){
//this is the inner most cell
layoutManager.applyStyleToElement(djmeasure.getStyle() , element);
} else if (crosstabRow.getTotalStyle() != null) {
layoutManager.applyStyleToElement(crosstabRow.getTotalStyle(), element);
}
else if (crosstabColumn.getTotalStyle() != null) {
layoutManager.applyStyleToElement(crosstabColumn.getTotalStyle(), element);
}
if (djmeasure.getLink() != null){
String name = "cell_" + i + "_" + j + "_ope" + djmeasure.getOperation().getValue();
HyperLinkUtil.applyHyperLinkToElement((DynamicJasperDesign)this.design, djmeasure.getLink(), element, name);