This commit is contained in:
Filippo Ferrari 2024-07-27 18:13:51 +02:00
parent 0fc5b07f5e
commit 4d36b7dca2
2 changed files with 5 additions and 10 deletions

View file

@ -108,9 +108,8 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
// when a row is selected or deselected, populate form
grid.asSingleSelect().addValueChangeListener(event -> {
if (event.getValue() != null) {
UI.getCurrent().navigate(String.format(EXPENSE_EDIT_ROUTE_TEMPLATE, event.getValue().getId()));
} else {
if (event.getValue() != null) UI.getCurrent().navigate(String.format(EXPENSE_EDIT_ROUTE_TEMPLATE, event.getValue().getId()));
else {
clearForm();
UI.getCurrent().navigate(ExpensesView.class);
}
@ -164,9 +163,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
save.addClickListener(e -> {
try {
if (this.expense == null) {
this.expense = new Expense();
}
if (this.expense == null) this.expense = new Expense();
binder.writeBean(this.expense);
expenseService.update(this.expense);
clearForm();

View file

@ -105,9 +105,7 @@ public class PeopleView extends Div implements BeforeEnterObserver {
save.addClickListener(e -> {
try {
if (this.person == null) {
this.person = new Person();
}
if (this.person == null) this.person = new Person();
binder.writeBean(this.person);
personService.update(this.person);
clearForm();