Search in sources :

Example 1 with TransactionEntryRocX

use of jgnash.engine.TransactionEntryRocX in project jgnash by ccavanaugh.

the class ReturnOfCapitalPanel method modifyTransaction.

@Override
public void modifyTransaction(Transaction tran) {
    if (!(tran instanceof InvestmentTransaction)) {
        throw new IllegalArgumentException("bad tranType");
    }
    clearForm();
    datePanel.setDate(tran.getLocalDate());
    List<TransactionEntry> entries = tran.getTransactionEntries();
    assert entries.size() <= 2;
    for (TransactionEntry e : entries) {
        if (e instanceof TransactionEntryRocX) {
            AbstractInvestmentTransactionEntry entry = (AbstractInvestmentTransactionEntry) e;
            memoField.setText(e.getMemo());
            securityCombo.setSelectedNode(entry.getSecurityNode());
            incomeExchangePanel.setSelectedAccount(entry.getDebitAccount());
            incomeExchangePanel.setExchangedAmount(entry.getDebitAmount().abs());
            dividendField.setDecimal(entry.getAmount(getAccount()));
        } else if (e.getTransactionTag() == TransactionTag.INVESTMENT_CASH_TRANSFER) {
            accountExchangePanel.setSelectedAccount(e.getCreditAccount());
            accountExchangePanel.setExchangedAmount(e.getCreditAmount());
        } else {
            logger.warning("Invalid transaction");
        }
    }
    modTrans = tran;
    setReconciledState(tran.getReconciled(getAccount()));
}
Also used : InvestmentTransaction(jgnash.engine.InvestmentTransaction) TransactionEntryRocX(jgnash.engine.TransactionEntryRocX) AbstractInvestmentTransactionEntry(jgnash.engine.AbstractInvestmentTransactionEntry) TransactionEntry(jgnash.engine.TransactionEntry) AbstractInvestmentTransactionEntry(jgnash.engine.AbstractInvestmentTransactionEntry)

Aggregations

AbstractInvestmentTransactionEntry (jgnash.engine.AbstractInvestmentTransactionEntry)1 InvestmentTransaction (jgnash.engine.InvestmentTransaction)1 TransactionEntry (jgnash.engine.TransactionEntry)1 TransactionEntryRocX (jgnash.engine.TransactionEntryRocX)1