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