Search in sources :

Example 31 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture 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));
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) MultiRowReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.MultiRowReorderCommand) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) DefaultBodyLayerStack(org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack) RowReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.RowReorderLayer) Test(org.junit.Test)

Example 32 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.

the class ColumnSizeResetCommandTest method setup.

@Before
public void setup() {
    this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10));
    this.listener = new LayerListenerFixture();
    this.dataLayer.addLayerListener(this.listener);
}
Also used : DummyBodyDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) Before(org.junit.Before)

Example 33 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.

the class HideShowRowEventTest method setUp.

@Before
public void setUp() {
    this.hideShowLayer = new BaseRowHideShowLayerFixture(new DataLayerFixture(100, 40));
    this.layerListener = new LayerListenerFixture();
}
Also used : BaseRowHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseRowHideShowLayerFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) Before(org.junit.Before)

Example 34 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.

the class SelectionDragModeTest method setup.

@Before
public void setup() {
    this.gridLayer = new DummyGridLayerStack();
    this.natTable = new NatTable(new Shell(Display.getDefault()), this.gridLayer);
    this.natTable.setSize(400, 400);
    this.natTable.doCommand(new InitializeClientAreaCommandFixture());
    this.dragMode = new CellSelectionDragMode();
    Event event = new Event();
    event.widget = new Shell();
    event.x = 100;
    event.y = 100;
    this.mouseEvent = new MouseEvent(event);
    this.listener = new LayerListenerFixture();
    this.gridLayer.addLayerListener(this.listener);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) InitializeClientAreaCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture) MouseEvent(org.eclipse.swt.events.MouseEvent) DummyGridLayerStack(org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack) Event(org.eclipse.swt.widgets.Event) MouseEvent(org.eclipse.swt.events.MouseEvent) ILayerEvent(org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) Before(org.junit.Before)

Example 35 with LayerListenerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture in project nebula.widgets.nattable by eclipse.

the class SelectionEventsTest method setup.

@Before
public void setup() {
    this.nattable = new NatTableFixture();
    this.listener = new LayerListenerFixture();
    this.nattable.addLayerListener(this.listener);
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) Before(org.junit.Before)

Aggregations

LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)37 Test (org.junit.Test)21 Before (org.junit.Before)16 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)11 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)7 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)4 Rectangle (org.eclipse.swt.graphics.Rectangle)4 Shell (org.eclipse.swt.widgets.Shell)4 Properties (java.util.Properties)3 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)3 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)3 CellVisualChangeEvent (org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent)3 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)3 DummyGridLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack)3 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)2 DummyBodyDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider)2 ColumnHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand)2 RowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand)2 HideColumnPositionsEvent (org.eclipse.nebula.widgets.nattable.hideshow.event.HideColumnPositionsEvent)2 HideRowPositionsEvent (org.eclipse.nebula.widgets.nattable.hideshow.event.HideRowPositionsEvent)2