tableConfig.setDisplayTableHeader(true);
tableConfig.setDisplayRowCount(true);
tableConfig.setPageingEnabled(true);
tableConfig.setDownloadOffered(true);
tableConfig.setSortingEnabled(true);
TableController tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), this);
// tableCtr.addColumnDescriptor(statisticManager.createColumnDescriptor(ureq, 0, null));
IndentedStatisticNodeRenderer indentedNodeRenderer = new IndentedStatisticNodeRenderer(Util.createPackageTranslator(statisticManager.getClass(), ureq.getLocale()));
indentedNodeRenderer.setSimpleRenderingOnExport(true);
CustomRenderColumnDescriptor nodeCD = new CustomRenderColumnDescriptor("stat.table.header.node", 0,
CLICK_NODE_ACTION, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, indentedNodeRenderer) {
@Override
public int compareTo(int rowa, int rowb) {
// order by original row order
return new Integer(rowa).compareTo(rowb);
}
};
tableController.addColumnDescriptor(nodeCD);
int column = 1;
List<String> headers = result.getHeaders();
for (Iterator<String> it = headers.iterator(); it.hasNext();) {
final String aHeader = it.next();
final int aColumnId = column++;
tableController.addColumnDescriptor(statisticManager.createColumnDescriptor(ureq, aColumnId, aHeader));
}
tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("stat.table.header.total", column,
StatisticDisplayController.CLICK_TOTAL_ACTION+column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT, new TotalColumnRenderer()) {
@Override
public String getAction(int row) {
if (row==table.getTableDataModel().getRowCount()-1) {
return super.getAction(row);
} else {
return null;
}
}
});
tableController.setTableDataModel(result);
return tableController;
}