private MenuItem checkIDMenuItem(Long id) { MenuItemDAO menuDAO = new MenuItemDAO(); Collection<MenuItem> menuItemCollection = menuDAO.loadAll(); for (MenuItem menuItem : menuItemCollection) { if (menuItem.getId() == id) { return menuItem; } } return null; }
private Panel addPanelMenu(Menu menu) { panel = new Panel(); initComponents(); for (int i = 1; i <= NUMBER_OF_SERVICE_DAYS; i++) { weekdayLabel = new Label(Weekday.getWeekday(i).toString()); gridLayout.addComponent(locateLayoutWeek(weekdayLabel)); for (MenuItem menuItem : menu.getItems().get(Weekday.getWeekday(i))) { ShowDayMenusPanel showDayMenusPanel = new ShowDayMenusPanel(menuItem.getDescription(), menuItem.getCost()); showDayMenusPanel.setId(menuItem.getId()); showDayMenusPanel.setWeekday(menuItem.getWeekday()); currentWeekMenusPanels.add(showDayMenusPanel); gridLayout.addComponent(showDayMenusPanel); panel.addComponent(gridLayout); } } return panel; }