List of usage examples for java.awt List clear
@Deprecated public synchronized void clear()
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
private void printTicketGeneric(String sresourcename, RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = null; java.util.List<TicketLineConstructor> startallLines = new ArrayList<TicketLineConstructor>(); int count = 0; com.openbravo.pos.printer.printer.ImageBillPrinter printer = new ImageBillPrinter(); if (sresourcename.equals("Printer.Bill")) { allLines = getAllLines(ticket, ticketext); } else if (sresourcename.equals("Printer.NonChargableBill")) { allLines = getNonChargeableLines(ticket, ticketext); }/*from w w w . ja v a 2 s . c o m*/ int divideLines = allLines.size() / 48; int remainder = allLines.size() % 48; int value = 48; int k = 0; if (divideLines > 0) { for (int i = 0; i < divideLines; i++) { for (int j = k; j < value; j++) { startallLines.add(new TicketLineConstructor(allLines.get(j).getLine())); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } if (allLines.size() > 48) { try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannaPrintcontinue"), AppLocal.getIntString("message.title"), JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.OK_OPTION) { k = value; value = value + 48; startallLines = new ArrayList<TicketLineConstructor>(); startallLines.clear(); } else { break; } } } } if (remainder > 0) { startallLines = new ArrayList<TicketLineConstructor>(); startallLines.clear(); for (int m = k; m < k + remainder; m++) { startallLines.add(new TicketLineConstructor(allLines.get(m).getLine())); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private void printTicketGeneric(String sresourcename, RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = null; java.util.List<TicketLineConstructor> startallLines = new ArrayList<TicketLineConstructor>(); int count = 0; com.openbravo.pos.printer.printer.ImageBillPrinter printer = new ImageBillPrinter(); if (sresourcename.equals("Printer.Bill")) { allLines = getAllLines(ticket, ticketext); } else if (sresourcename.equals("Printer.NonChargableBill")) { allLines = getNonChargeableLines(ticket, ticketext); }/*from w w w . j a va 2s . c om*/ //try { //printer.print(allLines); // try { int divideLines = allLines.size() / 48; int remainder = allLines.size() % 48; System.out.println("divideLines---" + divideLines + "--" + remainder); int value = 48; int k = 0; if (divideLines > 0) { for (int i = 0; i < divideLines; i++) { for (int j = k; j < value; j++) { startallLines.add(new TicketLineConstructor(allLines.get(j).getLine())); System.out.println("allLines.get(j).getLine()--" + allLines.get(j).getLine()); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } if (allLines.size() > 48) { try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannaPrintcontinue"), AppLocal.getIntString("message.title"), JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.OK_OPTION) { k = value; value = value + 48; startallLines = new ArrayList<TicketLineConstructor>(); System.out.println("startallLinest--" + startallLines.size()); startallLines.clear(); } else { break; } } } } System.out.println("value---" + value + k + "--" + remainder); if (remainder > 0) { startallLines = new ArrayList<TicketLineConstructor>(); System.out.println("startallLinest--" + startallLines.size()); startallLines.clear(); for (int m = k; m < k + remainder; m++) { startallLines.add(new TicketLineConstructor(allLines.get(m).getLine())); System.out.println("allLines.get(j).getLine()--" + allLines.get(m).getLine()); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } } // try { // printer.print(allLines); // // } catch (PrinterException ex) { // Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex); // } }