diff --git a/src/main/java/com/application/munera/views/expenses/ExpensesView.java b/src/main/java/com/application/munera/views/expenses/ExpensesView.java index b02b8d1..98ffbb3 100644 --- a/src/main/java/com/application/munera/views/expenses/ExpensesView.java +++ b/src/main/java/com/application/munera/views/expenses/ExpensesView.java @@ -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(); @@ -306,4 +303,4 @@ public class ExpensesView extends Div implements BeforeEnterObserver { } return badge; } -} +} \ No newline at end of file diff --git a/src/main/java/com/application/munera/views/people/PeopleView.java b/src/main/java/com/application/munera/views/people/PeopleView.java index 3032b9e..99f6b0e 100644 --- a/src/main/java/com/application/munera/views/people/PeopleView.java +++ b/src/main/java/com/application/munera/views/people/PeopleView.java @@ -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();