@Override protected void updateView() { MenuItemModifierGroup modifierGroup = (MenuItemModifierGroup) getBean(); if (modifierGroup == null) return; if (modifierGroup.getId() != null) { cbModifierGroups.setSelectedItem(modifierGroup.getModifierGroup()); } tfMinQuantity.setText(String.valueOf(modifierGroup.getMinQuantity())); tfMaxQuantity.setText(String.valueOf(modifierGroup.getMaxQuantity())); }
@Override public void doGoBack() { List<MenuItemModifierGroup> menuItemModifierGroups = parentMenuItem.getMenuItemModiferGroups(); List<TicketItemModifierGroup> ticketItemModifierGroups = parentTicketItem.getTicketItemModifierGroups(); boolean requiredModifierAdded = true; if (menuItemModifierGroups != null) { outer: for (MenuItemModifierGroup menuItemModifierGroup : menuItemModifierGroups) { int minQuantity = menuItemModifierGroup.getMinQuantity(); if (minQuantity == 0) continue; if (ticketItemModifierGroups == null) { requiredModifierAdded = false; break outer; } for (TicketItemModifierGroup ticketItemModifierGroup : ticketItemModifierGroups) { if (ticketItemModifierGroup.countItems(false) < minQuantity) { requiredModifierAdded = false; break outer; } } } } if (!requiredModifierAdded) { int option = JOptionPane.showConfirmDialog( this, "Some required modifiers are not added, do you really want to go back?", "Confirm", JOptionPane.YES_NO_OPTION); if (option != JOptionPane.YES_OPTION) { return; } } fireModifierSelectionFinished(); }