use of jgnash.uifx.control.TextInputDialog in project jgnash by ccavanaugh.
the class BudgetManagerDialogController method handleRenameAction.
@FXML
private void handleRenameAction() {
for (final Budget budget : budgetListView.getSelectionModel().getSelectedItems()) {
final TextInputDialog textInputDialog = new TextInputDialog(budget.getName());
textInputDialog.setTitle(resources.getString("Title.RenameBudget"));
textInputDialog.setContentText(resources.getString("Label.RenameBudget"));
final Optional<String> optional = textInputDialog.showAndWait();
optional.ifPresent(s -> {
if (!s.isEmpty()) {
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
budget.setName(s);
engine.updateBudget(budget);
}
});
}
}
Aggregations