Search in sources :

Example 1 with DimensionModel

use of org.activityinfo.client.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));
    if (model.getIndicators().isEmpty()) {
        callback.onSuccess(new BaseListLoadResult<DimensionModel>(list));
    } else {
        dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {

            @Override
            public void onFailure(Throwable caught) {
                callback.onFailure(caught);
            }

            @Override
            public void onSuccess(SchemaDTO schema) {
                addGeographicDimensions(list, schema);
                list.addAll(DimensionModel.attributeGroupModels(schema, model.getIndicators()));
                callback.onSuccess(new BaseListLoadResult<DimensionModel>(list));
            }
        });
    }
}
Also used : BaseListLoadResult(com.extjs.gxt.ui.client.data.BaseListLoadResult) DimensionModel(org.activityinfo.client.report.editor.pivotTable.DimensionModel) GetSchema(org.activityinfo.shared.command.GetSchema) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO)

Aggregations

BaseListLoadResult (com.extjs.gxt.ui.client.data.BaseListLoadResult)1 DimensionModel (org.activityinfo.client.report.editor.pivotTable.DimensionModel)1 GetSchema (org.activityinfo.shared.command.GetSchema)1 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)1