mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
rename amount controls to coin
This commit is contained in:
parent
765a4f4c82
commit
e21dbf87ef
7 changed files with 21 additions and 21 deletions
|
@ -47,7 +47,7 @@ public class AddressTreeTable extends TreeTableView<Entry> {
|
||||||
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
||||||
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
||||||
});
|
});
|
||||||
amountCol.setCellFactory(p -> new AmountCell());
|
amountCol.setCellFactory(p -> new CoinCell());
|
||||||
amountCol.setSortable(false);
|
amountCol.setSortable(false);
|
||||||
getColumns().add(amountCol);
|
getColumns().add(amountCol);
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ import javafx.scene.layout.Region;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
class AmountCell extends TreeTableCell<Entry, Number> {
|
class CoinCell extends TreeTableCell<Entry, Number> {
|
||||||
public AmountCell() {
|
public CoinCell() {
|
||||||
super();
|
super();
|
||||||
getStyleClass().add("amount-cell");
|
getStyleClass().add("coin-cell");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -8,15 +8,15 @@ import java.text.ParseException;
|
||||||
import java.util.function.UnaryOperator;
|
import java.util.function.UnaryOperator;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class AmountFormatter extends TextFormatter<String> {
|
public class CoinFormatter extends TextFormatter<String> {
|
||||||
private static final Pattern AMOUNT_VALIDATION = Pattern.compile("[\\d,]*(\\.\\d{0,8})?");
|
private static final Pattern COIN_VALIDATION = Pattern.compile("[\\d,]*(\\.\\d{0,8})?");
|
||||||
private static final DecimalFormat AMOUNT_FORMAT = new DecimalFormat("###,###.########");
|
private static final DecimalFormat COIN_FORMAT = new DecimalFormat("###,###.########");
|
||||||
|
|
||||||
public AmountFormatter() {
|
public CoinFormatter() {
|
||||||
super(new AmountFilter());
|
super(new CoinFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AmountFilter implements UnaryOperator<Change> {
|
private static class CoinFilter implements UnaryOperator<Change> {
|
||||||
@Override
|
@Override
|
||||||
public Change apply(Change change) {
|
public Change apply(Change change) {
|
||||||
String oldText = change.getControlText();
|
String oldText = change.getControlText();
|
||||||
|
@ -34,7 +34,7 @@ public class AmountFormatter extends TextFormatter<String> {
|
||||||
commasRemoved = newText.length() - noFractionCommaText.length();
|
commasRemoved = newText.length() - noFractionCommaText.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!AMOUNT_VALIDATION.matcher(noFractionCommaText).matches()) {
|
if(!COIN_VALIDATION.matcher(noFractionCommaText).matches()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public class AmountFormatter extends TextFormatter<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Number value = AMOUNT_FORMAT.parse(noFractionCommaText);
|
Number value = COIN_FORMAT.parse(noFractionCommaText);
|
||||||
String correct = AMOUNT_FORMAT.format(value.doubleValue());
|
String correct = COIN_FORMAT.format(value.doubleValue());
|
||||||
|
|
||||||
String compare = newText;
|
String compare = newText;
|
||||||
if(compare.contains(".") && compare.endsWith("0")) {
|
if(compare.contains(".") && compare.endsWith("0")) {
|
|
@ -38,7 +38,7 @@ public class TransactionsTreeTable extends TreeTableView<Entry> {
|
||||||
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
||||||
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
||||||
});
|
});
|
||||||
amountCol.setCellFactory(p -> new AmountCell());
|
amountCol.setCellFactory(p -> new CoinCell());
|
||||||
amountCol.setSortable(true);
|
amountCol.setSortable(true);
|
||||||
getColumns().add(amountCol);
|
getColumns().add(amountCol);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class TransactionsTreeTable extends TreeTableView<Entry> {
|
||||||
balanceCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
balanceCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
||||||
return param.getValue().getValue() instanceof TransactionEntry ? ((TransactionEntry)param.getValue().getValue()).balanceProperty() : new ReadOnlyObjectWrapper<>(null);
|
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);
|
balanceCol.setSortable(true);
|
||||||
getColumns().add(balanceCol);
|
getColumns().add(balanceCol);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class UtxosTreeTable extends TreeTableView<Entry> {
|
||||||
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
amountCol.setCellValueFactory((TreeTableColumn.CellDataFeatures<Entry, Number> param) -> {
|
||||||
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
return new ReadOnlyObjectWrapper<>(param.getValue().getValue().getValue());
|
||||||
});
|
});
|
||||||
amountCol.setCellFactory(p -> new AmountCell());
|
amountCol.setCellFactory(p -> new CoinCell());
|
||||||
amountCol.setSortable(true);
|
amountCol.setSortable(true);
|
||||||
getColumns().add(amountCol);
|
getColumns().add(amountCol);
|
||||||
setTreeColumn(amountCol);
|
setTreeColumn(amountCol);
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
updateTransaction();
|
updateTransaction();
|
||||||
});
|
});
|
||||||
|
|
||||||
amount.setTextFormatter(new AmountFormatter());
|
amount.setTextFormatter(new CoinFormatter());
|
||||||
amount.textProperty().addListener(amountListener);
|
amount.textProperty().addListener(amountListener);
|
||||||
|
|
||||||
amountUnit.getSelectionModel().select(1);
|
amountUnit.getSelectionModel().select(1);
|
||||||
|
@ -197,7 +197,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
|
|
||||||
setTargetBlocks(5);
|
setTargetBlocks(5);
|
||||||
|
|
||||||
fee.setTextFormatter(new AmountFormatter());
|
fee.setTextFormatter(new CoinFormatter());
|
||||||
fee.textProperty().addListener(feeListener);
|
fee.textProperty().addListener(feeListener);
|
||||||
|
|
||||||
feeAmountUnit.getSelectionModel().select(1);
|
feeAmountUnit.getSelectionModel().select(1);
|
||||||
|
|
|
@ -53,15 +53,15 @@
|
||||||
-fx-padding: 0;
|
-fx-padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount-cell {
|
.coin-cell {
|
||||||
-fx-alignment: center-right;
|
-fx-alignment: center-right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount-cell.spent .text {
|
.coin-cell.spent .text {
|
||||||
-fx-strikethrough: true;
|
-fx-strikethrough: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount-cell .confirmation-progress {
|
.coin-cell .confirmation-progress {
|
||||||
-fx-pref-width: 14;
|
-fx-pref-width: 14;
|
||||||
-fx-padding: 0 8 0 0;
|
-fx-padding: 0 8 0 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue