use of org.eclipse.nebula.widgets.nattable.reorder.command.MultiRowReorderCommand in project nebula.widgets.nattable by eclipse.
the class ReorderRowEventTest method reorderEventMustPropagateToTheTop.
@Test
public void reorderEventMustPropagateToTheTop() throws Exception {
DefaultBodyLayerStack underlyingLayer = new DefaultBodyLayerStack(new RowReorderLayer(new DataLayerFixture(10, 10, 100, 20)));
NatTableFixture natTableFixture = new NatTableFixture(underlyingLayer);
// Add listener
LayerListenerFixture listenerFixture = new LayerListenerFixture();
natTableFixture.addLayerListener(listenerFixture);
Assert.assertEquals(10, natTableFixture.getRowCount());
Assert.assertEquals(1, natTableFixture.getRowIndexByPosition(1));
// Move to outside the visible range
List<Integer> rowsToMove = Arrays.asList(1, 2, 3);
int destinationPosition = 10;
natTableFixture.doCommand(new MultiRowReorderCommand(natTableFixture, rowsToMove, destinationPosition));
// Ensure that the event propagates to the top
Assert.assertEquals(1, listenerFixture.getEventsCount());
Assert.assertNotNull(listenerFixture.getReceivedEvent(RowReorderEvent.class));
Assert.assertEquals(4, natTableFixture.getRowIndexByPosition(1));
}
Aggregations