refactor
This commit is contained in:
parent
0fc5b07f5e
commit
4d36b7dca2
2 changed files with 5 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue