Search in sources :

Example 41 with CurrencyNode

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

the class CurrencyModifyDialog method updateForm.

private void updateForm() {
    CurrencyNode node = sourceList.getSelectedValue();
    if (node != null) {
        symbolField.setText(node.getSymbol());
        symbolField.setEnabled(false);
        descriptionField.setText(node.getDescription());
        scaleField.setText(Short.toString(node.getScale()));
        prefixField.setText(node.getPrefix());
        suffixField.setText(node.getSuffix());
        currentCurrency = node;
    }
}
Also used : CurrencyNode(jgnash.engine.CurrencyNode)

Example 42 with CurrencyNode

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

the class CurrencyModifyDialog method commitCommodityNode.

private void commitCommodityNode() {
    if (validateForm()) {
        CurrencyNode oldNode = sourceList.getSelectedValue();
        CurrencyNode newNode = buildCommodityNode();
        if (getEngine().getCurrency(newNode.getSymbol()) != null && oldNode != null) {
            if (!getEngine().updateCommodity(oldNode, newNode)) {
                StaticUIMethods.displayError(ResourceUtils.getString("Message.Error.CurrencyUpdate", newNode.getSymbol()));
            }
        } else {
            getEngine().addCurrency(newNode);
        }
    }
}
Also used : CurrencyNode(jgnash.engine.CurrencyNode)

Example 43 with CurrencyNode

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

the class CurrencyExchangeDialog method updateModel.

private void updateModel() {
    CurrencyNode base = baseCurrencyCombo.getSelectedNode();
    CurrencyNode exchange = exchangeCurrencyCombo.getSelectedNode();
    if (base != null && exchange != null) {
        ExchangeRate rate = getEngine().getExchangeRate(base, exchange);
        model.setExchangeRate(rate);
    }
}
Also used : CurrencyNode(jgnash.engine.CurrencyNode) ExchangeRate(jgnash.engine.ExchangeRate)

Example 44 with CurrencyNode

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

the class NewFileThree method removeAction.

private void removeAction() {
    CurrencyNode obj = cJList.getSelectedValue();
    if (obj != null) {
        cList.removeElement(obj);
        aList.addElement(obj);
    }
}
Also used : CurrencyNode(jgnash.engine.CurrencyNode)

Example 45 with CurrencyNode

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

the class RegisterTable method getToolTipText.

@Override
public String getToolTipText(@NotNull final MouseEvent event) {
    int[] rows = getSelectedRows();
    if (rows.length > 1) {
        AccountTableModel model = (AccountTableModel) getModel();
        Account account = model.getAccount();
        CurrencyNode node = account.getCurrencyNode();
        BigDecimal amount = BigDecimal.ZERO;
        // correct the row indexes if the model is sorted
        if (model instanceof SortedTableModel) {
            for (int i = 0; i < rows.length; i++) {
                rows[i] = ((SortedTableModel) model).convertRowIndexToAccount(rows[i]);
            }
        }
        for (int row : rows) {
            amount = amount.add(AccountBalanceDisplayManager.convertToSelectedBalanceMode(account.getAccountType(), account.getTransactionAt(row).getAmount(account)));
        }
        return CommodityFormat.getFullNumberFormat(node).format(amount);
    }
    return null;
}
Also used : CurrencyNode(jgnash.engine.CurrencyNode) Account(jgnash.engine.Account) BigDecimal(java.math.BigDecimal)

Aggregations

CurrencyNode (jgnash.engine.CurrencyNode)58 Account (jgnash.engine.Account)28 Engine (jgnash.engine.Engine)28 BigDecimal (java.math.BigDecimal)10 ArrayList (java.util.ArrayList)10 LocalDate (java.time.LocalDate)8 NumberFormat (java.text.NumberFormat)7 List (java.util.List)7 FXML (javafx.fxml.FXML)7 AccountGroup (jgnash.engine.AccountGroup)7 Transaction (jgnash.engine.Transaction)6 ResourceBundle (java.util.ResourceBundle)5 SecurityNode (jgnash.engine.SecurityNode)5 InjectFXML (jgnash.uifx.util.InjectFXML)5 Test (org.junit.jupiter.api.Test)5 IOException (java.io.IOException)4 JasperPrint (net.sf.jasperreports.engine.JasperPrint)4 HashMap (java.util.HashMap)3 Objects (java.util.Objects)3 ExecutionException (java.util.concurrent.ExecutionException)3