use of org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent in project nebula.widgets.nattable by eclipse.
the class SelectionLayerStructuralChangeEventHandlerTest method shouldClearSelectionIfListIsCleared.
@Test
public void shouldClearSelectionIfListIsCleared() {
this.selectionModel.addSelection(3, 4);
SelectionLayerStructuralChangeEventHandler handler = new SelectionLayerStructuralChangeEventHandler(this.selectionLayer);
handler.handleLayerEvent(new RowDeleteEvent(this.dataLayer, new Range(0, 9)));
Assert.assertTrue(this.selectionModel.isEmpty());
}
use of org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent in project nebula.widgets.nattable by eclipse.
the class SelectionModelStructuralChangeEventHandlerTest method shouldLeaveSelectionUnchangedIfTheFollowingRowIsModified.
@Test
public void shouldLeaveSelectionUnchangedIfTheFollowingRowIsModified() {
this.selectionModel.addSelection(3, 4);
this.selectionModel.handleLayerEvent(new RowDeleteEvent(this.dataLayer, 5));
Assert.assertFalse(this.selectionModel.isEmpty());
Assert.assertTrue(this.selectionModel.isRowPositionSelected(4));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent in project nebula.widgets.nattable by eclipse.
the class SelectionModelStructuralChangeEventHandlerTest method shouldLeaveSelectionUnchangedIfASelectedRowIsNotModified.
@Test
public void shouldLeaveSelectionUnchangedIfASelectedRowIsNotModified() {
this.selectionModel.addSelection(2, 3);
this.selectionModel.handleLayerEvent(new RowDeleteEvent(this.dataLayer, 5));
Assert.assertFalse(this.selectionModel.isEmpty());
Assert.assertTrue(this.selectionModel.isRowPositionSelected(3));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent in project nebula.widgets.nattable by eclipse.
the class RowStructuralChangeEventIntegrationTest method testDeleteLastRow.
@Test
public void testDeleteLastRow() {
testInit();
// delete last row
int index = this.contents.size() - 1;
this.contents.remove(index);
this.underlyingLayer.fireLayerEvent(new RowDeleteEvent(this.underlyingLayer, index));
assertEquals(4, this.viewportLayer.getRowCount());
}
use of org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent in project nebula.widgets.nattable by eclipse.
the class RowSelectionModelStructuralChangeEventHandlerTest method shouldRemoveSelectionOnDelete.
@Test
public void shouldRemoveSelectionOnDelete() {
assertEquals(0, this.selectionLayer.getFullySelectedRowPositions().length);
this.nattable.doCommand(new SelectRowsCommand(this.nattable, 1, 1, false, false));
assertEquals(1, this.selectionLayer.getFullySelectedRowPositions().length);
// Ford motor at top and selected
assertEquals("B Ford Motor", this.nattable.getDataValueByPosition(2, 1).toString());
assertEquals("B Ford Motor", getSelected().getSecurity_description());
this.listFixture.remove(0);
// fire event to trigger structural refresh
this.bodyDataLayer.fireLayerEvent(new RowDeleteEvent(this.bodyDataLayer, 0));
// another value on top now
assertEquals("A Alphabet Co.", this.nattable.getDataValueByPosition(2, 1).toString());
// selection should be empty since the selected row was deleted
assertEquals(0, this.selectionLayer.getFullySelectedRowPositions().length);
assertEquals(0, this.selectionLayer.getSelectedRowCount());
}
Aggregations