new CheckBoxPainter(), DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new DefaultDoubleDisplayConverter(),
DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3);
}
});
// add sorting configuration
natTable.addConfiguration(new SingleClickSortConfiguration());
sumMoneySummaryProvider = new SummationGroupBySummaryProvider<ExtendedPersonWithAddress>(
columnPropertyAccessor);
avgMoneySummaryProvider = new AverageMoneyGroupBySummaryProvider();
// add group by summary configuration
natTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER,
sumMoneySummaryProvider, DisplayMode.NORMAL,
GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + 3);
configRegistry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER,
new AverageAgeGroupBySummaryProvider(),
DisplayMode.NORMAL,
GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + 2);
configRegistry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_CHILD_COUNT_PATTERN,
"[{0}] - ({1})");
configRegistry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_HINT,
"Drag columns here");
Style hintStyle = new Style();
hintStyle.setAttributeValue(CellStyleAttributes.FONT, GUIHelper
.getFont(new FontData("Arial", 10, SWT.ITALIC)));
configRegistry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_HINT_STYLE, hintStyle);
// register a groupBy double display converter to avoid
// rendering rounding issues
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new SummaryDisplayConverter(
new DefaultDoubleDisplayConverter()),
DisplayMode.NORMAL,
GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + 3);
configRegistry
.registerConfigAttribute(
SummaryRowConfigAttributes.SUMMARY_PROVIDER,
new SummationSummaryProvider(
bodyLayerStack.bodyDataProvider, false),
DisplayMode.NORMAL,
SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + 3);
configRegistry
.registerConfigAttribute(
SummaryRowConfigAttributes.SUMMARY_PROVIDER,
new AverageAgeSummaryProvider(
bodyLayerStack.bodyDataProvider),
DisplayMode.NORMAL,
SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + 2);
configRegistry
.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new SummaryDisplayConverter(
new DefaultDoubleDisplayConverter()),
DisplayMode.NORMAL,
SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + 3);
// the main styling of the summary row cell in the row header is
// done via