use of org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider in project nebula.widgets.nattable by eclipse.
the class CalculatedValueCacheTest method testIllegalState.
@Test(expected = IllegalStateException.class)
public void testIllegalState() {
this.valueCache = new CalculatedValueCache(new DataLayer(new DummyBodyDataProvider(10, 10)), false, false);
this.valueCache.getCalculatedValue(0, 0, false, this.calculator);
}
use of org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider in project nebula.widgets.nattable by eclipse.
the class CalculatedValueCacheTest method testCalculateInBackgroundWithCoordsKey.
@Test
public void testCalculateInBackgroundWithCoordsKey() throws Exception {
this.valueCache = new CalculatedValueCache(new DataLayer(new DummyBodyDataProvider(10, 10)), true, true);
Object result = this.valueCache.getCalculatedValue(0, 0, true, this.calculator);
// as calculation is performed in background, the immediate return value
// is null
assertNull(result);
// now wait so the background process is able to finish
Thread.sleep(250);
result = this.valueCache.getCalculatedValue(0, 0, true, this.calculator);
assertEquals(Integer.valueOf(42), Integer.valueOf(result.toString()));
}
use of org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider in project nebula.widgets.nattable by eclipse.
the class CalculatedValueCacheTest method testCalculateInSameThreadWithCoordsKey.
@Test
public void testCalculateInSameThreadWithCoordsKey() throws Exception {
this.valueCache = new CalculatedValueCache(new DataLayer(new DummyBodyDataProvider(10, 10)), true, true);
Object result = this.valueCache.getCalculatedValue(0, 0, false, this.calculator);
assertEquals(Integer.valueOf(42), Integer.valueOf(result.toString()));
}
use of org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider in project nebula.widgets.nattable by eclipse.
the class _001_Vertical_layer_composition method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
ViewportLayer layer = new ViewportLayer(new SelectionLayer(new DataLayer(new DummyBodyDataProvider(1000000, 1000000))));
layer.setRegionName(GridRegion.BODY);
return new NatTable(parent, layer);
}
use of org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider in project nebula.widgets.nattable by eclipse.
the class ColumnHeaderViewportSelectionDataLayerExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
DummyBodyDataProvider bodyDataProvider = new DummyBodyDataProvider(500, 1000000);
SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(bodyDataProvider));
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new DummyColumnHeaderDataProvider(bodyDataProvider)), viewportLayer, selectionLayer);
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);
return new NatTable(parent, compositeLayer);
}
Aggregations