mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-10 08:37:05 +00:00
rename amount controls to coin
This commit is contained in:
@@ -47,7 +47,7 @@ public class AddressTreeTable extends TreeTableView<Entry> {
|
||||
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
||||
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
||||
});
|
||||
amountCol.setCellFactory(p -> new AmountCell());
|
||||
amountCol.setCellFactory(p -> new CoinCell());
|
||||
amountCol.setSortable(false);
|
||||
getColumns().add(amountCol);
|
||||
|
||||
|
||||
+3
-3
@@ -12,10 +12,10 @@ import javafx.scene.layout.Region;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
class AmountCell extends TreeTableCell<Entry, Number> {
|
||||
public AmountCell() {
|
||||
class CoinCell extends TreeTableCell<Entry, Number> {
|
||||
public CoinCell() {
|
||||
super();
|
||||
getStyleClass().add("amount-cell");
|
||||
getStyleClass().add("coin-cell");
|
||||
}
|
||||
|
||||
@Override
|
||||
+9
-9
@@ -8,15 +8,15 @@ import java.text.ParseException;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class AmountFormatter extends TextFormatter<String> {
|
||||
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<String> {
|
||||
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<Change> {
|
||||
private static class CoinFilter implements UnaryOperator<Change> {
|
||||
@Override
|
||||
public Change apply(Change change) {
|
||||
String oldText = change.getControlText();
|
||||
@@ -34,7 +34,7 @@ public class AmountFormatter extends TextFormatter<String> {
|
||||
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<String> {
|
||||
}
|
||||
|
||||
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")) {
|
||||
@@ -38,7 +38,7 @@ public class TransactionsTreeTable extends TreeTableView<Entry> {
|
||||
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> 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<Entry> {
|
||||
balanceCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> 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);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class UtxosTreeTable extends TreeTableView<Entry> {
|
||||
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user