use of org.eclipse.nebula.widgets.nattable.summaryrow.DefaultSummaryRowConfiguration in project nebula.widgets.nattable by eclipse.
the class GroupByDataLayerSummaryRowConcurrencyTest method setup.
@Before
public void setup() {
List<Value> values = new ArrayList<Value>();
values.add(new Value(1));
values.add(new Value(2));
values.add(new Value(3));
values.add(new Value(4));
values.add(new Value(5));
values.add(new Value(6));
values.add(new Value(7));
values.add(new Value(8));
values.add(new Value(9));
values.add(new Value(10));
IColumnAccessor<Value> columnAccessor = new IColumnAccessor<Value>() {
@Override
public Object getDataValue(Value rowObject, int columnIndex) {
if (columnIndex % 2 == 0) {
try {
Thread.sleep(80);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return rowObject.value;
}
@Override
public void setDataValue(Value rowObject, int columnIndex, Object newValue) {
}
@Override
public int getColumnCount() {
return 10;
}
};
EventList<Value> eventList = GlazedLists.eventList(values);
TransformedList<Value, Value> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);
ConfigRegistry configRegistry = new ConfigRegistry();
final GroupByDataLayer<Value> dataLayer = new GroupByDataLayer<Value>(new GroupByModel(), eventList, columnAccessor);
// DataLayer dataLayer = new DataLayer(dataProvider);
GlazedListsEventLayer<Value> glazedListsEventLayer = new GlazedListsEventLayer<Value>(dataLayer, rowObjectsGlazedList);
DefaultBodyLayerStack bodyLayerStack = new DefaultBodyLayerStack(glazedListsEventLayer);
this.summaryRowLayer = new FixedSummaryRowLayer(dataLayer, bodyLayerStack, configRegistry, false);
this.summaryRowLayer.setHorizontalCompositeDependency(false);
CompositeLayer composite = new CompositeLayer(1, 2);
composite.setChildLayer("SUMMARY", this.summaryRowLayer, 0, 0);
composite.setChildLayer(GridRegion.BODY, bodyLayerStack, 0, 1);
NatTable natTable = new NatTableFixture(composite, false);
natTable.addConfiguration(new DefaultSummaryRowConfiguration() {
@Override
protected void addSummaryProviderConfig(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(SummaryRowConfigAttributes.SUMMARY_PROVIDER, new SummationSummaryProvider(dataLayer.getDataProvider(), false), DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
}
});
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.setConfigRegistry(configRegistry);
natTable.configure();
}
Aggregations