@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); }
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); }