Search in sources :

Example 1 with SelectionLayerStructuralChangeEventHandler

use of org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler in project nebula.widgets.nattable by eclipse.

the class SelectionLayerStructuralChangeEventHandlerTest method shouldLeaveSelectionUnchangedIfASelectedRowIsNotModified.

@Test
public void shouldLeaveSelectionUnchangedIfASelectedRowIsNotModified() throws Exception {
    this.selectionModel.addSelection(2, 3);
    SelectionLayerStructuralChangeEventHandler handler = new SelectionLayerStructuralChangeEventHandler(this.selectionLayer);
    handler.handleLayerEvent(new RowDeleteEvent(this.dataLayer, 5));
    Assert.assertFalse(this.selectionModel.isEmpty());
    Assert.assertTrue(this.selectionModel.isRowPositionSelected(3));
}
Also used : SelectionLayerStructuralChangeEventHandler(org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler) RowDeleteEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent) Test(org.junit.Test)

Example 2 with SelectionLayerStructuralChangeEventHandler

use of org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler in project nebula.widgets.nattable by eclipse.

the class SelectionLayerStructuralChangeEventHandlerTest method shouldClearSelectionIfAllRowsAreHidden.

@Test
public void shouldClearSelectionIfAllRowsAreHidden() {
    this.selectionModel.addSelection(3, 4);
    SelectionLayerStructuralChangeEventHandler handler = new SelectionLayerStructuralChangeEventHandler(this.selectionLayer);
    List<Integer> rows = new ArrayList<Integer>();
    rows.add(0);
    rows.add(1);
    rows.add(2);
    rows.add(3);
    rows.add(4);
    rows.add(5);
    rows.add(6);
    rows.add(7);
    rows.add(8);
    rows.add(9);
    handler.handleLayerEvent(new HideRowPositionsEvent(this.dataLayer, rows));
    Assert.assertTrue(this.selectionModel.isEmpty());
}
Also used : SelectionLayerStructuralChangeEventHandler(org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler) HideRowPositionsEvent(org.eclipse.nebula.widgets.nattable.hideshow.event.HideRowPositionsEvent) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with SelectionLayerStructuralChangeEventHandler

use of org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler in project nebula.widgets.nattable by eclipse.

the class SelectionLayerStructuralChangeEventHandlerTest method shouldLeaveSelectionUnchangedIfTheFollowingRowIsModified.

@Test
public void shouldLeaveSelectionUnchangedIfTheFollowingRowIsModified() throws Exception {
    this.selectionModel.addSelection(3, 4);
    SelectionLayerStructuralChangeEventHandler handler = new SelectionLayerStructuralChangeEventHandler(this.selectionLayer);
    handler.handleLayerEvent(new RowDeleteEvent(this.dataLayer, 5));
    Assert.assertFalse(this.selectionModel.isEmpty());
    Assert.assertTrue(this.selectionModel.isRowPositionSelected(4));
}
Also used : SelectionLayerStructuralChangeEventHandler(org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler) RowDeleteEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent) Test(org.junit.Test)

Example 4 with SelectionLayerStructuralChangeEventHandler

use of org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler in project nebula.widgets.nattable by eclipse.

the class SelectionLayerStructuralChangeEventHandlerTest method shouldClearSelectionIfASelectedRowIsModified.

@Test
public void shouldClearSelectionIfASelectedRowIsModified() throws Exception {
    this.selectionModel.addSelection(2, 3);
    SelectionLayerStructuralChangeEventHandler handler = new SelectionLayerStructuralChangeEventHandler(this.selectionLayer);
    handler.handleLayerEvent(new RowDeleteEvent(this.dataLayer, 3));
    Assert.assertTrue(this.selectionModel.isEmpty());
}
Also used : SelectionLayerStructuralChangeEventHandler(org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler) RowDeleteEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent) Test(org.junit.Test)

Example 5 with SelectionLayerStructuralChangeEventHandler

use of org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler 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());
}
Also used : SelectionLayerStructuralChangeEventHandler(org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler) RowDeleteEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent) Range(org.eclipse.nebula.widgets.nattable.coordinate.Range) Test(org.junit.Test)

Aggregations

SelectionLayerStructuralChangeEventHandler (org.eclipse.nebula.widgets.nattable.selection.event.SelectionLayerStructuralChangeEventHandler)5 Test (org.junit.Test)5 RowDeleteEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent)4 ArrayList (java.util.ArrayList)1 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)1 HideRowPositionsEvent (org.eclipse.nebula.widgets.nattable.hideshow.event.HideRowPositionsEvent)1