Search in sources :

Example 1 with BudgetItem

use of ui.ex1.entity.BudgetItem in project jmix-docs by Haulmont.

the class TableScreen method budgetTableAggregationDistributionProvider.

// end::empty-state-link-click-handler[]
// tag::aggregation-distribution-provider[]
@Install(to = "budgetTable", subject = "aggregationDistributionProvider")
private void budgetTableAggregationDistributionProvider(Table.AggregationDistributionContext<BudgetItem> context) {
    Collection<BudgetItem> scope = context.getScope();
    if (scope.isEmpty()) {
        return;
    }
    double value = context.getValue() != null ? ((double) context.getValue()) : 0;
    for (BudgetItem budgetItem : scope) {
        budgetItem.setAmount(value / 100 * budgetItem.getPercent());
    }
}
Also used : BudgetItem(ui.ex1.entity.BudgetItem)

Aggregations

BudgetItem (ui.ex1.entity.BudgetItem)1