예제 #1
0
  @Override
  public void modifyTransaction(final Transaction tran) {
    if (!(tran instanceof InvestmentTransaction)) {
      throw new IllegalArgumentException("bad tranType");
    }
    clearForm();

    datePanel.setDate(tran.getDate());

    List<TransactionEntry> entries = tran.getTransactionEntries();

    feePanel.setTransactionEntries(((InvestmentTransaction) tran).getInvestmentFeeEntries());

    gainsPanel.setTransactionEntries(((InvestmentTransaction) tran).getInvestmentGainLossEntries());

    for (TransactionEntry e : entries) {
      if (e instanceof TransactionEntrySellX) {
        AbstractInvestmentTransactionEntry entry = (AbstractInvestmentTransactionEntry) e;

        memoField.setText(e.getMemo());
        priceField.setDecimal(entry.getPrice());
        quantityField.setDecimal(entry.getQuantity());
        securityCombo.setSelectedNode(entry.getSecurityNode());

        accountExchangePanel.setSelectedAccount(entry.getDebitAccount());
        accountExchangePanel.setExchangedAmount(entry.getDebitAmount().abs());
      }
    }

    updateTotalField();

    modTrans = tran;

    reconciledButton.setSelected(tran.getReconciled(getAccount()) == ReconciledState.RECONCILED);
  }
예제 #2
0
  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);
  }