public void setMenuItem(MenuItem menuItem, TicketItem ticketItem) { this.parentMenuItem = menuItem; this.parentTicketItem = ticketItem; reset(); // MenuItemDAO dao = new MenuItemDAO(); try { List<MenuItemModifierGroup> menuItemModifierGroups = menuItem.getMenuItemModiferGroups(); for (Iterator<MenuItemModifierGroup> iter = menuItemModifierGroups.iterator(); iter.hasNext(); ) { MenuItemModifierGroup menuItemModifierGroup = iter.next(); MenuModifierGroup group = menuItemModifierGroup.getModifierGroup(); addSeparator(group.getName()); Set<MenuModifier> modifiers = group.getModifiers(); for (MenuModifier modifier : modifiers) { modifier.setMenuItemModifierGroup(menuItemModifierGroup); ModifierButton modifierButton = new ModifierButton(modifier); String key = modifier.getId() + "_" + modifier.getModifierGroup().getId(); buttonMap.put(key, modifierButton); addButton(modifierButton); } } revalidate(); updateVisualRepresentation(); } catch (PosException e) { POSMessageDialog.showError(this, "An error has occured", e); } }
@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())); }