Search in sources :

Example 1 with ViewportSelectColumnGroupCommandHandler

use of org.eclipse.nebula.widgets.nattable.group.command.ViewportSelectColumnGroupCommandHandler in project nebula.widgets.nattable by eclipse.

the class ColumnGroupHeaderLayerSelectionTest method setup.

@Before
public void setup() {
    this.dataProvider = new ListDataProvider<>(getNumberValues(), new ReflectiveColumnPropertyAccessor<>("columnOneNumber", "columnTwoNumber", "columnThreeNumber", "columnFourNumber", "columnFiveNumber", "columnSixNumber", "columnSevenNumber", "columnEightNumber", "columnNineNumber", "columnTenNumber"));
    this.gridLayer = new GridLayerFixture(this.dataProvider);
    this.model = new ColumnGroupModel();
    // 10 columns in header
    this.columnGroupLayer = new ColumnGroupHeaderLayer(this.gridLayer.getColumnHeaderLayer(), this.gridLayer.getBodyLayer().getSelectionLayer(), this.model, false);
    this.columnGroupLayer.addConfiguration(new DefaultColumnGroupHeaderLayerConfiguration(this.model, true));
    this.gridLayer.getBodyLayer().getViewportLayer().registerCommandHandler(new ViewportSelectColumnGroupCommandHandler(this.gridLayer.getBodyLayer().getViewportLayer(), this.columnGroupLayer));
    this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_1, 0, 1, 2);
    this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_2, 5, 6);
    this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_3, 8, 9);
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 200);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.layerListener = new LayerListenerFixture();
    this.gridLayer.getBodyLayer().addLayerListener(this.layerListener);
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) DefaultColumnGroupHeaderLayerConfiguration(org.eclipse.nebula.widgets.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Shell(org.eclipse.swt.widgets.Shell) ViewportSelectColumnGroupCommandHandler(org.eclipse.nebula.widgets.nattable.group.command.ViewportSelectColumnGroupCommandHandler) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Aggregations

ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)1 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)1 ViewportSelectColumnGroupCommandHandler (org.eclipse.nebula.widgets.nattable.group.command.ViewportSelectColumnGroupCommandHandler)1 DefaultColumnGroupHeaderLayerConfiguration (org.eclipse.nebula.widgets.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration)1 GridLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture)1 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)1 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 Shell (org.eclipse.swt.widgets.Shell)1 Before (org.junit.Before)1