mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
search by payment method in filter and tweak ui
This commit is contained in:
parent
7c8753c17b
commit
b03c873a06
3 changed files with 16 additions and 8 deletions
|
@ -312,7 +312,7 @@ market.tabs.spreadPayment=Offers by Payment Method
|
||||||
market.tabs.trades=Trades
|
market.tabs.trades=Trades
|
||||||
|
|
||||||
# OfferBookView
|
# OfferBookView
|
||||||
market.offerBook.filterPrompt=Offer ID, address...
|
market.offerBook.filterPrompt=Filter
|
||||||
|
|
||||||
# OfferBookChartView
|
# OfferBookChartView
|
||||||
market.offerBook.sellOffersHeaderLabel=Sell {0} to
|
market.offerBook.sellOffersHeaderLabel=Sell {0} to
|
||||||
|
|
|
@ -188,13 +188,13 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
Res.get("offerbook.filterByCurrency"));
|
Res.get("offerbook.filterByCurrency"));
|
||||||
currencyComboBoxContainer = currencyBoxTuple.first;
|
currencyComboBoxContainer = currencyBoxTuple.first;
|
||||||
currencyComboBox = currencyBoxTuple.third;
|
currencyComboBox = currencyBoxTuple.third;
|
||||||
currencyComboBox.setPrefWidth(270);
|
currencyComboBox.setPrefWidth(250);
|
||||||
|
|
||||||
Tuple3<VBox, Label, AutocompleteComboBox<PaymentMethod>> paymentBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
|
Tuple3<VBox, Label, AutocompleteComboBox<PaymentMethod>> paymentBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
|
||||||
Res.get("offerbook.filterByPaymentMethod"));
|
Res.get("offerbook.filterByPaymentMethod"));
|
||||||
paymentMethodComboBox = paymentBoxTuple.third;
|
paymentMethodComboBox = paymentBoxTuple.third;
|
||||||
paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory());
|
paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory());
|
||||||
paymentMethodComboBox.setPrefWidth(270);
|
paymentMethodComboBox.setPrefWidth(250);
|
||||||
|
|
||||||
matchingOffersToggle = new AutoTooltipSlideToggleButton();
|
matchingOffersToggle = new AutoTooltipSlideToggleButton();
|
||||||
matchingOffersToggle.setText(Res.get("offerbook.matchingOffers"));
|
matchingOffersToggle.setText(Res.get("offerbook.matchingOffers"));
|
||||||
|
@ -215,7 +215,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
|
|
||||||
var createOfferButtonStack = new StackPane(createOfferButton, disabledCreateOfferButtonTooltip);
|
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;
|
VBox filterBox = autoToolTipTextField.first;
|
||||||
filterInputField = autoToolTipTextField.third;
|
filterInputField = autoToolTipTextField.third;
|
||||||
filterInputField.setPromptText(Res.get("market.offerBook.filterPrompt"));
|
filterInputField.setPromptText(Res.get("market.offerBook.filterPrompt"));
|
||||||
|
|
|
@ -574,10 +574,18 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
|
||||||
getCurrencyAndMethodPredicate(direction, selectedTradeCurrency);
|
getCurrencyAndMethodPredicate(direction, selectedTradeCurrency);
|
||||||
|
|
||||||
if (!filterText.isEmpty()) {
|
if (!filterText.isEmpty()) {
|
||||||
Predicate<OfferBookListItem> nextPredicate=offerBookListItem ->
|
|
||||||
offerBookListItem.getOffer().getOfferPayload().getOwnerNodeAddress().getFullAddress().contains(filterText);
|
// filter node address
|
||||||
nextPredicate=nextPredicate.or(offerBookListItem ->
|
Predicate<OfferBookListItem> nextPredicate = offerBookListItem ->
|
||||||
offerBookListItem.getOffer().getId().contains(filterText));
|
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));
|
filteredItems.setPredicate(predicate.and(nextPredicate));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue