Skip to content

Commit

Permalink
search by payment method in filter and tweak ui
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jul 21, 2024
1 parent 7c8753c commit 7ff096c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ public void initialize() {
Res.get("offerbook.filterByCurrency"));
currencyComboBoxContainer = currencyBoxTuple.first;
currencyComboBox = currencyBoxTuple.third;
currencyComboBox.setPrefWidth(270);
currencyComboBox.setPrefWidth(250);

Tuple3<VBox, Label, AutocompleteComboBox<PaymentMethod>> 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"));
Expand All @@ -215,7 +215,7 @@ public void initialize() {

var createOfferButtonStack = new StackPane(createOfferButton, disabledCreateOfferButtonTooltip);

Tuple3<VBox, Label, AutoTooltipTextField> autoToolTipTextField = addTopLabelAutoToolTipTextField(Res.get("shared.filter"));
Tuple3<VBox, Label, AutoTooltipTextField> autoToolTipTextField = addTopLabelAutoToolTipTextField("");
VBox filterBox = autoToolTipTextField.first;
filterInputField = autoToolTipTextField.third;
filterInputField.setPromptText(Res.get("market.offerBook.filterPrompt"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,18 @@ private void filterOffers() {
getCurrencyAndMethodPredicate(direction, selectedTradeCurrency);

if (!filterText.isEmpty()) {
Predicate<OfferBookListItem> nextPredicate=offerBookListItem ->
offerBookListItem.getOffer().getOfferPayload().getOwnerNodeAddress().getFullAddress().contains(filterText);
nextPredicate=nextPredicate.or(offerBookListItem ->
offerBookListItem.getOffer().getId().contains(filterText));

// filter node address
Predicate<OfferBookListItem> 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 {
Expand Down

0 comments on commit 7ff096c

Please sign in to comment.