📄 jrefundlines.java
字号:
// Tina POS is a point of sales application designed for touch screens.// Copyright (C) 2005 Adrian Romero Corchado.// http://sourceforge.net/projects/tinapos//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USApackage net.adrianromero.tpv.panelsales;import java.awt.BorderLayout;import java.awt.Toolkit;import java.util.List;import net.adrianromero.tpv.forms.AppLocal;import net.adrianromero.tpv.forms.AppView;import net.adrianromero.tpv.ticket.TicketLineInfo;public class JRefundLines extends javax.swing.JPanel { private JTicketLines ticketlines; private List m_aLines; private JPanelTicketEdits m_jTicketEdit; /** Creates new form JRefundLines */ public JRefundLines(AppView oApp, JPanelTicketEdits jTicketEdit) { m_jTicketEdit = jTicketEdit; initComponents(); ticketlines = new JTicketLines(oApp); //ticketlines.setPreferredSize(new java.awt.Dimension(15, 200)); add(ticketlines, BorderLayout.CENTER); } public void setLines(List aRefundLines) { m_aLines = aRefundLines; ticketlines.clearTicketLines(); if (m_aLines != null) { for (int i = 0; i < m_aLines.size(); i++) { ticketlines.addTicketLine((TicketLineInfo) m_aLines.get(i)); } } } // protected void fireSelectedLineUnit() {// // int index = ticketlines.getSelectedIndex();// if (index >= 0) {// ProductOutInfo oLine = (ProductOutInfo) m_aLines.get(index);// if (oLine.getMultiply() < -1.0)// ProductOutInfo// // // EventListener[] l = listeners.getListeners(ActionListener.class);// ActionEvent e = null;// for (int i = 0; i < l.length; i++) {// if (e == null) {// e = new ActionEvent(, ActionEvent.ACTION_PERFORMED, "ADDLINE");// }// ((ActionListener) l[i]).actionPerformed(e); // }// // Y ahora la borro// m_aLines.remove(index);// ticketlines.removeTicketLine(index);// } // } /** 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() { jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); m_jbtnAddOne = new javax.swing.JButton(); m_jbtnAddLine = new javax.swing.JButton(); m_jbtnAddAll = new javax.swing.JButton(); setLayout(new java.awt.BorderLayout()); setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(5, 5, 5, 5))); setPreferredSize(new java.awt.Dimension(15, 200)); jPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(0, 5, 0, 0))); jPanel2.setLayout(new java.awt.GridLayout(0, 1, 0, 5)); m_jbtnAddOne.setText(AppLocal.getIntString("button.refundone")); m_jbtnAddOne.setFocusPainted(false); m_jbtnAddOne.setFocusable(false); m_jbtnAddOne.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jbtnAddOne.setRequestFocusEnabled(false); m_jbtnAddOne.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jbtnAddOneActionPerformed(evt); } }); jPanel2.add(m_jbtnAddOne); m_jbtnAddLine.setText(AppLocal.getIntString("button.refundline")); m_jbtnAddLine.setFocusPainted(false); m_jbtnAddLine.setFocusable(false); m_jbtnAddLine.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jbtnAddLine.setRequestFocusEnabled(false); m_jbtnAddLine.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jbtnAddLineActionPerformed(evt); } }); jPanel2.add(m_jbtnAddLine); m_jbtnAddAll.setText(AppLocal.getIntString("button.refundall")); m_jbtnAddAll.setFocusPainted(false); m_jbtnAddAll.setFocusable(false); m_jbtnAddAll.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jbtnAddAll.setRequestFocusEnabled(false); m_jbtnAddAll.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jbtnAddAllActionPerformed(evt); } }); jPanel2.add(m_jbtnAddAll); jPanel1.add(jPanel2, java.awt.BorderLayout.NORTH); add(jPanel1, java.awt.BorderLayout.EAST); } // </editor-fold>//GEN-END:initComponents private void m_jbtnAddAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddAllActionPerformed for (int i = 0; i < m_aLines.size(); i++) { TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(i); TicketLineInfo oNewLine = new TicketLineInfo(oLine); oNewLine.setMultiply(-oLine.getMultiply()); m_jTicketEdit.addTicketLine(oNewLine); } }//GEN-LAST:event_m_jbtnAddAllActionPerformed private void m_jbtnAddOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddOneActionPerformed int index = ticketlines.getSelectedIndex(); if (index >= 0) { TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(index); TicketLineInfo oNewLine = new TicketLineInfo(oLine); oNewLine.setMultiply(-1.0); m_jTicketEdit.addTicketLine(oNewLine); } }//GEN-LAST:event_m_jbtnAddOneActionPerformed private void m_jbtnAddLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddLineActionPerformed int index = ticketlines.getSelectedIndex(); if (index >= 0) { TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(index); TicketLineInfo oNewLine = new TicketLineInfo(oLine); oNewLine.setMultiply(-oLine.getMultiply()); m_jTicketEdit.addTicketLine(oNewLine); } }//GEN-LAST:event_m_jbtnAddLineActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JButton m_jbtnAddAll; private javax.swing.JButton m_jbtnAddLine; private javax.swing.JButton m_jbtnAddOne; // End of variables declaration//GEN-END:variables }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -