Example usage for java.util.logging SimpleFormatter SimpleFormatter

List of usage examples for java.util.logging SimpleFormatter SimpleFormatter

Introduction

In this page you can find the example usage for java.util.logging SimpleFormatter SimpleFormatter.

Prototype

SimpleFormatter

Source Link

Usage

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

public void init(AppView app) throws BeanFactoryException {
    m_App = app;/*from  w w w . java  2  s.  c  om*/
    dlSystem = (DataLogicSystem) m_App.getBean("com.openbravo.pos.forms.DataLogicSystem");
    dlSales = (DataLogicSales) m_App.getBean("com.openbravo.pos.forms.DataLogicSales");
    dlCustomers = (DataLogicCustomers) m_App.getBean("com.openbravo.pos.customers.DataLogicCustomers");
    dlReceipts = (DataLogicReceipts) m_App.getBean("com.openbravo.pos.sales.DataLogicReceipts");

    // borramos el boton de bascula si no hay bascula conectada
    if (!m_App.getDeviceScale().existsScale()) {
        //            m_jbtnScale.setVisible(false);
    }
    if (m_App.getProperties().getProperty("machine.ticketsbag").equals("restaurant")) {
        m_jbtnPrintBill.setVisible(true);
    } else {
        m_jbtnPrintBill.setVisible(false);
        // jPanel1.setPreferredSize(new java.awt.Dimension(282, 47));
    }
    customerFocus();
    menuStatus = m_App.getProperties().getProperty("machine.menustatus");
    //setPrinterStatus(false);
    m_jPor.setVisible(false);
    m_ticketsbag = getJTicketsBag();
    //m_oTicket.setSplitValue("");
    m_oTicket.setCancelTicket(false);
    System.out.println("init----m_oTicket.getCancelTicket()--" + m_oTicket.getCancelTicket());
    m_jPanelBag.add(m_ticketsbag.getBagComponent(), BorderLayout.LINE_START);

    add(m_ticketsbag.getNullComponent(), "null");

    m_ticketlines = new JRetailTicketLines(dlSystem.getResourceAsXML("Ticket.Line"));
    m_jPanelCentral.add(m_ticketlines, java.awt.BorderLayout.CENTER);

    m_TTP = new TicketParser(m_App.getDeviceTicket(), dlSystem);

    // Los botones configurables...
    m_jbtnconfig = new JRetailPanelTakeAwayButtons("Ticket.Buttons", this);
    m_jButtonsExt.add(m_jbtnconfig);

    // El panel de los productos o de las lineas...        
    catcontainer.add(getSouthComponent(), BorderLayout.CENTER);
    catcontainer.setVisible(true);
    m_jCalculatePromotion.setVisible(false);
    // El modelo de impuestos
    senttax = dlSales.getRetailTaxList();
    sentcharge = dlSales.getRetailServiceChargeList();
    senttaxcategories = dlSales.getTaxCategoriesList();
    sentsertax = dlSales.getRetailServiceTaxList();
    sentsbtax = dlSales.getRetailSwachBharatTaxList();
    taxcategoriesmodel = new ComboBoxValModel();

    // ponemos a cero el estado
    stateToZero();

    //creating log file for kot
    String logpath = m_App.getProperties().getProperty("machine.kotlogfile");
    logpath = logpath + getLogDate() + "-POS" + m_App.getProperties().getPosNo() + ".txt";
    try {
        fh1 = new FileHandler(logpath, true);
    } catch (IOException ex) {
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SecurityException ex) {
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    }
    kotlogger.addHandler(fh1);
    SimpleFormatter formatter = new SimpleFormatter();
    fh1.setFormatter(formatter);

    //creating log file for print bill

    logpath = m_App.getProperties().getProperty("machine.printlogfile");
    logpath = logpath + getLogDate() + "-POS" + m_App.getProperties().getPosNo() + ".txt";
    try {
        fh2 = new FileHandler(logpath, true);
    } catch (IOException ex) {
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SecurityException ex) {
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    }
    printlogger.addHandler(fh2);
    fh2.setFormatter(formatter);

    //creating log file for settle bill
    logpath = m_App.getProperties().getProperty("machine.settlelogfile");
    logpath = logpath + getLogDate() + "-POS" + m_App.getProperties().getPosNo() + ".txt";
    try {
        fh3 = new FileHandler(logpath, true);
    } catch (IOException ex) {
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SecurityException ex) {
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    }
    settlelogger.addHandler(fh3);
    fh3.setFormatter(formatter);

    //       m_jCash.getDocument().addDocumentListener(new DocumentListener() {
    //         public void changedUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void removeUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void insertUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //
    //
    //    });
    //        m_jCard.getDocument().addDocumentListener(new DocumentListener() {
    //         public void changedUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void removeUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void insertUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //
    //
    //    });
    //        m_jCheque.getDocument().addDocumentListener(new DocumentListener() {
    //         public void changedUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void removeUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void insertUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //
    //
    //    });
    //    m_jFoodCoupon.getDocument().addDocumentListener(new DocumentListener() {
    //         public void changedUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void removeUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void insertUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //
    //
    //    });
    //    m_jVoucher.getDocument().addDocumentListener(new DocumentListener() {
    //         public void changedUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void removeUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void insertUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //
    //
    //    });
    //     m_jCreditAmount.getDocument().addDocumentListener(new DocumentListener() {
    //         public void changedUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void removeUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //         public void insertUpdate(DocumentEvent e) {
    //           setTenderAmount();
    //         }
    //
    //
    //    });
}