Search in sources :

Example 1 with DataProviderFixture

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

the class SelectionUtilsTest method testGetBottomRightSelectDifferentColumns.

@Test
public void testGetBottomRightSelectDifferentColumns() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    // select cells for same columns in non consecutive rows
    selectionLayer.selectRegion(2, 2, 1, 3);
    selectionLayer.selectRegion(4, 4, 1, 3);
    assertEquals(6, selectionLayer.getSelectedCells().size());
    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 2 with DataProviderFixture

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

the class SelectionUtilsTest method testGetBottomRightSelectRegion.

@Test
public void testGetBottomRightSelectRegion() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    // select region
    selectionLayer.selectRegion(2, 2, 3, 3);
    ILayerCell bottomRight = SelectionUtils.getBottomRightCellInSelection(selectionLayer);
    assertEquals(4, bottomRight.getColumnPosition());
    assertEquals(4, 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 3 with DataProviderFixture

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

the class SelectionUtilsTest method testGetBottomRightSelectRegionDeselectMiddle.

@Test
public void testGetBottomRightSelectRegionDeselectMiddle() {
    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(3, 3);
    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 4 with DataProviderFixture

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

the class SelectionUtilsTest method testGetBottomRightSelectRegionDeselectMiddleBottomEdge.

@Test
public void testGetBottomRightSelectRegionDeselectMiddleBottomEdge() {
    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(4, 4);
    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 5 with DataProviderFixture

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

the class SelectionUtilsTest method testGetBottomRightSelectDifferentRows.

@Test
public void testGetBottomRightSelectDifferentRows() {
    DataLayer dataLayer = new DataLayer(new DataProviderFixture(10, 10));
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    // select cells for same columns in non consecutive rows
    selectionLayer.selectRegion(2, 2, 3, 1);
    selectionLayer.selectRegion(4, 4, 3, 1);
    assertEquals(6, selectionLayer.getSelectedCells().size());
    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)

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