⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productseditor.java

📁 是一个专门设计用于触摸屏的POS(point of sales)应用软件
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        m_jmargin.setEnabled(true);        m_jImage.setEnabled(true);        m_jstocksecurity.setEnabled(true);        m_jstockmaximum.setEnabled(true);        m_jstockcost.setEnabled(true);        m_jstockvolume.setEnabled(true);        m_jInCatalog.setEnabled(true);        m_jCatalogOrder.setEnabled(m_jInCatalog.isSelected());                try {            m_jproductscom.setModel(new MyListData(m_sentcoms.getProductComments2((String) myprod[0])));        } catch (BasicException e) {            e.printStackTrace();        }                      TaxInfo tax = (TaxInfo) m_TaxModel.getElementByKey(myprod[8]);        double dTaxRate = (tax == null) ? 0.0 : tax.getRate();           writeReport((Double) myprod[5], dTaxRate);    }    public Object createValue() throws BasicException {                Object[] myprod = new Object[14];        myprod[0] = m_jRef.getText();        myprod[1] = m_jCode.getText();        myprod[2] = m_jName.getText();        myprod[3] = new Boolean(m_jComment.isSelected());        myprod[4] = new Boolean(m_jScale.isSelected());        myprod[5] = Formats.CURRENCY.parseValue(m_jPriceBuy.getText());        myprod[6] = m_dPriceSell; // Formats.CURRENCY.parseValue(m_jPriceSell.getText());        myprod[7] = m_CategoryModel.getSelectedKey();        myprod[8] = m_TaxModel.getSelectedKey();        myprod[9] = m_jImage.getImage();//        myprod[10] = Formats.DOUBLE.parseValue(m_jstocksecurity.getText());//        myprod[11] = Formats.DOUBLE.parseValue(m_jstockmaximum.getText());        myprod[10] = Formats.CURRENCY.parseValue(m_jstockcost.getText());        myprod[11] = Formats.DOUBLE.parseValue(m_jstockvolume.getText());        myprod[12] = new Boolean(m_jInCatalog.isSelected());               myprod[13] = Formats.INT.parseValue(m_jCatalogOrder.getText());;               return myprod;    }            public DirtyManager getDirtyManager() {        return m_Dirty;    }    private void writeReport() {        Double dPriceBuy = readCurrency(m_jPriceBuy.getText());        TaxInfo tax = (TaxInfo) m_TaxModel.getSelectedItem();        double dTaxRate = (tax == null) ? 0.0 : tax.getRate();          writeReport(dPriceBuy, dTaxRate);    }        private void writePriceTax() {                Double dPriceSellTax = readCurrency(m_jPriceSellTax.getText());          TaxInfo tax = (TaxInfo) m_TaxModel.getSelectedItem();        double dTaxRate = (tax == null) ? 0.0 : tax.getRate();          if (dPriceSellTax == null) {            m_dPriceSell = null;        } else {            m_dPriceSell = new Double(dPriceSellTax.doubleValue() / (1.0 + dTaxRate));        }        m_bPriceSellLock = true;        m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));                    m_bPriceSellLock = false;        m_bPriceSellTaxWriteLock = true;        writeReport();        m_bPriceSellTaxWriteLock = false;    }        private void writeMargin() {                Double dPriceBuy = readCurrency(m_jPriceBuy.getText());        Double dMargin = readPercent(m_jmargin.getText());          if (dMargin == null || dPriceBuy == null) {            m_dPriceSell = dPriceBuy;        } else {            m_dPriceSell = new Double(dPriceBuy.doubleValue() * (1.0 + dMargin.doubleValue()));        }        m_bPriceSellLock = true;        m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));                    m_bPriceSellLock = false;        m_bMarginWriteLock = true;        writeReport();        m_bMarginWriteLock = false;    }        private boolean m_bPriceSellLock = false;    private boolean m_bMarginLock = false;    private boolean m_bPriceSellTaxLock = false;        private boolean m_bMarginWriteLock = false;    private boolean m_bPriceSellTaxWriteLock = false;        // private void writeReport(Double dPriceBuy, double dTaxRate, Double dStockSecurity, Double dStockCost, Double dStockVolume) {    private void writeReport(Double dPriceBuy, double dTaxRate) {                       if (!m_bPriceSellTaxWriteLock) {             m_bPriceSellTaxLock = true;            if (m_dPriceSell == null) {                m_jPriceSellTax.setText(null);            } else {                m_jPriceSellTax.setText(Formats.CURRENCY.formatValue(new Double(m_dPriceSell.doubleValue() * (1.0 + dTaxRate))));            }                  m_bPriceSellTaxLock = false;        }        if (!m_bMarginWriteLock) {            m_bMarginLock = true;            if (dPriceBuy == null || m_dPriceSell == null) {                m_jmargin.setText(null);            } else {                m_jmargin.setText(Formats.PERCENT.formatValue(new Double(m_dPriceSell.doubleValue() / dPriceBuy.doubleValue() - 1.0)));            }            m_bMarginLock = false;        }       //        if (m_dUnits == null) {//            m_junits.setText(null);//            m_junits.setForeground(UIManager.getDefaults().getColor("TextField.foreground"));//            m_jvaluecost.setText(null);//            m_jvaluevolume.setText(null);//            m_jvaluebuy.setText(null);//            m_jvaluesell.setText(null);//        } else {//            m_junits.setText(Formats.DOUBLE.formatValue(m_dUnits));//            if (dStockSecurity == null) {//                m_junits.setForeground(UIManager.getDefaults().getColor("TextField.foreground"));//            } else {//                m_junits.setForeground(m_dUnits.doubleValue() >= dStockSecurity.doubleValue() ? UIManager.getDefaults().getColor("TextField.foreground") : Color.RED);//            }//            m_jvaluecost.setText(dStockCost == null ? null : Formats.CURRENCY.formatValue(new Double(m_dUnits.doubleValue() * dStockCost.doubleValue())));//            m_jvaluevolume.setText(dStockVolume == null ? null : Formats.DOUBLE.formatValue(new Double(m_dUnits.doubleValue() * dStockVolume.doubleValue())));//            m_jvaluebuy.setText(dPriceBuy == null ? null : Formats.CURRENCY.formatValue(new Double(m_dUnits.doubleValue() * dPriceBuy.doubleValue())));//            m_jvaluesell.setText(m_dPriceSell == null ? null : Formats.CURRENCY.formatValue(new Double(m_dUnits.doubleValue() * m_dPriceSell.doubleValue())));//        }    }        private class ReportManager implements DocumentListener, ActionListener {        public void changedUpdate(DocumentEvent e) {            writeReport();        }        public void insertUpdate(DocumentEvent e) {            writeReport();        }            public void removeUpdate(DocumentEvent e) {            writeReport();        }                 public void actionPerformed(ActionEvent e) {            writeReport();        }    }        private class PriceManager implements DocumentListener  {        public void changedUpdate(DocumentEvent e) {            if (!m_bPriceSellLock) { // veo si puedo tocar m_jPriceSell                m_dPriceSell = readCurrency(m_jPriceSell.getText());                writeReport();            }        }        public void insertUpdate(DocumentEvent e) {            if (!m_bPriceSellLock) { // veo si puedo tocar m_jPriceSell                m_dPriceSell = readCurrency(m_jPriceSell.getText());                writeReport();            }        }            public void removeUpdate(DocumentEvent e) {            if (!m_bPriceSellLock) { // veo si puedo tocar m_jPriceSell                m_dPriceSell = readCurrency(m_jPriceSell.getText());                writeReport();            }        }             }        private class PriceTaxManager implements DocumentListener {        public void changedUpdate(DocumentEvent e) {            if (!m_bPriceSellTaxLock) {                writePriceTax();            }        }        public void insertUpdate(DocumentEvent e) {            if (!m_bPriceSellTaxLock) {                writePriceTax();            }        }            public void removeUpdate(DocumentEvent e) {            if (!m_bPriceSellTaxLock) {                writePriceTax();            }        }             }        private class MarginManager implements DocumentListener  {        public void changedUpdate(DocumentEvent e) {            if (!m_bMarginLock) {                writeMargin();            }        }        public void insertUpdate(DocumentEvent e) {            if (!m_bMarginLock) {                writeMargin();            }        }            public void removeUpdate(DocumentEvent e) {            if (!m_bMarginLock) {                writeMargin();            }        }             }        private final static Double readCurrency(String sValue) {        try {            return (Double) Formats.CURRENCY.parseValue(sValue);        } catch (BasicException e) {            return null;        }    }        private final static Double readDouble(String sValue) {        try {            return (Double) Formats.DOUBLE.parseValue(sValue);        } catch (BasicException e) {            return null;        }    }        private final static Double readPercent(String sValue) {        try {            return (Double) Formats.PERCENT.parseValue(sValue);        } catch (BasicException e) {            return null;        }    }    private static class MyListData extends javax.swing.AbstractListModel {                private java.util.List m_data;                public MyListData(java.util.List data) {            m_data = data;        }                public Object getElementAt(int index) {            return m_data.get(index);        }                public int getSize() {            return m_data.size();        }     }         /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents    private void initComponents() {        jLabel1 = new javax.swing.JLabel();        jLabel2 = new javax.swing.JLabel();        m_jRef = new javax.swing.JTextField();        m_jName = new javax.swing.JTextField();        m_jTitle = new javax.swing.JLabel();        jTabbedPane1 = new javax.swing.JTabbedPane();        jPanel1 = new javax.swing.JPanel();        jLabel6 = new javax.swing.JLabel();        m_jCode = new javax.swing.JTextField();        m_jImage = new net.adrianromero.data.gui.JImageEditor();        jLabel3 = new javax.swing.JLabel();        m_jPriceBuy = new javax.swing.JTextField();        jLabel4 = new javax.swing.JLabel();        m_jPriceSell = new javax.swing.JTextField();        jLabel5 = new javax.swing.JLabel();        m_jCategory = new javax.swing.JComboBox();        jLabel7 = new javax.swing.JLabel();        m_jTax = new javax.swing.JComboBox();        m_jmargin = new javax.swing.JTextField();        m_jPriceSellTax = new javax.swing.JTextField();        jLabel16 = new javax.swing.JLabel();        m_jCodetype = new javax.swing.JComboBox();        jPanel2 = new javax.swing.JPanel();        jLabel9 = new javax.swing.JLabel();        m_jstockcost = new javax.swing.JTextField();        jLabel10 = new javax.swing.JLabel();        m_jstockvolume = new javax.swing.JTextField();        m_jpanStock = new javax.swing.JPanel();        jPanel4 = new javax.swing.JPanel();        m_jComment = new javax.swing.JCheckBox();        m_jScale = new javax.swing.JCheckBox();        m_jInCatalog = new javax.swing.JCheckBox();        jLabel18 = new javax.swing.JLabel();        m_jCatalogOrder = new javax.swing.JTextField();        jPanel3 = new javax.swing.JPanel();        jScrollPane1 = new javax.swing.JScrollPane();        m_jproductscom = new javax.swing.JList();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -