use of org.eclipse.nebula.widgets.nattable.layer.cell.CellOverrideLabelAccumulator in project nebula.widgets.nattable by eclipse.
the class Applying_style_to_a_cell method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
SelectionExampleGridLayer gridLayer = new SelectionExampleGridLayer();
NatTable natTable = new NatTable(parent, gridLayer, false);
DataLayer bodyDataLayer = gridLayer.getBodyDataLayer();
// Label accumulator - adds labels to all cells with the given data
// value
CellOverrideLabelAccumulator<RowDataFixture> cellLabelAccumulator = new CellOverrideLabelAccumulator<>(gridLayer.getBodyDataProvider());
cellLabelAccumulator.registerOverride("AAA", 2, CELL_LABEL);
// Register your cell style, against the label applied to the cell
// Other configuration which can be added (apart from style) include
// CellConfigAttributes, EditConfigAttributes, SortConfigAttributes etc.
IConfigRegistry configRegistry = new ConfigRegistry();
addColumnHighlight(configRegistry);
// Register label accumulator
bodyDataLayer.setConfigLabelAccumulator(cellLabelAccumulator);
gridLayer.getSelectionLayer().addConfiguration(new DefaultSelectionLayerConfiguration());
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.setConfigRegistry(configRegistry);
natTable.configure();
return natTable;
}
Aggregations