From b03c873a06f0f3c9ed368a4e33beebbdee33ed84 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 20 Jul 2024 21:39:10 -0400 Subject: [PATCH] search by payment method in filter and tweak ui --- .../resources/i18n/displayStrings.properties | 2 +- .../main/offer/offerbook/OfferBookView.java | 6 +++--- .../main/offer/offerbook/OfferBookViewModel.java | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 9c2796c68a..a38f13bfec 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -312,7 +312,7 @@ market.tabs.spreadPayment=Offers by Payment Method market.tabs.trades=Trades # OfferBookView -market.offerBook.filterPrompt=Offer ID, address... +market.offerBook.filterPrompt=Filter # OfferBookChartView market.offerBook.sellOffersHeaderLabel=Sell {0} to diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java index f033304211..ead182ba18 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookView.java @@ -188,13 +188,13 @@ abstract public class OfferBookView> paymentBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox( Res.get("offerbook.filterByPaymentMethod")); paymentMethodComboBox = paymentBoxTuple.third; paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory()); - paymentMethodComboBox.setPrefWidth(270); + paymentMethodComboBox.setPrefWidth(250); matchingOffersToggle = new AutoTooltipSlideToggleButton(); matchingOffersToggle.setText(Res.get("offerbook.matchingOffers")); @@ -215,7 +215,7 @@ abstract public class OfferBookView autoToolTipTextField = addTopLabelAutoToolTipTextField(Res.get("shared.filter")); + Tuple3 autoToolTipTextField = addTopLabelAutoToolTipTextField(""); VBox filterBox = autoToolTipTextField.first; filterInputField = autoToolTipTextField.third; filterInputField.setPromptText(Res.get("market.offerBook.filterPrompt")); diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java index 37e9f0a4ef..f5fdd74509 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OfferBookViewModel.java @@ -574,10 +574,18 @@ abstract class OfferBookViewModel extends ActivatableViewModel { getCurrencyAndMethodPredicate(direction, selectedTradeCurrency); if (!filterText.isEmpty()) { - Predicate nextPredicate=offerBookListItem -> - offerBookListItem.getOffer().getOfferPayload().getOwnerNodeAddress().getFullAddress().contains(filterText); - nextPredicate=nextPredicate.or(offerBookListItem -> - offerBookListItem.getOffer().getId().contains(filterText)); + + // filter node address + Predicate nextPredicate = offerBookListItem -> + offerBookListItem.getOffer().getOfferPayload().getOwnerNodeAddress().getFullAddress().toLowerCase().contains(filterText.toLowerCase()); + + // filter offer id + nextPredicate = nextPredicate.or(offerBookListItem -> + offerBookListItem.getOffer().getId().toLowerCase().contains(filterText.toLowerCase())); + + // filter payment method + nextPredicate = nextPredicate.or(offerBookListItem -> + Res.get(offerBookListItem.getOffer().getPaymentMethod().getId()).toLowerCase().contains(filterText.toLowerCase())); filteredItems.setPredicate(predicate.and(nextPredicate)); } else {