Search in sources :

Example 1 with ColumnReorderLayerFixture

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

the class MultiColumnResizeCommandTest method getColumnWidthWhenTheColumnPositionsHaveBeenConverted.

@Test
public void getColumnWidthWhenTheColumnPositionsHaveBeenConverted() {
    DataLayerFixture dataLayer = new DataLayerFixture();
    // Indexes re-ordered: 4 1 0 2 3
    ColumnReorderLayer reorderLayerFixture = new ColumnReorderLayerFixture(dataLayer);
    MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(reorderLayerFixture, new int[] { 1, 2 }, new int[] { 100, 150 });
    reorderLayerFixture.doCommand(resizeCommand);
    // As the Commands goes down the stack - positions might get converted
    // to entirely different values.
    assertEquals(-1, resizeCommand.getCommonColumnWidth());
    assertEquals(-1, resizeCommand.getColumnWidth(5));
    assertEquals(-1, resizeCommand.getColumnWidth(12));
    assertEquals(100, resizeCommand.getColumnWidth(1));
    assertEquals(150, resizeCommand.getColumnWidth(0));
}
Also used : DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnReorderLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture) Test(org.junit.Test)

Example 2 with ColumnReorderLayerFixture

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

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