tr.rowHeader.add(new HeaderRenderCell(rowFields.get(j)));
}
}
// rendering column keys
Node columnsRoot = pivotModel.getColumnsHeaderTree().getRoot();
List<List<Object>> pathRenderedCache = new ArrayList<List<Object>>();
for (List<Object> columnKey : columnKeys) {
if (i < columnFieldsSize) {
PivotField columnField = columnFields.get(i);
List<Object> path = new ArrayList<Object>(columnKey.subList(0, i + 1));
int colspan = getSpan(columnsRoot, path);
colspan = colspan * dataFieldsSize;
HeaderValueRenderCell valueRenderCell = new HeaderValueRenderCell(columnKey.get(i), columnField);
valueRenderCell.colspan = colspan;
if (pathRenderedCache.contains(path)) {
/*
* Was: setVisible(false). We just dont add the field
* here.
*/
} else {
tr.value.add(valueRenderCell);
pathRenderedCache.add(path);
}
} else {
for (PivotField dataField : dataFields) {
tr.value.add(new HeaderRenderCell(dataField));
}
}
}
if (!columnFields.isEmpty() && pivotModel.isShowGrandTotalForRow()) {
// rendering grand total column
if (i == 0) {
GrandTotalHeaderRenderCell cell = new GrandTotalHeaderRenderCell("Grand Total");
cell.colspan = dataFieldsSize;
tr.grandTotalColumn.add(cell);
} else if (i < columnFieldsSize) {
GrandTotalHeaderRenderCell cell = new GrandTotalHeaderRenderCell(null);
cell.colspan = dataFieldsSize;
tr.grandTotalColumn.add(cell);
} else {
for (PivotField dataField : dataFields) {
HeaderRenderCell cell = new HeaderRenderCell(dataField);
tr.grandTotalColumn.add(cell);
}
}
}
}
// rendering rows
Node rowsRoot = pivotModel.getRowsHeaderTree().getRoot();
List<List<Object>> pathRenderedCache = new ArrayList<List<Object>>();
for (List<Object> rowKey : rowKeys) {
DataRenderRow tr = new DataRenderRow();
row.add(tr);