Search in sources :

Example 1 with EnableFormulaCachingCommand

use of org.eclipse.nebula.widgets.nattable.formula.command.EnableFormulaCachingCommand 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);
}
Also used : ILayerEvent(org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent) EnableFormulaCachingCommand(org.eclipse.nebula.widgets.nattable.formula.command.EnableFormulaCachingCommand) DisableFormulaCachingCommand(org.eclipse.nebula.widgets.nattable.formula.command.DisableFormulaCachingCommand) BigDecimal(java.math.BigDecimal) CellVisualChangeEvent(org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)1 DisableFormulaCachingCommand (org.eclipse.nebula.widgets.nattable.formula.command.DisableFormulaCachingCommand)1 EnableFormulaCachingCommand (org.eclipse.nebula.widgets.nattable.formula.command.EnableFormulaCachingCommand)1 CellVisualChangeEvent (org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent)1 ILayerEvent (org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent)1 Test (org.junit.Test)1