public Double getTotalExpenditure() { StatisticsblService sbs = BusinessLogicService.getStatisticsblService(); return sbs.getTotalExpenditure(paymentVOs); }
public RevenuePendingDialog(RevenuePendingTableModel tm, int modelRow, boolean isEditable) { revenueblService = BusinessLogicService.getRevenueblService(); this.revenuePendingTableModel = tm; JLabel[] labels = new JLabel[6]; for (int i = 0; i < labels.length; i++) { labels[i] = new JLabel("", JLabel.CENTER); labels[i].setText(LABEL_NAMES[i]); labels[i].setBounds(0, 10 + 35 * i, 100, 25); this.add(labels[i]); } textFields = new JTextField[2]; for (int i = 0; i < textFields.length; i++) { textFields[i] = new JTextField(); textFields[i].setBounds(100, 10 + 35 * i, 150, 25); textFields[i].setEnabled(false); this.add(textFields[i]); } JComboBox<String> organizationComboBox = new JComboBox<String>(); organizationComboBox.addItem("南京市栖霞区中转中心"); organizationComboBox.addItem("上海市浦东新区中转中心"); organizationComboBox.setBounds(100, 10 + 35 * 2, 180, 25); organizationComboBox.setEnabled(false); this.add(organizationComboBox); JTextField accountIdTextField = new JTextField(); accountIdTextField.setBounds(100, 10 + 35 * 3, 180, 25); this.add(accountIdTextField); RecentDatePickPanel datePickPanel = new RecentDatePickPanel(); datePickPanel.setBounds(100, 10 + 35 * 3, 200, 25); datePickPanel.setEnabled(false); this.add(datePickPanel); RevenueVO vo = revenuePendingTableModel.getRevenueVO(modelRow); textFields[0].setText(vo.getId()); textFields[1].setText(vo.getCourierId()); organizationComboBox.setSelectedItem(vo.getOrganization()); accountIdTextField.setText(vo.getAccountId()); datePickPanel.setDate(vo.getRevenueDate()); tableModel = new OrderTableModel(revenueblService, vo.getOrderId()); TableRowSorter<TableModel> tableSorter = new TableRowSorter<TableModel>(tableModel); JTable orderTable = new JTable(tableModel); PresentationUtil.fitTableColumns(orderTable); orderTable.getTableHeader().setPreferredSize(new Dimension(180, 25)); orderTable.setSize(250, 125); orderTable.setRowSorter(tableSorter); JScrollPane OrderScrollPane = new JScrollPane(orderTable); OrderScrollPane.setBounds(100, 10 + 35 * 4, 200, 125); this.add(OrderScrollPane); JLabel costLabel = new JLabel("", JLabel.CENTER); costLabel.setText("收款金额"); costLabel.setBounds(0, 25 + 35 * 7, 100, 25); this.add(costLabel); JTextField costTextField = new JTextField(); costTextField.setBounds(100, 25 + 35 * 7, 60, 25); costTextField.setEnabled(false); this.add(costTextField); costTextField.setText("" + vo.getRevenue()); JButton confirmButton = new JButton("确认"); confirmButton.setBounds(230, 320, 80, 30); confirmButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isEditable) { RevenuePendingDialog.this.dispose(); return; } vo.setAccountId(accountIdTextField.getText()); revenuePendingTableModel.modify(modelRow, vo); RevenuePendingDialog.this.dispose(); ScreenMessage.putOnScreen(ScreenMessage.SAVE_SUCCESS); } }); this.add(confirmButton); if (isEditable) { JButton cancleButton = new JButton("取消"); cancleButton.setBounds(140, 320, 80, 30); cancleButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { RevenuePendingDialog.this.dispose(); } }); this.add(cancleButton); } if (!isEditable) { accountIdTextField.setEnabled(false); } this.setSize(340, 400); this.setLayout(new DialogLayoutManager()); this.setLocationRelativeTo(MainFrame.getMainFrame()); this.setTitle("收款单"); this.setModalityType(ModalityType.APPLICATION_MODAL); this.setVisible(true); }
public ModifyPasswordDialog() { // TODO Auto-generated constructor stub userblService = BusinessLogicService.getUserblService(); JLabel[] labels = new JLabel[3]; JPasswordField[] fields = new JPasswordField[3]; String[] strs = {"原密码", "新密码", "确认新密码"}; for (int i = 0; i < 3; i++) { labels[i] = new JLabel(); fields[i] = new JPasswordField(); labels[i].setBounds(20, 40 * (i + 1), 70, 25); labels[i].setText(strs[i]); fields[i].setBounds(120, 40 * (i + 1), 150, 25); fields[i].setEchoChar('*'); this.add(labels[i]); this.add(fields[i]); } JButton cancelButton = new JButton("取消"); cancelButton.setBounds(100, 190, 60, 20); cancelButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub ModifyPasswordDialog.this.dispose(); } }); JButton confirmButton = new JButton("确认"); confirmButton.setBounds(180, 190, 60, 20); confirmButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub boolean isCorrect = passwordCheck.check() & newPasswordCheck.check() & confirmPassword.check(); if (isCorrect) { userblService.modifyPassword( LoginController.getEmployeeId(), new String(fields[1].getPassword())); ModifyPasswordDialog.this.dispose(); ScreenMessage.putOnScreen(ScreenMessage.SAVE_SUCCESS); } } }); // 添加检查项 passwordCheck = new Checker( fields[0], new CheckInfoGetter() { @Override public CheckInfo getCheckInfo() { // TODO Auto-generated method stub if (fields[0] == null) { return null; } return new UserPassword( new String(fields[0].getPassword()), LoginController.getEmployeeId()); } }); fields[0].addKeyListener( new KeyListener() { @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub passwordCheck.check(); } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); newPasswordCheck = new Checker( fields[1], new CheckInfoGetter() { @Override public CheckInfo getCheckInfo() { // TODO Auto-generated method stub if (fields[1] == null) { return null; } return new NewPassword(new String(fields[1].getPassword())); } }); fields[1].addKeyListener( new KeyListener() { @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub newPasswordCheck.check(); } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); confirmPassword = new Checker( fields[2], new CheckInfoGetter() { @Override public CheckInfo getCheckInfo() { // TODO Auto-generated method stub if (fields[2] == null) { return null; } return new ConfirmPassword( new String(fields[1].getPassword()), new String(fields[2].getPassword())); } }); fields[2].addKeyListener( new KeyListener() { @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub confirmPassword.check(); } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); for (int i = 0; i < 3; i++) { this.add(labels[i]); this.add(fields[i]); } this.add(confirmButton); this.add(cancelButton); this.setModalityType(ModalityType.APPLICATION_MODAL); // this.setLocationRelativeTo(MainFrame.getMainFrame()); this.setLayout(new DialogLayoutManager()); this.setBounds(100, 200, 350, 270); this.setVisible(true); this.setTitle("修改密码"); this.setResizable(false); }