use of jgnash.engine.budget.BudgetPeriodDescriptor in project jgnash by ccavanaugh.
the class BudgetGoalsDialogController method handleFillAllAction.
@FXML
private void handleFillAllAction() {
final BigDecimal fillAmount = fillAllDecimalTextField.getDecimal();
for (final BudgetPeriodDescriptor descriptor : getDescriptors()) {
budgetGoal.get().setGoal(descriptor.getStartPeriod(), descriptor.getEndPeriod(), fillAmount);
}
goalTable.refresh();
}
use of jgnash.engine.budget.BudgetPeriodDescriptor in project jgnash by ccavanaugh.
the class BudgetTableController method buildAccountPeriodResultsColumn.
private TableColumn<Account, BigDecimal> buildAccountPeriodResultsColumn(final int index) {
final BudgetPeriodDescriptor descriptor = budgetResultsModel.getDescriptorList().get(index);
final TableColumn<Account, BigDecimal> headerColumn = new TableColumn<>(descriptor.getPeriodDescription());
final TableColumn<Account, BigDecimal> budgetedColumn = new TableColumn<>(resources.getString("Column.Budgeted"));
budgetedColumn.setCellValueFactory(param -> {
if (param.getValue() != null) {
return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getBudgeted());
}
return new SimpleObjectProperty<>(BigDecimal.ZERO);
});
budgetedColumn.setCellFactory(param -> new AccountCommodityFormatTableCell());
budgetedColumn.minWidthProperty().bind(columnWidth);
budgetedColumn.maxWidthProperty().bind(columnWidth);
budgetedColumn.setSortable(false);
budgetedColumn.resizableProperty().set(false);
headerColumn.getColumns().add(budgetedColumn);
final TableColumn<Account, BigDecimal> actualColumn = new TableColumn<>(resources.getString("Column.Actual"));
actualColumn.setCellValueFactory(param -> {
if (param.getValue() != null) {
return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getChange());
}
return new SimpleObjectProperty<>(BigDecimal.ZERO);
});
actualColumn.setCellFactory(param -> new AccountCommodityFormatTableCell());
actualColumn.minWidthProperty().bind(columnWidth);
actualColumn.maxWidthProperty().bind(columnWidth);
actualColumn.setSortable(false);
actualColumn.resizableProperty().set(false);
headerColumn.getColumns().add(actualColumn);
final TableColumn<Account, BigDecimal> remainingColumn = new TableColumn<>(resources.getString("Column.Remaining"));
remainingColumn.setCellValueFactory(param -> {
if (param.getValue() != null) {
return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getRemaining());
}
return new SimpleObjectProperty<>(BigDecimal.ZERO);
});
remainingColumn.setCellFactory(param -> new AccountCommodityFormatTableCell());
// the max width is not bound to allow last column to grow and fill any voids
remainingColumn.minWidthProperty().bind(remainingColumnWidth);
remainingColumn.maxWidthProperty().bind(remainingColumnWidth);
remainingColumn.setSortable(false);
remainingColumn.resizableProperty().set(false);
headerColumn.getColumns().add(remainingColumn);
headerColumn.resizableProperty().set(false);
return headerColumn;
}
use of jgnash.engine.budget.BudgetPeriodDescriptor in project jgnash by ccavanaugh.
the class BudgetTableController method calculateMinPeriodColumnWidth.
private double calculateMinPeriodColumnWidth() {
double max = 0;
for (final BudgetPeriodDescriptor descriptor : budgetResultsModel.getDescriptorList()) {
for (final Account account : expandedAccountList) {
max = Math.max(max, calculateMinColumnWidth(descriptor, account));
}
}
max = Math.max(max, JavaFXUtils.getDisplayedTextWidth(resources.getString("Column.Budgeted") + BORDER_MARGIN, null));
max = Math.max(max, JavaFXUtils.getDisplayedTextWidth(resources.getString("Column.Actual") + BORDER_MARGIN, null));
max = Math.max(max, JavaFXUtils.getDisplayedTextWidth(resources.getString("Column.Remaining") + BORDER_MARGIN, null));
return Math.ceil(max);
}
use of jgnash.engine.budget.BudgetPeriodDescriptor in project jgnash by ccavanaugh.
the class BudgetTableController method buildAccountPeriodSummaryColumn.
private TableColumn<AccountGroup, BigDecimal> buildAccountPeriodSummaryColumn(final int index) {
final BudgetPeriodDescriptor descriptor = budgetResultsModel.getDescriptorList().get(index);
final TableColumn<AccountGroup, BigDecimal> headerColumn = new TableColumn<>(descriptor.getPeriodDescription());
final TableColumn<AccountGroup, BigDecimal> budgetedColumn = new TableColumn<>(resources.getString("Column.Budgeted"));
budgetedColumn.setCellValueFactory(param -> {
if (param.getValue() != null) {
return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getBudgeted());
}
return new SimpleObjectProperty<>(BigDecimal.ZERO);
});
budgetedColumn.setCellFactory(param -> new AccountGroupTableCell());
budgetedColumn.minWidthProperty().bind(columnWidth);
budgetedColumn.maxWidthProperty().bind(columnWidth);
budgetedColumn.setSortable(false);
budgetedColumn.resizableProperty().set(false);
headerColumn.getColumns().add(budgetedColumn);
final TableColumn<AccountGroup, BigDecimal> actualColumn = new TableColumn<>(resources.getString("Column.Actual"));
actualColumn.setCellValueFactory(param -> {
if (param.getValue() != null) {
return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getChange());
}
return new SimpleObjectProperty<>(BigDecimal.ZERO);
});
actualColumn.setCellFactory(param -> new AccountGroupTableCell());
actualColumn.minWidthProperty().bind(columnWidth);
actualColumn.maxWidthProperty().bind(columnWidth);
actualColumn.setSortable(false);
actualColumn.resizableProperty().set(false);
headerColumn.getColumns().add(actualColumn);
final TableColumn<AccountGroup, BigDecimal> remainingColumn = new TableColumn<>(resources.getString("Column.Remaining"));
remainingColumn.setCellValueFactory(param -> {
if (param.getValue() != null) {
return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getRemaining());
}
return new SimpleObjectProperty<>(BigDecimal.ZERO);
});
remainingColumn.setCellFactory(param -> new AccountGroupTableCell());
// the max width is not bound to allow last column to grow and fill any voids
remainingColumn.minWidthProperty().bind(remainingColumnWidth);
remainingColumn.maxWidthProperty().bind(remainingColumnWidth);
remainingColumn.setSortable(false);
remainingColumn.resizableProperty().set(false);
headerColumn.getColumns().add(remainingColumn);
return headerColumn;
}
use of jgnash.engine.budget.BudgetPeriodDescriptor in project jgnash by ccavanaugh.
the class BudgetTableController method calculateMinSummaryWidthColumnWidth.
private double calculateMinSummaryWidthColumnWidth() {
double max = 0;
for (final BudgetPeriodDescriptor descriptor : budgetResultsModel.getDescriptorList()) {
max = Math.max(max, calculateMinColumnWidth(descriptor));
}
for (final Account account : expandedAccountList) {
max = Math.max(max, calculateMinColumnWidth(account));
}
max = Math.max(max, JavaFXUtils.getDisplayedTextWidth(resources.getString("Column.Budgeted") + BORDER_MARGIN, null));
max = Math.max(max, JavaFXUtils.getDisplayedTextWidth(resources.getString("Column.Actual") + BORDER_MARGIN, null));
max = Math.max(max, JavaFXUtils.getDisplayedTextWidth(resources.getString("Column.Remaining") + BORDER_MARGIN, null));
return Math.ceil(max);
}
Aggregations