use of org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent in project nebula.widgets.nattable by eclipse.
the class AbstractLayerTest method testFireOriginalEventIfOnlyOneListener.
@Test
public void testFireOriginalEventIfOnlyOneListener() {
ILayerEvent event = new ColumnResizeEvent(this.dataLayer, 2);
this.dataLayer.fireLayerEvent(event);
List<ILayerEvent> receivedEvents = this.firstListener.getReceivedEvents();
assertNotNull(receivedEvents);
assertEquals(1, receivedEvents.size());
assertSame(event, receivedEvents.get(0));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent in project nebula.widgets.nattable by eclipse.
the class AbstractLayerTest method testFireClonedEventIfMultipleListeners.
@Test
public void testFireClonedEventIfMultipleListeners() {
LayerListenerFixture secondListener = new LayerListenerFixture();
this.dataLayer.addLayerListener(secondListener);
ILayerEvent event = new ColumnResizeEvent(this.dataLayer, 2);
this.dataLayer.fireLayerEvent(event);
List<ILayerEvent> receivedEvents = this.firstListener.getReceivedEvents();
assertNotNull(receivedEvents);
assertEquals(1, receivedEvents.size());
assertNotSame(event, receivedEvents.get(0));
receivedEvents = secondListener.getReceivedEvents();
assertNotNull(receivedEvents);
assertEquals(1, receivedEvents.size());
assertSame(event, receivedEvents.get(0));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent in project nebula.widgets.nattable by eclipse.
the class FormulaIntegrationTest method testCacheUpdate.
@Test
public void testCacheUpdate() throws InterruptedException {
assertNull(this.natTable.getDataValueByPosition(3, 5));
// wait until calculation is processed
Thread.sleep(50);
assertEquals(new BigDecimal("16"), this.natTable.getDataValueByPosition(3, 5));
ILayerEvent receivedEvent = this.listenerFixture.getReceivedEvent(CellVisualChangeEvent.class);
assertNotNull(receivedEvent);
// update a value in the first sum
((DataLayer) this.gridLayerStack.getBodyDataLayer()).setDataValue(0, 2, 20);
// right after the update we still get the old value from the cache
assertEquals(new BigDecimal("16"), this.natTable.getDataValueByPosition(3, 5));
// wait until calculation is processed
Thread.sleep(50);
assertEquals(new BigDecimal("31"), this.natTable.getDataValueByPosition(3, 5));
assertEquals(2, this.listenerFixture.getEventsCount());
}
use of org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent in project nebula.widgets.nattable by eclipse.
the class FormulaIntegrationTest method testResultCachingDisabled.
@Test
public void testResultCachingDisabled() throws InterruptedException {
this.natTable.doCommand(new DisableFormulaCachingCommand());
assertNotNull(this.natTable.getDataValueByPosition(3, 1));
assertEquals(new BigDecimal("15"), this.natTable.getDataValueByPosition(3, 1));
ILayerEvent receivedEvent = this.listenerFixture.getReceivedEvent(CellVisualChangeEvent.class);
assertNull(receivedEvent);
this.natTable.doCommand(new EnableFormulaCachingCommand());
assertNull(this.natTable.getDataValueByPosition(3, 1));
// wait until calculation is processed
Thread.sleep(50);
assertEquals(new BigDecimal("15"), this.natTable.getDataValueByPosition(3, 1));
receivedEvent = this.listenerFixture.getReceivedEvent(CellVisualChangeEvent.class);
assertNotNull(receivedEvent);
}
use of org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent in project nebula.widgets.nattable by eclipse.
the class FormulaIntegrationTest method testResultCaching.
@Test
public void testResultCaching() throws InterruptedException {
assertNull(this.natTable.getDataValueByPosition(3, 1));
// wait until calculation is processed
Thread.sleep(50);
assertEquals(new BigDecimal("15"), this.natTable.getDataValueByPosition(3, 1));
ILayerEvent receivedEvent = this.listenerFixture.getReceivedEvent(CellVisualChangeEvent.class);
assertNotNull(receivedEvent);
}
Aggregations