eclipse/nebula.widgets.nattable — pull request #2 by apauzies (2013-08-28 21:04:58+00:00)
Title: Summary (aggregation) of the tree children on the group row when using the groupByColumn

The goal of this change is to provide a summary (aggregation) of the tree children on the group row when using the groupByColumn feature. (https://bugs.eclipse.org/bugs/show_bug.cgi?id=416095)

I had to change the GroupByObject to carry additional information required for aggregation (better description of the grouping when multiple grouping)

I created a new Aggregator class to keep tracks of elements in each groups and update them on list changes (using FilterList and a matcher based on GroupByObject).

Its AggregatorColumnAccessor retrieve this list of elements, find the proper aggregator function for the given column, and call the functions.

The class BasicAggregators contains some simple aggregation functions (sum) that could be improved with more (avg...) and for better performance (using list change event getOldValue/getNewValue to avoid iterating over all the group elements).
Something like https://code.google.com/p/generic-java-math/ would probably be better but I didn't want to add an extra dependency.

I also changed the GroupByComparator to enable sorting of the group based on the summary values (need to pass a ISortModel to it)

I tested it will real time data update and grouping / sorting works ok.

I changed the GroupBy example to show how to use this feature (the group summary will contain a sum on the column 8)

There should be no API change if you don't activate this feature.

I'm new to nattable to let me know if you see a better way to integrate this feature!

Alex