use of org.eclipse.nebula.widgets.nattable.layer.event.StructuralRefreshEvent in project nebula.widgets.nattable by eclipse.
the class RowSelectionModelStructuralChangeEventHandlerTest method shouldFireRowSelectionEventOnClear.
@Test
public void shouldFireRowSelectionEventOnClear() {
// Select single row
this.nattable.doCommand(new SelectRowsCommand(this.nattable, 5, 5, false, false));
assertEquals(1, this.selectionLayer.getSelectedRowCount());
assertEquals(1, this.listener.getEventsCount());
assertTrue(this.listener.containsInstanceOf(RowSelectionEvent.class));
RowSelectionEvent event = (RowSelectionEvent) this.listener.getReceivedEvents().get(0);
assertEquals(4, event.getRowPositionRanges().iterator().next().start);
assertEquals(5, event.getRowPositionRanges().iterator().next().end);
// clear
this.listFixture.clear();
this.bodyDataLayer.fireLayerEvent(new StructuralRefreshEvent(this.bodyDataLayer));
assertEquals(0, this.selectionLayer.getSelectedRowCount());
assertEquals(3, this.listener.getEventsCount());
assertTrue(this.listener.containsInstanceOf(RowSelectionEvent.class));
event = (RowSelectionEvent) this.listener.getReceivedEvents().get(1);
// since the underlying collection is cleared the ranges should be empty
assertEquals(0, event.getRowPositionRanges().size());
}
Aggregations