From 8e755bb455802f22802a0ebd92a2a2f4b03aa4e6 Mon Sep 17 00:00:00 2001 From: filippo-ferrari Date: Thu, 23 May 2024 22:11:28 +0200 Subject: [PATCH] refactor: labels --- .../munera/views/expenses/ExpensesView.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 a5687f1..234d2c5 100644 --- a/src/main/java/com/application/munera/views/expenses/ExpensesView.java +++ b/src/main/java/com/application/munera/views/expenses/ExpensesView.java @@ -41,7 +41,7 @@ import java.util.Optional; public class ExpensesView extends Div implements BeforeEnterObserver { private final String EXPENSE_ID = "ExpenseID"; - private final String SAMPLEPERSON_EDIT_ROUTE_TEMPLATE = "/%s/edit"; + private final String EXPENSE_EDIT_ROUTE_TEMPLATE = "/%s/edit"; private final Grid grid = new Grid<>(Expense.class, false); @@ -93,7 +93,7 @@ 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(SAMPLEPERSON_EDIT_ROUTE_TEMPLATE, event.getValue().getId())); + UI.getCurrent().navigate(String.format(EXPENSE_EDIT_ROUTE_TEMPLATE, event.getValue().getId())); } else { clearForm(); UI.getCurrent().navigate(ExpensesView.class); @@ -138,9 +138,9 @@ public class ExpensesView extends Div implements BeforeEnterObserver { public void beforeEnter(BeforeEnterEvent event) { Optional expenseId = event.getRouteParameters().get(EXPENSE_ID).map(Long::parseLong); if (expenseId.isPresent()) { - Optional samplePersonFromBackend = expenseService.get(expenseId.get()); - if (samplePersonFromBackend.isPresent()) { - populateForm(samplePersonFromBackend.get()); + Optional expenseFromBackend = expenseService.get(expenseId.get()); + if (expenseFromBackend.isPresent()) { + populateForm(expenseFromBackend.get()); } else { Notification.show( String.format("The requested samplePerson was not found, ID = %s", expenseId.get()), 3000,