Exemple #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);
  }
Exemple #2
0
  public List<TransactionEntry> getTransactions() {

    // adjust the cash balance of the investment account
    if (feeList.isEmpty()
        && feeField.getDecimal().compareTo(BigDecimal.ZERO) != 0) { // ignore zero balance fees
      TransactionEntry fee = new TransactionEntry(account, feeField.getDecimal().abs().negate());
      fee.setTransactionTag(TransactionTag.INVESTMENT_FEE);

      feeList.add(fee);
    }
    return feeList;
  }
Exemple #3
0
 @Override
 public synchronized void removeKeyListener(final KeyListener l) {
   feeField.removeKeyListener(l);
 }
Exemple #4
0
 @Override
 public synchronized void addKeyListener(final KeyListener l) {
   feeField.addKeyListener(l);
 }
Exemple #5
0
 @Override
 public synchronized void addFocusListener(final FocusListener l) {
   feeField.addFocusListener(l);
 }
Exemple #6
0
 /** Clear the form and remove all entries */
 void clearForm() {
   feeList = new ArrayList<>();
   feeField.setDecimal(null);
 }
Exemple #7
0
 public BigDecimal getDecimal() {
   return feeField.getDecimal();
 }