Search in sources :

Example 6 with DataProviderFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture in project nebula.widgets.nattable by eclipse.

the class SelectionUtilsTest method testGetBottomRightSelectRegionDeselectTopEdge.

@Test
public void testGetBottomRightSelectRegionDeselectTopEdge() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    // select region
    selectionLayer.selectRegion(2, 2, 3, 3);
    // deselect a cell
    selectionLayer.clearSelection(2, 2);
    ILayerCell bottomRight = SelectionUtils.getBottomRightCellInSelection(selectionLayer);
    assertNull(bottomRight);
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ILayerCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell) DataProviderFixture(org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture) Test(org.junit.Test)

Example 7 with DataProviderFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture 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 8 with DataProviderFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture in project nebula.widgets.nattable by eclipse.

the class SelectionUtilsTest method testGetBottomRightSelectNothing.

@Test
public void testGetBottomRightSelectNothing() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    ILayerCell bottomRight = SelectionUtils.getBottomRightCellInSelection(selectionLayer);
    assertNull(bottomRight);
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ILayerCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell) DataProviderFixture(org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture) Test(org.junit.Test)

Example 9 with DataProviderFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture in project nebula.widgets.nattable by eclipse.

the class SelectionUtilsTest method testGetBottomRightSelectOne.

@Test
public void testGetBottomRightSelectOne() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    // select one cell
    selectionLayer.selectCell(5, 5, false, false);
    ILayerCell bottomRight = SelectionUtils.getBottomRightCellInSelection(selectionLayer);
    assertEquals(5, bottomRight.getColumnPosition());
    assertEquals(5, bottomRight.getRowPosition());
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ILayerCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell) DataProviderFixture(org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture) Test(org.junit.Test)

Example 10 with DataProviderFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture in project nebula.widgets.nattable by eclipse.

the class SelectionUtilsTest method testGetBottomRightSelectAll.

@Test
public void testGetBottomRightSelectAll() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    // select all cells
    selectionLayer.selectAll();
    ILayerCell bottomRight = SelectionUtils.getBottomRightCellInSelection(selectionLayer);
    assertEquals(9, bottomRight.getColumnPosition());
    assertEquals(9, bottomRight.getRowPosition());
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ILayerCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell) DataProviderFixture(org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture) Test(org.junit.Test)

Aggregations

DataProviderFixture (org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture)10 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)9 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)9 Test (org.junit.Test)9 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)1 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)1 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)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