Revert "show number of offers in payment method pulldown (#2032)" (#2042)

This reverts commit fd985b0c9a.
This commit is contained in:
woodser 2025-11-16 10:32:59 -04:00 committed by GitHub
parent 085eb8df46
commit 7335571e5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 23 deletions

View file

@ -232,22 +232,15 @@ public class OfferBook {
buyOfferCountMap.clear(); buyOfferCountMap.clear();
sellOfferCountMap.clear(); sellOfferCountMap.clear();
final String[] ccyCode = new String[1]; final String[] ccyCode = new String[1];
final String[] paymentMethod = new String[1];
final int[] offerCount = new int[1]; final int[] offerCount = new int[1];
final int[] paymentMethodOfferCount = new int[1];
offerBookListItems.forEach(o -> { offerBookListItems.forEach(o -> {
paymentMethod[0] = o.getOffer().getPaymentMethod().getId();
ccyCode[0] = o.getOffer().getCounterCurrencyCode(); ccyCode[0] = o.getOffer().getCounterCurrencyCode();
if (o.getOffer().getDirection() == BUY) { if (o.getOffer().getDirection() == BUY) {
offerCount[0] = buyOfferCountMap.getOrDefault(ccyCode[0], 0) + 1; offerCount[0] = buyOfferCountMap.getOrDefault(ccyCode[0], 0) + 1;
paymentMethodOfferCount[0] = buyOfferCountMap.getOrDefault(paymentMethod[0], 0) + 1;
buyOfferCountMap.put(ccyCode[0], offerCount[0]); buyOfferCountMap.put(ccyCode[0], offerCount[0]);
buyOfferCountMap.put(paymentMethod[0], paymentMethodOfferCount[0]);
} else { } else {
offerCount[0] = sellOfferCountMap.getOrDefault(ccyCode[0], 0) + 1; offerCount[0] = sellOfferCountMap.getOrDefault(ccyCode[0], 0) + 1;
paymentMethodOfferCount[0] = sellOfferCountMap.getOrDefault(paymentMethod[0], 0) + 1;
sellOfferCountMap.put(ccyCode[0], offerCount[0]); sellOfferCountMap.put(ccyCode[0], offerCount[0]);
sellOfferCountMap.put(paymentMethod[0], paymentMethodOfferCount[0]);
} }
}); });
log.debug("buyOfferCountMap.size {} sellOfferCountMap.size {}", log.debug("buyOfferCountMap.size {} sellOfferCountMap.size {}",

View file

@ -183,6 +183,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
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.setPrefWidth(250); paymentMethodComboBox.setPrefWidth(250);
paymentMethodComboBox.getStyleClass().add("input-with-border"); paymentMethodComboBox.getStyleClass().add("input-with-border");
@ -382,10 +383,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} }
}); });
paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory(Res.get("shared.oneOffer"),
Res.get("shared.multipleOffers"),
offerCounts));
paymentMethodComboBox.setConverter(new PaymentMethodStringConverter(paymentMethodComboBox)); paymentMethodComboBox.setConverter(new PaymentMethodStringConverter(paymentMethodComboBox));
paymentMethodComboBox.getEditor().getStyleClass().add("combo-box-editor-bold"); paymentMethodComboBox.getEditor().getStyleClass().add("combo-box-editor-bold");

View file

@ -561,9 +561,7 @@ public class GUIUtil {
}; };
} }
public static Callback<ListView<PaymentMethod>, ListCell<PaymentMethod>> getPaymentMethodCellFactory(String postFixSingle, public static Callback<ListView<PaymentMethod>, ListCell<PaymentMethod>> getPaymentMethodCellFactory() {
String postFixMulti,
Map<String, Integer> offerCounts) {
return p -> new ListCell<>() { return p -> new ListCell<>() {
@Override @Override
protected void updateItem(PaymentMethod method, boolean empty) { protected void updateItem(PaymentMethod method, boolean empty) {
@ -574,24 +572,16 @@ public class GUIUtil {
HBox box = new HBox(); HBox box = new HBox();
box.setSpacing(20); box.setSpacing(20);
box.setAlignment(Pos.CENTER_LEFT);
Label paymentType = new AutoTooltipLabel(getCurrencyType(method)); Label paymentType = new AutoTooltipLabel(getCurrencyType(method));
paymentType.getStyleClass().add("currency-label-small"); paymentType.getStyleClass().add("currency-label-small");
Label paymentMethod = new AutoTooltipLabel(Res.get(id)); Label paymentMethod = new AutoTooltipLabel(Res.get(id));
paymentMethod.getStyleClass().add("currency-label"); paymentMethod.getStyleClass().add("currency-label");
Label numOffersLabel = new AutoTooltipLabel(); box.getChildren().addAll(paymentType, paymentMethod);
box.getChildren().addAll(paymentType, paymentMethod, numOffersLabel);
if (id.equals(GUIUtil.SHOW_ALL_FLAG)) { if (id.equals(GUIUtil.SHOW_ALL_FLAG)) {
paymentType.setText(Res.get("shared.all")); paymentType.setText(Res.get("shared.all"));
paymentMethod.setText(Res.get("list.currency.showAll")); paymentMethod.setText(Res.get("list.currency.showAll"));
} }
Optional<Integer> offerCountOptional = Optional.ofNullable(offerCounts.get(id));
offerCountOptional.ifPresent(numOffers -> {
HBox.setMargin(numOffersLabel, new Insets(0, 0, 0, NUM_OFFERS_TRANSLATE_X));
numOffersLabel.getStyleClass().add("offer-label");
numOffersLabel.setText(numOffers + " " + (numOffers == 1 ? postFixSingle : postFixMulti));
});
setGraphic(box); setGraphic(box);