diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AddressTreeTable.java b/src/main/java/com/sparrowwallet/sparrow/control/AddressTreeTable.java index b8aa8260..a8c540a0 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AddressTreeTable.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/AddressTreeTable.java @@ -47,7 +47,7 @@ public class AddressTreeTable extends TreeTableView { amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures param) -> { return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue()); }); - amountCol.setCellFactory(p -> new AmountCell()); + amountCol.setCellFactory(p -> new CoinCell()); amountCol.setSortable(false); getColumns().add(amountCol); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AmountCell.java b/src/main/java/com/sparrowwallet/sparrow/control/CoinCell.java similarity index 95% rename from src/main/java/com/sparrowwallet/sparrow/control/AmountCell.java rename to src/main/java/com/sparrowwallet/sparrow/control/CoinCell.java index 1844abe1..5850c11b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AmountCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/CoinCell.java @@ -12,10 +12,10 @@ import javafx.scene.layout.Region; import java.util.Locale; -class AmountCell extends TreeTableCell { - public AmountCell() { +class CoinCell extends TreeTableCell { + public CoinCell() { super(); - getStyleClass().add("amount-cell"); + getStyleClass().add("coin-cell"); } @Override diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AmountFormatter.java b/src/main/java/com/sparrowwallet/sparrow/control/CoinFormatter.java similarity index 83% rename from src/main/java/com/sparrowwallet/sparrow/control/AmountFormatter.java rename to src/main/java/com/sparrowwallet/sparrow/control/CoinFormatter.java index 83d5ba59..46822953 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AmountFormatter.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/CoinFormatter.java @@ -8,15 +8,15 @@ import java.text.ParseException; import java.util.function.UnaryOperator; import java.util.regex.Pattern; -public class AmountFormatter extends TextFormatter { - private static final Pattern AMOUNT_VALIDATION = Pattern.compile("[\\d,]*(\\.\\d{0,8})?"); - private static final DecimalFormat AMOUNT_FORMAT = new DecimalFormat("###,###.########"); +public class CoinFormatter extends TextFormatter { + private static final Pattern COIN_VALIDATION = Pattern.compile("[\\d,]*(\\.\\d{0,8})?"); + private static final DecimalFormat COIN_FORMAT = new DecimalFormat("###,###.########"); - public AmountFormatter() { - super(new AmountFilter()); + public CoinFormatter() { + super(new CoinFilter()); } - private static class AmountFilter implements UnaryOperator { + private static class CoinFilter implements UnaryOperator { @Override public Change apply(Change change) { String oldText = change.getControlText(); @@ -34,7 +34,7 @@ public class AmountFormatter extends TextFormatter { commasRemoved = newText.length() - noFractionCommaText.length(); } - if(!AMOUNT_VALIDATION.matcher(noFractionCommaText).matches()) { + if(!COIN_VALIDATION.matcher(noFractionCommaText).matches()) { return null; } @@ -51,8 +51,8 @@ public class AmountFormatter extends TextFormatter { } try { - Number value = AMOUNT_FORMAT.parse(noFractionCommaText); - String correct = AMOUNT_FORMAT.format(value.doubleValue()); + Number value = COIN_FORMAT.parse(noFractionCommaText); + String correct = COIN_FORMAT.format(value.doubleValue()); String compare = newText; if(compare.contains(".") && compare.endsWith("0")) { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionsTreeTable.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionsTreeTable.java index ff2b7517..937258cf 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionsTreeTable.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionsTreeTable.java @@ -38,7 +38,7 @@ public class TransactionsTreeTable extends TreeTableView { amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures param) -> { return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue()); }); - amountCol.setCellFactory(p -> new AmountCell()); + amountCol.setCellFactory(p -> new CoinCell()); amountCol.setSortable(true); getColumns().add(amountCol); @@ -46,7 +46,7 @@ public class TransactionsTreeTable extends TreeTableView { balanceCol.setCellValueFactory((TreeTableColumn.CellDataFeatures param) -> { return param.getValue().getValue() instanceof TransactionEntry ? ((TransactionEntry)param.getValue().getValue()).balanceProperty() : new ReadOnlyObjectWrapper<>(null); }); - balanceCol.setCellFactory(p -> new AmountCell()); + balanceCol.setCellFactory(p -> new CoinCell()); balanceCol.setSortable(true); getColumns().add(balanceCol); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/UtxosTreeTable.java b/src/main/java/com/sparrowwallet/sparrow/control/UtxosTreeTable.java index 268bab53..c4490da1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/UtxosTreeTable.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/UtxosTreeTable.java @@ -63,7 +63,7 @@ public class UtxosTreeTable extends TreeTableView { amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures param) -> { return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue()); }); - amountCol.setCellFactory(p -> new AmountCell()); + amountCol.setCellFactory(p -> new CoinCell()); amountCol.setSortable(true); getColumns().add(amountCol); setTreeColumn(amountCol); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 00020233..d725f6ac 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -141,7 +141,7 @@ public class SendController extends WalletFormController implements Initializabl updateTransaction(); }); - amount.setTextFormatter(new AmountFormatter()); + amount.setTextFormatter(new CoinFormatter()); amount.textProperty().addListener(amountListener); amountUnit.getSelectionModel().select(1); @@ -197,7 +197,7 @@ public class SendController extends WalletFormController implements Initializabl setTargetBlocks(5); - fee.setTextFormatter(new AmountFormatter()); + fee.setTextFormatter(new CoinFormatter()); fee.textProperty().addListener(feeListener); feeAmountUnit.getSelectionModel().select(1); diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/wallet.css b/src/main/resources/com/sparrowwallet/sparrow/wallet/wallet.css index dc475fe6..90330e71 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/wallet.css +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/wallet.css @@ -53,15 +53,15 @@ -fx-padding: 0; } -.amount-cell { +.coin-cell { -fx-alignment: center-right; } -.amount-cell.spent .text { +.coin-cell.spent .text { -fx-strikethrough: true; } -.amount-cell .confirmation-progress { +.coin-cell .confirmation-progress { -fx-pref-width: 14; -fx-padding: 0 8 0 0; }