ObservableElementList<Tuple> observableTupleList = new ObservableElementList<Tuple>(
baseTupleList, GlazedLists.beanConnector(Tuple.class));
TupleColumnPropertyAccessor columnPropertyAccessor = new TupleColumnPropertyAccessor();
ListDataProvider<Tuple> bodyDataProvider = new ListDataProvider<Tuple>(
observableTupleList, columnPropertyAccessor);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
// Enable capturing glazed list update events
GlazedListsEventLayer<Tuple> glazedListEventsLayer = new GlazedListsEventLayer<Tuple>(
bodyDataLayer, baseTupleList);
// Enable blinking
final BlinkLayer<Tuple> blinkingLayer = new BlinkLayer<Tuple>(
glazedListEventsLayer, bodyDataProvider, getRowIdAccessor(),
columnPropertyAccessor, configRegistry);
registerBlinkingConfigCells(configRegistry);
// Add Listener to existing elements
try {
baseTupleList.getReadWriteLock().readLock().lock();
for (Tuple tuple : baseTupleList) {
tuple.addPropertyChangeListener(glazedListEventsLayer);
}
} finally {
baseTupleList.getReadWriteLock().readLock().unlock();
}
// Setup row/column and corner layers
ColumnHeaderDataProvider defaultColumnHeaderDataProvider = new ColumnHeaderDataProvider();
DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
bodyDataProvider);
DefaultCornerDataProvider defaultCornerDataProvider = new DefaultCornerDataProvider(
defaultColumnHeaderDataProvider, rowHeaderDataProvider);
// Build composite for all regions
DefaultGridLayer gridLayer = new DefaultGridLayer(blinkingLayer,
new DefaultColumnHeaderDataLayer(
defaultColumnHeaderDataProvider),
new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
new DataLayer(defaultCornerDataProvider));
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());