use of org.activityinfo.ui.client.analysis.model.ImmutableMeasureModel in project activityinfo by bedatadriven.
the class MeasurePane method updateMeasureLabel.
private void updateMeasureLabel(MeasureModel measureModel, String newLabel) {
ImmutableMeasureModel updatedMeasure = ImmutableMeasureModel.builder().from(measureModel).label(newLabel).build();
viewModel.updateModel(viewModel.getWorkingModel().withMeasure(updatedMeasure));
}
use of org.activityinfo.ui.client.analysis.model.ImmutableMeasureModel in project activityinfo by bedatadriven.
the class MeasurePane method updateMeasureFormula.
private void updateMeasureFormula(MeasureModel measure, String formula) {
ImmutableMeasureModel updatedMeasure = ImmutableMeasureModel.builder().from(measure).formula(formula).build();
viewModel.updateModel(viewModel.getWorkingModel().withMeasure(updatedMeasure));
}
use of org.activityinfo.ui.client.analysis.model.ImmutableMeasureModel in project activityinfo by bedatadriven.
the class MeasurePane method updateStatistic.
private void updateStatistic(MeasureModel measureModel, Statistic statistic, Tree.CheckState checked) {
Set<Statistic> newSelection = new HashSet<>(measureModel.getStatistics());
if (checked == Tree.CheckState.CHECKED) {
newSelection.add(statistic);
} else {
newSelection.remove(statistic);
}
ImmutableMeasureModel updatedMeasure = ImmutableMeasureModel.builder().from(measureModel).statistics(newSelection).build();
viewModel.updateModel(viewModel.getWorkingModel().withMeasure(updatedMeasure));
}
use of org.activityinfo.ui.client.analysis.model.ImmutableMeasureModel in project activityinfo by bedatadriven.
the class MeasureDialog method onCalculate.
private void onCalculate(SelectEvent event) {
ResourceId selectedFormId = model.getSelectedForms().getList().get(0);
FormulaDialog dialog = new FormulaDialog(model.getFormStore(), selectedFormId);
dialog.show(null, expr -> {
ImmutableMeasureModel measure = ImmutableMeasureModel.builder().formId(selectedFormId).formula(expr.getFormula()).label(expr.getFormula()).addStatistics(Statistic.SUM).build();
select(measure);
});
}
Aggregations