コード例 #1
0
ファイル: SellSharePanel.java プロジェクト: tsachev/jgnash
  @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
ファイル: SellSharePanel.java プロジェクト: tsachev/jgnash
  @Override
  public void clearForm() {
    super.clearForm();

    accountExchangePanel.setSelectedAccount(getAccount());
    feePanel.clearForm();
    gainsPanel.clearForm();
    updateTotalField();
  }
コード例 #3
0
ファイル: SellSharePanel.java プロジェクト: tsachev/jgnash
  @Override
  public Transaction buildTransaction() {
    BigDecimal exchangeRate = accountExchangePanel.getExchangeRate();

    Collection<TransactionEntry> fees = feePanel.getTransactions();

    Collection<TransactionEntry> gains = gainsPanel.getTransactions();

    return TransactionFactory.generateSellXTransaction(
        accountExchangePanel.getSelectedAccount(),
        getAccount(),
        securityCombo.getSelectedNode(),
        priceField.getDecimal(),
        quantityField.getDecimal(),
        exchangeRate,
        datePanel.getDate(),
        memoField.getText(),
        reconciledButton.isSelected(),
        fees,
        gains);
  }
コード例 #4
0
ファイル: SellSharePanel.java プロジェクト: tsachev/jgnash
  protected SellSharePanel(final Account account) {
    super(account);

    feePanel = new FeePanel(account);

    gainsPanel = new GainsPanel(account);

    accountExchangePanel = new AccountExchangePanel(getAccount().getCurrencyNode(), totalField);
    accountExchangePanel.setSelectedAccount(getAccount());

    layoutMainPanel();

    registerListeners();

    clearForm();
  }