Search in sources :

Example 21 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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 22 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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 23 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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)

Example 24 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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 25 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.

the class RowSelectionTraversalTest method setUp.

@Before
public void setUp() {
    // only use 10 columns to make the test cases easier
    String[] propertyNames = Arrays.copyOfRange(RowDataListFixture.getPropertyNames(), 0, 10);
    IRowDataProvider<RowDataFixture> bodyDataProvider = new ListDataProvider<RowDataFixture>(RowDataListFixture.getList(10), new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames));
    this.selectionLayer = new SelectionLayer(new DataLayer(bodyDataProvider));
    this.selectionLayer.setSelectionModel(new RowSelectionModel<RowDataFixture>(this.selectionLayer, bodyDataProvider, new IRowIdAccessor<RowDataFixture>() {

        @Override
        public Serializable getRowId(RowDataFixture rowObject) {
            return rowObject.getSecurity_id();
        }
    }));
    this.viewportLayer = new ViewportLayer(this.selectionLayer);
}
Also used : IRowIdAccessor(org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor) ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) Before(org.junit.Before)

Aggregations

DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)227 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)150 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)99 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)96 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)93 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)91 HashMap (java.util.HashMap)83 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)82 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)78 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)77 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)77 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)76 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)75 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)75 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)74 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)74 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)70 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)64 Test (org.junit.Test)62 GridLayout (org.eclipse.swt.layout.GridLayout)56