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()));
}
Aggregations