use of org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionLayerConfiguration 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;
}
use of org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionLayerConfiguration in project nebula.widgets.nattable by eclipse.
the class NatTableBuilder method configureSelectionStyle.
/**
* Set up selection behavior. Select cells vs select rows.
*/
protected void configureSelectionStyle() {
SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();
if (tableModel.enableFullRowSelection) {
selectionLayer.addConfiguration(new RowOnlySelectionConfiguration<T>());
natTable.addConfiguration(new RowSelectionUIBindings());
selectionLayer.setSelectionModel(new RowSelectionModel<T>(selectionLayer, bodyLayer.getDataProvider(), rowIdAccessor));
} else {
selectionLayer.addConfiguration(new DefaultSelectionLayerConfiguration());
}
natTable.addConfiguration(new SelectionStyleConfiguration(tableStyle));
}
Aggregations