}
});
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer firstCompositeLayer = new CompositeLayer(1, 2);
firstCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
firstColumnHeaderLayer, 0, 0);
firstCompositeLayer.setChildLayer(GridRegion.BODY, firstViewportLayer,
0, 1);
final NatTable firstNatTable = new NatTable(panel, firstCompositeLayer,
false);
firstNatTable.addConfiguration(new DefaultNatTableStyleConfiguration());
firstNatTable.addConfiguration(new ActiveTableStyleConfiguration());
firstNatTable.configure();
// set the modern theme
firstNatTable.setTheme(new ModernNatTableThemeConfiguration());
// add overlay painter for full borders
firstNatTable.addOverlayPainter(new NatTableBorderOverlayPainter());
// create the second table
// create the body layer stack
final IRowDataProvider<Person> secondBodyDataProvider = new ListDataProvider<Person>(
getFlandersList(), columnPropertyAccessor);
final DataLayer secondBodyDataLayer = new DataLayer(
secondBodyDataProvider);
final SelectionLayer secondSelectionLayer = new SelectionLayer(
secondBodyDataLayer);
ViewportLayer secondViewportLayer = new ViewportLayer(
secondSelectionLayer);
// use a RowSelectionModel that will perform row selections and is able
// to identify a row via unique ID
secondSelectionLayer.setSelectionModel(new RowSelectionModel<Person>(
secondSelectionLayer, secondBodyDataProvider, rowIdAccessor));
// create the column header layer stack
DataLayer secondColumnHeaderDataLayer = new DataLayer(
columnHeaderDataProvider);
ILayer secondColumnHeaderLayer = new ColumnHeaderLayer(
secondColumnHeaderDataLayer, secondViewportLayer,
secondSelectionLayer);
// register custom label styling to indicate if the table is active
secondColumnHeaderDataLayer
.setConfigLabelAccumulator(new IConfigLabelAccumulator() {
@Override
public void accumulateConfigLabels(LabelStack configLabels,
int columnPosition, int rowPosition) {
if (!isFirstSelectionProvider) {
configLabels.addLabelOnTop(ACTIVE_LABEL);
}
}
});
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer secondCompositeLayer = new CompositeLayer(1, 2);
secondCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
secondColumnHeaderLayer, 0, 0);
secondCompositeLayer.setChildLayer(GridRegion.BODY,
secondViewportLayer, 0, 1);
final NatTable secondNatTable = new NatTable(panel,
secondCompositeLayer, false);