public void refresh() {
    try {

      DecimalFormat df = new DecimalFormat("#.00");

      ArrayList<BankAccountVO> vos = bankAccountBLService.getBankAccountList();
      // defaultTableModel.getDataVector().clear();
      Vector<Vector> data = new Vector<Vector>();
      for (BankAccountVO vo : vos) {
        String acc = vo.getAccountUser();
        BigDecimal balance = vo.getBalance();
        Vector<Object> item = new Vector<Object>();
        item.add(acc);
        item.add(df.format(balance));
        data.add(item);
        // defaultTableModel.addRow(data);
      }
      defaultTableModel.setDataVector(data, names);
      table.revalidate();
      table.updateUI();
    } catch (RemoteException e) {
      new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
    } catch (SQLException e) {
      System.out.println(e.getMessage());
    }
  }
Exemple #2
0
 private void refreshList() {
   if (isBLInited()) {
     defaultTableModel.getDataVector().clear();
     try {
       ArrayList<PayReceiptVO> payReceiptVOs =
           payReceiptBLService.getListByState(ReceiptState.SUBMITTED);
       ArrayList<TransferReceiptVO> transferReceiptVOs =
           transferReceiptBLService.getListByState(ReceiptState.SUBMITTED);
       Vector<Vector> data = new Vector<Vector>();
       for (PayReceiptVO vo : payReceiptVOs) {
         Vector<Object> item = new Vector<Object>();
         item.add(vo.getId());
         item.add("付款单");
         item.add(vo.print());
         data.add(item);
       }
       for (TransferReceiptVO vo : transferReceiptVOs) {
         Vector<Object> item = new Vector<Object>();
         item.add(vo.getTransferID());
         item.add("中转单");
         item.add(vo.print());
         data.add(item);
       }
       defaultTableModel.setDataVector(data, names);
       table.revalidate();
       table.updateUI();
     } catch (RemoteException e) {
       new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
     } catch (SQLException e) {
       System.out.println(e.getMessage());
     }
   } else {
     initBL();
   }
 }
Exemple #3
0
  private void initUI() {
    names = new Vector<String>();
    names.add("单号");
    names.add("单据类型");
    names.add("单据简述");
    defaultTableModel = new EditableTableModel(names, 0);
    table = new MyTable(defaultTableModel);
    table.getColumnModel().getColumn(2).setPreferredWidth(300); // 设置单据简述一列较宽
    table.getColumnModel().getColumn(0).setWidth(50);
    table.getColumnModel().getColumn(1).setWidth(50);
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // 设置可多选
    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.anchor = GridBagConstraints.EAST;

    gbc.weightx = gbc.weighty = 1.0;
    gbc.gridx = gbc.gridy = 0;
    gbc.gridwidth = 3;
    this.add(new JScrollPane(table), gbc);

    gbc.weightx = gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.gridwidth = 1;
    gbc.gridy++;
    this.add(approvebt, gbc);
    gbc.gridx++;
    this.add(disappbt, gbc);
    gbc.gridx++;
    this.add(refreshbt, gbc);

    this.setOpaque(false);
    this.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createBevelBorder(ALLBITS),
            "审批单据",
            TitledBorder.LEFT,
            TitledBorder.TOP,
            new Font("", Font.BOLD, 25)));
  }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == addbt) {
     if (bankAccountBLService != null) {
       JDialog dialog = new JDialog(parent, "新建银行账户", true);
       dialog
           .getContentPane()
           .add(new BankAccountAddPanel(parent, dialog, this, bankAccountBLService));
       dialog.setLocationRelativeTo(parent);
       dialog.setLocation(dialog.getX() / 2, dialog.getY() / 2);
       dialog.pack();
       dialog.setVisible(true);
     } else {
       initBL();
     }
   } else if (e.getSource() == deletebt) {
     int row = table.getSelectedRow();
     if (row >= 0) {
       if (bankAccountBLService != null) {
         String account = (String) table.getValueAt(row, 0);
         try {
           bankAccountBLService.deleteBankAccount(account);
           refresh();
           new TranslucentFrame(this, MessageType.DELETE_SUCCESS, Color.GREEN);
         } catch (RemoteException e1) {
           new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
         } catch (SQLException e1) {
           System.out.println(e1.getMessage());
         }
       } else {
         initBL();
       }
     }
   } else if (e.getSource() == refreshbt) {
     refresh();
     new TranslucentFrame(this, "刷新成功", Color.GREEN);
   }
 }
Exemple #5
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == approvebt) {
      int[] rows = table.getSelectedRows();
      if (rows.length <= 0) {
        new TranslucentFrame(this, "请选择要审批的单据(按住ctrl可多选)", Color.RED);
      } else { // 选择了行
        if (isBLInited()) {
          for (int i : rows) {
            String id = (String) table.getValueAt(i, 0);
            String receiptType = (String) table.getValueAt(i, 1);
            try {
              if (receiptType.equals("付款单")) {
                payReceiptBLService.updateState(id, ReceiptState.APPROVED);
              } else if (receiptType.equals("中转单")) {
                transferReceiptBLService.updateState(id, ReceiptState.APPROVED);
              }

            } catch (RemoteException e1) {
              new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
            } catch (SQLException e1) {
              System.out.println(e1.getMessage());
            }
          }
          refreshList();
          new TranslucentFrame(this, "审批成功", Color.GREEN);
        } else {
          initBL();
        }
      }
    } else if (e.getSource() == disappbt) {
      int[] rows = table.getSelectedRows();
      if (rows.length <= 0) {
        new TranslucentFrame(this, "请选择要审批的单据(按住ctrl可多选)", Color.RED);
      } else { // 选择了行
        if (isBLInited()) {
          for (int i : rows) {
            String id = (String) table.getValueAt(i, 0);
            String receiptType = (String) table.getValueAt(i, 1);
            try {
              if (receiptType.equals("付款单")) {
                payReceiptBLService.updateState(id, ReceiptState.UNAPPROVED);
              } else if (receiptType.equals("中转单")) {
                transferReceiptBLService.updateState(id, ReceiptState.UNAPPROVED);
              }

            } catch (RemoteException e1) {
              new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE);
            } catch (SQLException e1) {
              System.out.println(e1.getMessage());
            }
          }
          refreshList();
          new TranslucentFrame(this, "审批成功", Color.GREEN);
        } else {
          initBL();
        }
      }
    } else if (e.getSource() == refreshbt) {
      refreshList();
      new TranslucentFrame(this, "刷新成功", Color.GREEN);
    }
  }