use of org.activityinfo.ui.client.component.report.editor.pivotTable.DimensionModel in project activityinfo by bedatadriven.
the class DimensionProxy method load.
@Override
protected void load(Object loadConfig, final AsyncCallback<ListLoadResult<DimensionModel>> callback) {
final List<DimensionModel> list = Lists.newArrayList();
list.add(new DimensionModel(DimensionType.Indicator, I18N.CONSTANTS.indicator()));
list.add(new DimensionModel(DimensionType.Partner, I18N.CONSTANTS.partner()));
list.add(new DimensionModel(DimensionType.Project, I18N.CONSTANTS.project()));
list.add(new DimensionModel(DimensionType.Target, I18N.CONSTANTS.realizedOrTargeted()));
list.add(new DimensionModel(DateUnit.YEAR));
list.add(new DimensionModel(DateUnit.QUARTER));
list.add(new DimensionModel(DateUnit.MONTH));
list.add(new DimensionModel(DateUnit.WEEK_MON));
list.add(new DimensionModel(DimensionType.Location, I18N.CONSTANTS.location()));
if (model.getIndicators().isEmpty()) {
callback.onSuccess(new BaseListLoadResult<>(list));
} else {
Dimensions.loadDimensions(dispatcher, model).then(new Function<Dimensions, ListLoadResult<DimensionModel>>() {
@Override
public ListLoadResult<DimensionModel> apply(Dimensions input) {
list.addAll(input.getAttributeDimensions());
list.addAll(input.getAdminLevelDimensions());
return new BaseListLoadResult<>(list);
}
}).then(callback);
}
}
Aggregations