private synchronized void updateTicketView() { try { viewUpdateTimer.stop(); List<KitchenTicket> list = KitchenTicketDAO.getInstance().findAllOpen(); for (KitchenTicket kitchenTicket : list) { addTicket(kitchenTicket, false); } // ticketPanel.updateView(); ticketPanel.repaint(); } catch (Exception e2) { POSMessageDialog.showError(this, e2.getMessage(), e2); } finally { viewUpdateTimer.restart(); } }
private synchronized void addTicket(KitchenTicket ticket, boolean updateView) { if (!isShowing()) return; Printer selectedPrinter = (Printer) cbPrinters.getSelectedItem(); if (selectedPrinter != null && !selectedPrinter.equals(ticket.getPrinters())) { return; } OrderType selectedTicketType = (OrderType) cbTicketTypes.getSelectedItem(); if (selectedTicketType != null && selectedTicketType != ticket.getType()) { return; } if (ticketPanel.addTicket(ticket)) { if (updateView) { // ticketPanel.revalidate(); ticketPanel.repaint(); } } }