use of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture in project nebula.widgets.nattable by eclipse.
the class VisualChangeEventConflaterTest method shouldAccumulateEvents.
@Test
public void shouldAccumulateEvents() throws Exception {
NatTableFixture natTable = new NatTableFixture();
VisualChangeEventConflater conflater = new VisualChangeEventConflater(natTable);
EventConflaterChain chain = new EventConflaterChain();
chain.add(conflater);
conflater.addEvent(new LayerEventFixture());
conflater.addEvent(new LayerEventFixture());
assertEquals(2, conflater.getCount());
chain.start();
Thread.sleep(EventConflaterChain.DEFAULT_INITIAL_DELAY + 100);
assertEquals(0, conflater.getCount());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture in project nebula.widgets.nattable by eclipse.
the class EditUtilsTest method setup.
@Before
public void setup() {
this.gridLayerStack = new DummyGridLayerStack(5, 5);
this.selectionLayer = this.gridLayerStack.getBodyLayer().getSelectionLayer();
this.natTable = new NatTableFixture(this.gridLayerStack);
// Ensure no active editor (static) is present
// Although deprecated this needs to still work for backwards
// compatibility
assertNull(ActiveCellEditorRegistry.getActiveCellEditor());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture in project nebula.widgets.nattable by eclipse.
the class RowSelectionEditUtilsTest method setup.
@Before
public void setup() {
List<RowDataFixture> listFixture = RowDataListFixture.getList(10);
IRowDataProvider<RowDataFixture> bodyDataProvider = new ListDataProvider<RowDataFixture>(listFixture, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()));
this.gridLayerStack = new GridLayerFixture(bodyDataProvider);
this.selectionLayer = this.gridLayerStack.getBodyLayer().getSelectionLayer();
this.selectionLayer.setSelectionModel(new RowSelectionModel<RowDataFixture>(this.selectionLayer, bodyDataProvider, new IRowIdAccessor<RowDataFixture>() {
@Override
public Serializable getRowId(RowDataFixture rowObject) {
return rowObject.getSecurity_id();
}
}));
this.natTable = new NatTableFixture(this.gridLayerStack);
// Ensure no active editor (static) is present
// Although deprecated this needs to still work for backwards
// compatibility
assertNull(ActiveCellEditorRegistry.getActiveCellEditor());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture in project nebula.widgets.nattable by eclipse.
the class ColumnHideShowLayerTest2 method shouldFireTheCorrectEventOnColumnHide.
@Test
public void shouldFireTheCorrectEventOnColumnHide() throws Exception {
NatTable natTable = new NatTableFixture();
LayerListenerFixture listener = new LayerListenerFixture();
natTable.addLayerListener(listener);
// Grid coordinates
natTable.doCommand(new ColumnHideCommand(natTable, 5));
assertEquals(1, listener.getReceivedEvents().size());
HideColumnPositionsEvent hideEvent = (HideColumnPositionsEvent) listener.getReceivedEvents().get(0);
Range range = hideEvent.getColumnPositionRanges().iterator().next();
assertEquals(5, range.start);
assertEquals(6, range.end);
// The range Before hide: 5 -> 6
// The range After hide: 5 -> 5 (column is not there anymore)
StructuralDiff columnDiff = hideEvent.getColumnDiffs().iterator().next();
assertEquals(5, columnDiff.getBeforePositionRange().start);
assertEquals(6, columnDiff.getBeforePositionRange().end);
assertEquals(5, columnDiff.getAfterPositionRange().start);
assertEquals(5, columnDiff.getAfterPositionRange().end);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture in project nebula.widgets.nattable by eclipse.
the class BoxingStyleTest method setUp.
@Before
public void setUp() throws Exception {
this.natTable = new NatTableFixture();
this.configRegistry = (ConfigRegistry) this.natTable.getConfigRegistry();
this.cellStyle = new Style();
this.cellPainter = new TextPainter();
this.gc = new GC(Display.getDefault());
}
Aggregations