use of org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer in project nebula.widgets.nattable by eclipse.
the class _5014_SpanningDataLayerExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// To make the default edit and selection configurations work correctly,
// the region label
// GridRegion.BODY is necessary, which is directly set to the
// ViewportLayer instance here.
ViewportLayer layer = new ViewportLayer(new SelectionLayer(new SpanningDataLayer(new DummySpanningBodyDataProvider(100, 100))));
layer.setRegionName(GridRegion.BODY);
NatTable natTable = new NatTable(parent, layer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add configurations to enable editing
// this is to verify that spanned cells are also editable and update the
// data model correctly
// @see Bug 414754
layer.addConfiguration(new DefaultEditBindings());
layer.addConfiguration(new DefaultEditConfiguration());
layer.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
}
});
natTable.configure();
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer in project nebula.widgets.nattable by eclipse.
the class _5015_AutomaticDataSpanningExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// property names of the NumberValues class
String[] propertyNames = { "columnOneNumber", "columnTwoNumber", "columnThreeNumber", "columnFourNumber", "columnFiveNumber" };
IColumnPropertyAccessor<NumberValues> cpa = new ReflectiveColumnPropertyAccessor<>(propertyNames);
IDataProvider dataProvider = new ListDataProvider<>(createNumberValueList(), cpa);
AutomaticSpanningDataProvider spanningDataProvider = new AutomaticSpanningDataProvider(dataProvider, true, false);
// spanningDataProvider.addAutoSpanningColumnPositions(0, 1, 2);
// spanningDataProvider.addAutoSpanningColumnPositions(2, 3, 4);
// spanningDataProvider.addAutoSpanningColumnPositions(0, 1, 3, 4);
// spanningDataProvider.addAutoSpanningRowPositions(0, 1, 2);
// spanningDataProvider.addAutoSpanningRowPositions(2, 3, 4);
// spanningDataProvider.addAutoSpanningRowPositions(0, 1, 3, 4);
NatTable natTable = new NatTable(parent, new ViewportLayer(new SelectionLayer(new SpanningDataLayer(spanningDataProvider))), false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new BodyMenuConfiguration(natTable, spanningDataProvider));
natTable.configure();
natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler());
return natTable;
}
Aggregations