Search in sources :

Example 21 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class GridLayerTest method initBodyLayer.

// **** New tests using fixtures ****
/**
 * @see ViewportLayerFixture#DEFAULT_CLIENT_AREA
 */
@Test
public void initBodyLayer() throws Exception {
    DefaultGridLayer gridLayer = new GridLayerFixture();
    ViewportLayer viewport = gridLayer.getBodyLayer().getViewportLayer();
    viewport.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 160, 80);
        }
    });
    // Client area gets init when this command is fired
    gridLayer.doCommand(new InitializeClientAreaCommandFixture());
    Assert.assertEquals(160, viewport.getClientAreaWidth());
    Assert.assertEquals(80, viewport.getClientAreaHeight());
    Assert.assertEquals(160, viewport.getWidth());
    Assert.assertEquals(80, viewport.getHeight());
}
Also used : InitializeClientAreaCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Test(org.junit.Test)

Example 22 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class CopyDataCommandHandlerTest method setUp.

@Before
public void setUp() {
    final IDataProvider bodyDataProvider = new DataProviderFixture(10, 10);
    this.gridLayer = new DefaultGridLayer(bodyDataProvider, getColumnHeaderDataProvider(bodyDataProvider), getRowHeaderDataProvider(bodyDataProvider));
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 1050);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.rowHeaderLayer = this.gridLayer.getRowHeaderLayer();
    this.columnHeaderLayer = this.gridLayer.getColumnHeaderLayer();
    this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.commandHandler = new CopyDataCommandHandler(this.selectionLayer, this.columnHeaderLayer, this.rowHeaderLayer);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) DataProviderFixture(org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Example 23 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class MultiRowResizeCommandTest method setClientAreaProvider.

private void setClientAreaProvider(ILayer layer) {
    layer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 500);
        }
    });
    layer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 24 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class GridSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new DefaultGridLayer(getBodyDataProvider(), GridLayerFixture.colHeaderDataProvider);
    this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 250);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) Rectangle(org.eclipse.swt.graphics.Rectangle) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Example 25 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class CompositeLayerTest method setup.

@Before
public void setup() {
    this.layerFixture = new CompositeLayerFixture();
    this.layerFixture.bodyLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 160, 100);
        }
    });
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle) CompositeLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.CompositeLayerFixture) Before(org.junit.Before)

Aggregations

IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)31 Rectangle (org.eclipse.swt.graphics.Rectangle)30 Shell (org.eclipse.swt.widgets.Shell)18 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)17 Before (org.junit.Before)17 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)8 Test (org.junit.Test)7 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)5 GridLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture)5 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)4 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)3 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)3 ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)3 TestLayer (org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer)3 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)2 CompositeFreezeLayer (org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer)2 FreezeLayer (org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer)2 RowHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer)2 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)2 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)2