Search in sources :

Example 6 with RowReorderCommand

use of org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand in project nebula.widgets.nattable by eclipse.

the class RowStructuralChangeEventIntegrationTest method testHideReorder.

@Test
public void testHideReorder() {
    testInit();
    // hide row at position 2: 0 1 3 4
    this.natTable.doCommand(new RowHideCommand(this.viewportLayer, 2));
    // reorder to inverse order: 4 3 1 0
    this.natTable.doCommand(new RowReorderCommand(this.viewportLayer, 3, 0));
    this.natTable.doCommand(new RowReorderCommand(this.viewportLayer, 3, 1));
    this.natTable.doCommand(new RowReorderCommand(this.viewportLayer, 3, 2));
    assertEquals(4, this.viewportLayer.getRowCount());
    assertEquals(4, this.viewportLayer.getRowIndexByPosition(0));
    assertEquals(3, this.viewportLayer.getRowIndexByPosition(1));
    assertEquals(1, this.viewportLayer.getRowIndexByPosition(2));
    assertEquals(0, this.viewportLayer.getRowIndexByPosition(3));
    assertEquals(-1, this.viewportLayer.getRowIndexByPosition(4));
    assertEquals("five", this.viewportLayer.getDataValueByPosition(0, 0));
    assertEquals("four", this.viewportLayer.getDataValueByPosition(0, 1));
    assertEquals("two", this.viewportLayer.getDataValueByPosition(0, 2));
    assertEquals("one", this.viewportLayer.getDataValueByPosition(0, 3));
}
Also used : RowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) RowReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand) Test(org.junit.Test)

Aggregations

RowReorderCommand (org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand)6 Test (org.junit.Test)5 MultiRowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand)3 RowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand)2 ColumnHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand)1 RowDeleteEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent)1 RowInsertEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent)1 ColumnReorderCommand (org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand)1 ColumnResizeCommand (org.eclipse.nebula.widgets.nattable.resize.command.ColumnResizeCommand)1 RowResizeCommand (org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand)1 BaseDataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture)1 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)1