Search in sources :

Example 1 with AutomaticSpanningDataProvider

use of org.eclipse.nebula.widgets.nattable.data.AutomaticSpanningDataProvider 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;
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) AutomaticSpanningDataProvider(org.eclipse.nebula.widgets.nattable.data.AutomaticSpanningDataProvider) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) SpanningDataLayer(org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer) NumberValues(org.eclipse.nebula.widgets.nattable.dataset.NumberValues) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) DisplayPersistenceDialogCommandHandler(org.eclipse.nebula.widgets.nattable.persistence.command.DisplayPersistenceDialogCommandHandler) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable)

Aggregations

NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)1 AutomaticSpanningDataProvider (org.eclipse.nebula.widgets.nattable.data.AutomaticSpanningDataProvider)1 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)1 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)1 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)1 NumberValues (org.eclipse.nebula.widgets.nattable.dataset.NumberValues)1 SpanningDataLayer (org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer)1 DisplayPersistenceDialogCommandHandler (org.eclipse.nebula.widgets.nattable.persistence.command.DisplayPersistenceDialogCommandHandler)1 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)1 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)1