use of jgnash.engine.budget.BudgetPeriodResults in project jgnash by ccavanaugh.
the class BudgetTableController method calculateMinColumnWidth.
private double calculateMinColumnWidth(final BudgetPeriodDescriptor descriptor) {
double max = 0;
double min = 0;
for (final AccountGroup accountGroup : accountGroupList) {
BudgetPeriodResults budgetPeriodResults = budgetResultsModel.getResults(descriptor, accountGroup);
max = Math.max(max, budgetPeriodResults.getBudgeted().doubleValue());
max = Math.max(max, budgetPeriodResults.getChange().doubleValue());
max = Math.max(max, budgetPeriodResults.getRemaining().doubleValue());
min = Math.min(min, budgetPeriodResults.getBudgeted().doubleValue());
min = Math.min(min, budgetPeriodResults.getChange().doubleValue());
min = Math.min(min, budgetPeriodResults.getRemaining().doubleValue());
}
return Math.max(JavaFXUtils.getDisplayedTextWidth(CommodityFormat.getFullNumberFormat(budgetResultsModel.getBaseCurrency()).format(max) + BORDER_MARGIN, null), JavaFXUtils.getDisplayedTextWidth(CommodityFormat.getFullNumberFormat(budgetResultsModel.getBaseCurrency()).format(min) + BORDER_MARGIN, null));
}
Aggregations