// unaffected by column order.
final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
bodyDataLayer);
bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.addConfiguration(editableGridConfiguration(
columnLabelAccumulator, dataProvider));
final ColumnHeaderCheckBoxPainter columnHeaderCheckBoxPainter = new ColumnHeaderCheckBoxPainter(
bodyDataLayer);
final ICellPainter column9HeaderPainter = new BeveledBorderDecorator(
new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT,
columnHeaderCheckBoxPainter));
natTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
column9HeaderPainter, DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 9);
}
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
uiBindingRegistry.registerFirstSingleClickBinding(
new CellPainterMouseEventMatcher(
GridRegion.COLUMN_HEADER,
MouseEventMatcher.LEFT_BUTTON,
columnHeaderCheckBoxPainter),
new ToggleCheckBoxColumnAction(
columnHeaderCheckBoxPainter, bodyDataLayer));
}
});
natTable.configure();
return natTable;
}