Search in sources :

Example 1 with ColumnHideShowLayerFixture

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

the class ChooseColumnsFromCategoriesCommandHandlerTest method setup.

@Before
public void setup() {
    this.hideShowLayerFixture = new ColumnHideShowLayerFixture();
    this.commandHandler = new ChooseColumnsFromCategoriesCommandHandler(this.hideShowLayerFixture, new ColumnHeaderLayerFixture(), new DataLayerFixture(), new ColumnCategoriesModelFixture());
}
Also used : ColumnHeaderLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture) ColumnHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) ColumnCategoriesModelFixture(org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFixture) Before(org.junit.Before)

Example 2 with ColumnHideShowLayerFixture

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

the class ColumnGroupExpandCollapseLayerTest method setup.

@Before
public void setup() {
    this.model = new ColumnGroupModel();
    // 10 Columns in total - column 10 hidden
    this.underlyingLayer = new ColumnHideShowLayerFixture(9);
    this.expandCollapseLayer = new ColumnGroupExpandCollapseLayer(this.underlyingLayer, this.model);
    this.model.addColumnsIndexesToGroup(TEST_GROUP_NAME, 2, 3, 4, 5);
}
Also used : ColumnHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture) ColumnGroupExpandCollapseLayer(org.eclipse.nebula.widgets.nattable.group.ColumnGroupExpandCollapseLayer) ColumnGroupModel(org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel) Before(org.junit.Before)

Example 3 with ColumnHideShowLayerFixture

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

the class ColumnHideShowLayerTest method showColumnPositions.

@Test
public void showColumnPositions() throws Exception {
    this.columnHideShowLayer = new ColumnHideShowLayerFixture(new DataLayerFixture(10, 2, 100, 20));
    assertEquals(10, this.columnHideShowLayer.getColumnCount());
    this.columnHideShowLayer.hideColumnPositions(Arrays.asList(3, 4, 5));
    assertEquals(7, this.columnHideShowLayer.getColumnCount());
    assertEquals(-1, this.columnHideShowLayer.getColumnPositionByIndex(3));
    assertEquals(-1, this.columnHideShowLayer.getColumnPositionByIndex(4));
    this.columnHideShowLayer.showColumnIndexes(Arrays.asList(3, 4));
    assertEquals(9, this.columnHideShowLayer.getColumnCount());
    assertEquals(3, this.columnHideShowLayer.getColumnPositionByIndex(3));
    assertEquals(4, this.columnHideShowLayer.getColumnPositionByIndex(4));
}
Also used : ColumnHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Test(org.junit.Test)

Example 4 with ColumnHideShowLayerFixture

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

the class ColumnGroupExpandCollapseLayerTest method isFirstVisibleWithColumnsReordered.

@Test
public void isFirstVisibleWithColumnsReordered() throws Exception {
    // Original indexes : 0 1 2 3 4
    // Indexes reordered : 4 1 0 2 3
    ColumnReorderLayer reorderLayer = new ColumnReorderLayerFixture();
    this.underlyingLayer = new ColumnHideShowLayerFixture(reorderLayer);
    this.expandCollapseLayer = new ColumnGroupExpandCollapseLayer(this.underlyingLayer, this.model);
    this.model.clear();
    this.model.addColumnsIndexesToGroup(TEST_GROUP_NAME, 0, 2, 3);
    // Hide index 0
    this.underlyingLayer.hideColumnPositions(Arrays.asList(2));
    assertFalse(ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(0, this.expandCollapseLayer, this.underlyingLayer, this.model));
    assertTrue(ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(2, this.expandCollapseLayer, this.underlyingLayer, this.model));
    assertFalse(ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(3, this.expandCollapseLayer, this.underlyingLayer, this.model));
}
Also used : ColumnHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnReorderLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture) ColumnGroupExpandCollapseLayer(org.eclipse.nebula.widgets.nattable.group.ColumnGroupExpandCollapseLayer) Test(org.junit.Test)

Aggregations

ColumnHideShowLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture)4 ColumnGroupExpandCollapseLayer (org.eclipse.nebula.widgets.nattable.group.ColumnGroupExpandCollapseLayer)2 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)2 Before (org.junit.Before)2 Test (org.junit.Test)2 ColumnGroupModel (org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel)1 ColumnReorderLayer (org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer)1 ColumnCategoriesModelFixture (org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFixture)1 ColumnHeaderLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture)1 ColumnReorderLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture)1