Search in sources :

Example 11 with RowHideCommand

use of org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand 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

RowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand)11 Test (org.junit.Test)10 MultiRowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand)8 FreezeRowCommand (org.eclipse.nebula.widgets.nattable.freeze.command.FreezeRowCommand)4 ShowAllRowsCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand)4 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)2 HideRowPositionsEvent (org.eclipse.nebula.widgets.nattable.hideshow.event.HideRowPositionsEvent)2 IUniqueIndexLayer (org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)2 DummyGridLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack)2 RowReorderCommand (org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand)2 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)2 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)2 Shell (org.eclipse.swt.widgets.Shell)2 StructuralDiff (org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1