Search in sources :

Example 11 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class ColumnHeaderLayerSelectionTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.gridLayer.doCommand(new InitializeClientAreaCommandFixture());
}
Also used : InitializeClientAreaCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Example 12 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class GridLayerTest method initCorner.

@Test
public void initCorner() throws Exception {
    GridLayer gridLayer = new GridLayerFixture();
    ILayer colHeader = gridLayer.getCornerLayer();
    Assert.assertEquals(20, colHeader.getHeight());
    Assert.assertEquals(40, colHeader.getWidth());
}
Also used : ILayer(org.eclipse.nebula.widgets.nattable.layer.ILayer) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Test(org.junit.Test)

Example 13 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class GridLayerTest method initRowHeaderHeight.

@Test
public void initRowHeaderHeight() throws Exception {
    GridLayer gridLayer = new GridLayerFixture();
    gridLayer.doCommand(new InitializeClientAreaCommandFixture());
    ILayer rowHeader = gridLayer.getRowHeaderLayer();
    // Only visible rows are counted
    Assert.assertEquals(100, rowHeader.getHeight());
    Assert.assertEquals(40, rowHeader.getWidth());
}
Also used : InitializeClientAreaCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture) ILayer(org.eclipse.nebula.widgets.nattable.layer.ILayer) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Test(org.junit.Test)

Example 14 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture 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 15 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class ColumnGroupsCommandHandlerTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.selectionLayer = (SelectionLayer) this.gridLayer.getBodyLayer().getViewportLayer().getScrollableLayer();
    this.model = new ColumnGroupModel();
    this.handler = new ColumnGroupsCommandHandler(this.model, this.selectionLayer, new ColumnGroupHeaderLayer(this.gridLayer.getColumnHeaderLayer(), this.gridLayer.getBodyLayer().getSelectionLayer(), new ColumnGroupModel()));
    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)));
}
Also used : ColumnGroupHeaderLayer(org.eclipse.nebula.widgets.nattable.group.ColumnGroupHeaderLayer) 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) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) ColumnGroupModel(org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel) Before(org.junit.Before)

Aggregations

GridLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture)18 Before (org.junit.Before)12 RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)6 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)6 Test (org.junit.Test)6 InitializeClientAreaCommandFixture (org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture)5 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)5 Rectangle (org.eclipse.swt.graphics.Rectangle)5 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)4 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)4 Shell (org.eclipse.swt.widgets.Shell)4 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)3 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)3 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)3 IRowIdAccessor (org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor)3 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)3 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)3 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)3 RowStructuralRefreshEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)3 SelectRowsCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand)3