Sort payment methods by display string not by id.

Apply sorting in drop down boxes.
This commit is contained in:
chimp1984 2020-12-10 22:34:31 -05:00
parent 7d12b94c6a
commit 5c68ad0b47
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
3 changed files with 3 additions and 1 deletions

View file

@ -332,7 +332,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
@Override
public int compareTo(@NotNull PaymentMethod other) {
return id.compareTo(other.id);
return Res.get(id).compareTo(Res.get(other.id));
}
public String getDisplayString() {

View file

@ -385,6 +385,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
paymentMethodComboBox.setPrefWidth(250);
List<PaymentMethod> list = PaymentMethod.getPaymentMethods().stream()
.filter(paymentMethod -> !paymentMethod.isAsset())
.sorted()
.collect(Collectors.toList());
paymentMethodComboBox.setItems(FXCollections.observableArrayList(list));
paymentMethodComboBox.setConverter(new StringConverter<>() {

View file

@ -343,6 +343,7 @@ class OfferBookViewModel extends ActivatableViewModel {
ObservableList<PaymentMethod> getPaymentMethods() {
ObservableList<PaymentMethod> list = FXCollections.observableArrayList(PaymentMethod.getPaymentMethods());
list.sort(Comparator.naturalOrder());
list.add(0, PaymentMethod.getDummyPaymentMethod(GUIUtil.SHOW_ALL_FLAG));
return list;
}