use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.
the class RowSelectionModelStructuralChangeEventHandlerTest method setup.
@Before
public void setup() {
this.listFixture = RowDataListFixture.getList(10);
this.bodyDataProvider = new ListDataProvider<RowDataFixture>(this.listFixture, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()));
GridLayerFixture gridLayer = new GridLayerFixture(this.bodyDataProvider);
this.nattable = new NatTableFixture(gridLayer, false);
this.bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
this.selectionLayer = gridLayer.getBodyLayer().getSelectionLayer();
this.selectionLayer.setSelectionModel(new RowSelectionModel<RowDataFixture>(this.selectionLayer, this.bodyDataProvider, new IRowIdAccessor<RowDataFixture>() {
@Override
public Serializable getRowId(RowDataFixture rowObject) {
return rowObject.getSecurity_id();
}
}));
this.listener = new LayerListenerFixture();
// we register the listener to the SelectionLayer because for some cases
// like clearing a collection, the selection change is not propagated
// the layer stack upwards as it gets stopped on layer conversion
this.selectionLayer.addLayerListener(this.listener);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.
the class RowSizeResetCommandTest method setup.
@Before
public void setup() {
this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10));
this.listener = new LayerListenerFixture();
this.dataLayer.addLayerListener(this.listener);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.
the class ResizeEventPropagationTest method shouldReturnARectangleStartingFromResizedRowToEndOfGrid.
@Test
public void shouldReturnARectangleStartingFromResizedRowToEndOfGrid() {
// Mimics resizing the third row
this.layerListener = new LayerListenerFixture();
this.dataLayer.addLayerListener(this.layerListener);
this.dataLayer.setRowHeightByPosition(3, 100);
// This is the propagated event
RowResizeEvent rowResizeEvent = (RowResizeEvent) this.layerListener.getReceivedEvents().get(0);
Collection<Rectangle> actualRectangles = rowResizeEvent.getChangedPositionRectangles();
// The affected region should have the following size
Rectangle expectedRectangle = new Rectangle(0, 3, 5, 4);
Assert.assertEquals(expectedRectangle, actualRectangles.iterator().next());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.
the class ResizeEventPropagationTest method shouldFireResizeEventAfterColumnResizeCommand.
@Test
public void shouldFireResizeEventAfterColumnResizeCommand() {
this.dataLayer.addLayerListener(new LayerListenerFixture());
this.dataLayer.setColumnWidthByPosition(4, 100);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.
the class ResizingVisibleReorderedColumnsTest method setUp.
@Before
public void setUp() {
this.dataLayer = new DataLayerFixture(100, 40);
this.reorderLayer = new BaseColumnReorderLayerFixture(this.dataLayer);
this.layerListener = new LayerListenerFixture();
this.reorderLayer.addLayerListener(this.layerListener);
}
Aggregations