public void generateDesign(SpreadSheetFieldArray fieldArray) throws JRException {
hasAggregableField = false;
generateBaseDesign();
ArrayList columnsList = (ArrayList) reportDefinition.getColumnsList();
ReportColumns columns;
if(columnsList.size() == 1) {
// simple flat report
SpreadSheetFieldArray fields;
if (fieldArray != null)
fields = fieldArray;
else {
columns = (ReportColumns)columnsList.get(0);
fields = columns.getFieldArray();
}
addFields(fields);
if(hasAggregableField) {
addAggregableFields(fields,null);
}
jasperDesign.setPageHeader(getFieldsHeader(fields, false));
jasperDesign.setDetail(getDetail(fields, null));
addPageFooter();
// last page footer (if any)
if(hasAggregableField) {
addLastPageFooter(fields);
}
// int neededW = neededWidth(fields);
// System.out.println("Needed width is " + neededW);
// System.out.println("columns number is " + fields.size());
} else if(columnsList.size() == 2) {
// reports & subreports
columns = (ReportColumns)columnsList.get(0);
String groupByField = columns.getGroupbyField();
SpreadSheetFieldArray mainFields = columns.getFieldArray();
columns = (ReportColumns)columnsList.get(1);
SpreadSheetFieldArray detailFields;
if (fieldArray != null)
detailFields = fieldArray;
else
detailFields = columns.getFieldArray();
addFields(mainFields);
addFields(detailFields);
JRDesignGroup group = new JRDesignGroup();