From c70ea1c76c997e0898fdc7ef48be64ae3192a8ea Mon Sep 17 00:00:00 2001 From: effe Date: Sun, 15 Sep 2024 16:27:03 -0400 Subject: [PATCH] refactoring: ExpensesView --- .../java/com/application/munera/services/ViewsService.java | 1 - .../com/application/munera/views/expenses/ExpensesView.java | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/application/munera/services/ViewsService.java b/src/main/java/com/application/munera/services/ViewsService.java index cb16f65..bc375bf 100644 --- a/src/main/java/com/application/munera/services/ViewsService.java +++ b/src/main/java/com/application/munera/services/ViewsService.java @@ -65,7 +65,6 @@ public class ViewsService { case CREDIT -> isPaid ? BadgeMessage.PAID_TO_ME : BadgeMessage.OWED_TO_ME; case DEBIT -> isPaid ? BadgeMessage.PAID_BY_ME : BadgeMessage.OWED_BY_ME; case NONE -> isPaid ? BadgeMessage.PAID : BadgeMessage.NOT_PAID; - default -> BadgeMessage.UNKNOWN; }; } } 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 fd48fd3..99b3126 100644 --- a/src/main/java/com/application/munera/views/expenses/ExpensesView.java +++ b/src/main/java/com/application/munera/views/expenses/ExpensesView.java @@ -134,14 +134,12 @@ public class ExpensesView extends Div implements BeforeEnterObserver { } }); - // Configure Form - binder = new BeanValidationBinder<>(Expense.class); // Bind fields. This is where you'd define e.g. validation rules + binder = new BeanValidationBinder<>(Expense.class); binder.bindInstanceFields(this); binder.forField(name) .asRequired("Name is required") .bind(Expense::getName, Expense::setName); - binder.forField(cost) .asRequired("Cost is required") .withConverter(new StringToBigDecimalConverter("Invalid cost")) @@ -150,7 +148,6 @@ public class ExpensesView extends Div implements BeforeEnterObserver { binder.forField(category) .asRequired("Category is required") .bind(Expense::getCategory, Expense::setCategory); - binder.forField(date) .asRequired("Date is required") .bind(Expense::getDate, Expense::setDate);