示例#1
0
  /**
   * Clones a <code>List</code> of <code>TransactionEntry(s)</code>
   *
   * @param fees <code>List</code> of fees to clone
   */
  public void setTransactionEntries(final List<TransactionEntry> fees) {
    feeList = new ArrayList<>();

    if (fees.size() == 1) {
      TransactionEntry e = fees.get(0);

      if (e.getCreditAccount().equals(e.getDebitAccount())) {
        feeField.setDecimal(e.getAmount(account).abs());
      } else {
        try {
          feeList.add((TransactionEntry) e.clone()); // copy over the provided set's entry
        } catch (CloneNotSupportedException e1) {
          Logger.getLogger(FeePanel.class.getName())
              .log(Level.SEVERE, e1.getLocalizedMessage(), e1);
        }
        feeField.setDecimal(sumFees().abs());
      }
    } else {
      for (TransactionEntry entry : fees) { // clone the provided set's entries
        try {
          feeList.add((TransactionEntry) entry.clone());
        } catch (CloneNotSupportedException e) {
          Logger.getLogger(FeePanel.class.getName()).log(Level.SEVERE, e.toString(), e);
        }
      }

      feeField.setDecimal(sumFees().abs());
    }

    feeField.setEditable(feeList.size() < 1);
  }
  public void modifyTransaction(final TransactionEntry entry) {
    oldEntry = entry;

    memoField.setText(entry.getMemo());

    accountPanel.setSelectedAccount(entry.getCreditAccount());
    amountField.setDecimal(entry.getDebitAmount().abs());

    accountPanel.setExchangedAmount(entry.getCreditAmount());

    reconciledButton.setSelected(entry.getReconciled(getAccount()) == ReconciledState.RECONCILED);
  }