refactor: change service name
This commit is contained in:
parent
02a4e944a2
commit
f15b35295d
3 changed files with 12 additions and 12 deletions
|
@ -9,11 +9,11 @@ import org.springframework.stereotype.Service;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ServiceView {
|
public class ViewsService {
|
||||||
|
|
||||||
private final ExpenseService expenseService;
|
private final ExpenseService expenseService;
|
||||||
|
|
||||||
public ServiceView(ExpenseService expenseService) {
|
public ViewsService(ExpenseService expenseService) {
|
||||||
this.expenseService = expenseService;
|
this.expenseService = expenseService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
|
||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
private final PersonService personService;
|
private final PersonService personService;
|
||||||
private final EventService eventService;
|
private final EventService eventService;
|
||||||
private final ServiceView serviceView;
|
private final ViewsService viewsService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private TextField name;
|
private TextField name;
|
||||||
private TextField cost;
|
private TextField cost;
|
||||||
|
@ -75,12 +75,12 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
|
||||||
private ComboBox<Event> event;
|
private ComboBox<Event> event;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ExpensesView(ExpenseService expenseService, CategoryService categoryService, PersonService personService, EventService eventService, ServiceView serviceView, UserService userService) {
|
public ExpensesView(ExpenseService expenseService, CategoryService categoryService, PersonService personService, EventService eventService, ViewsService viewsService, UserService userService) {
|
||||||
this.expenseService = expenseService;
|
this.expenseService = expenseService;
|
||||||
this.categoryService = categoryService;
|
this.categoryService = categoryService;
|
||||||
this.personService = personService;
|
this.personService = personService;
|
||||||
this.eventService = eventService;
|
this.eventService = eventService;
|
||||||
this.serviceView = serviceView;
|
this.viewsService = viewsService;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
addClassNames("expenses-view");
|
addClassNames("expenses-view");
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
|
||||||
grid.addColumn(Expense::getPeriodUnit).setHeader("Period Unit").setSortable(true);
|
grid.addColumn(Expense::getPeriodUnit).setHeader("Period Unit").setSortable(true);
|
||||||
grid.addColumn(Expense::getDate).setHeader("Date").setSortable(true).setSortProperty("date");
|
grid.addColumn(Expense::getDate).setHeader("Date").setSortable(true).setSortProperty("date");
|
||||||
// grid.addColumn(expenseEvent -> expenseEvent.getEvent().getName()).setHeader("Event").setSortable(true);
|
// grid.addColumn(expenseEvent -> expenseEvent.getEvent().getName()).setHeader("Event").setSortable(true);
|
||||||
grid.addColumn(new ComponentRenderer<>(this.serviceView::createExpenseBadge)).setHeader("Status").setSortable(true);
|
grid.addColumn(new ComponentRenderer<>(this.viewsService::createExpenseBadge)).setHeader("Status").setSortable(true);
|
||||||
grid.getColumns().forEach(col -> col.setAutoWidth(true));
|
grid.getColumns().forEach(col -> col.setAutoWidth(true));
|
||||||
|
|
||||||
grid.setItems(this.expenseService.findAllOrderByDateDescending());
|
grid.setItems(this.expenseService.findAllOrderByDateDescending());
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.application.munera.data.Expense;
|
||||||
import com.application.munera.data.Person;
|
import com.application.munera.data.Person;
|
||||||
import com.application.munera.services.ExpenseService;
|
import com.application.munera.services.ExpenseService;
|
||||||
import com.application.munera.services.PersonService;
|
import com.application.munera.services.PersonService;
|
||||||
import com.application.munera.services.ServiceView;
|
import com.application.munera.services.ViewsService;
|
||||||
import com.application.munera.views.MainLayout;
|
import com.application.munera.views.MainLayout;
|
||||||
import com.vaadin.flow.component.UI;
|
import com.vaadin.flow.component.UI;
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
|
@ -56,15 +56,15 @@ public class PeopleView extends Div implements BeforeEnterObserver {
|
||||||
private Person person;
|
private Person person;
|
||||||
private final PersonService personService;
|
private final PersonService personService;
|
||||||
private final ExpenseService expenseService;
|
private final ExpenseService expenseService;
|
||||||
private final ServiceView serviceView;
|
private final ViewsService viewsService;
|
||||||
private TextField firstName;
|
private TextField firstName;
|
||||||
private TextField lastName;
|
private TextField lastName;
|
||||||
private EmailField email;
|
private EmailField email;
|
||||||
|
|
||||||
public PeopleView(PersonService personService, ExpenseService expenseService, ServiceView serviceView) {
|
public PeopleView(PersonService personService, ExpenseService expenseService, ViewsService viewsService) {
|
||||||
this.personService = personService;
|
this.personService = personService;
|
||||||
this.expenseService = expenseService;
|
this.expenseService = expenseService;
|
||||||
this.serviceView = serviceView;
|
this.viewsService = viewsService;
|
||||||
addClassNames("expenses-view");
|
addClassNames("expenses-view");
|
||||||
|
|
||||||
// Create UI
|
// Create UI
|
||||||
|
@ -79,8 +79,8 @@ public class PeopleView extends Div implements BeforeEnterObserver {
|
||||||
grid.addHierarchyColumn(this::getNodeName).setHeader("Name");
|
grid.addHierarchyColumn(this::getNodeName).setHeader("Name");
|
||||||
grid.addColumn(this::getNodeCost).setHeader("Total Expenses Value").setSortable(true);
|
grid.addColumn(this::getNodeCost).setHeader("Total Expenses Value").setSortable(true);
|
||||||
grid.addColumn(new ComponentRenderer<>(persona -> {
|
grid.addColumn(new ComponentRenderer<>(persona -> {
|
||||||
if (persona instanceof Person) return this.serviceView.createPersonBadge(personService.calculateNetBalance((Person) persona));
|
if (persona instanceof Person) return this.viewsService.createPersonBadge(personService.calculateNetBalance((Person) persona));
|
||||||
else return this.serviceView.createExpenseBadge(((Expense) persona));
|
else return this.viewsService.createExpenseBadge(((Expense) persona));
|
||||||
})).setHeader("Balance Status");
|
})).setHeader("Balance Status");
|
||||||
|
|
||||||
grid.addColumn(new ComponentRenderer<>(persona -> {
|
grid.addColumn(new ComponentRenderer<>(persona -> {
|
||||||
|
|
Loading…
Reference in a new issue