diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/DropdownMenu.java b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/DropdownMenu.java index f9fbc897a3..a3367f4b73 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/DropdownMenu.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/DropdownMenu.java @@ -56,6 +56,7 @@ public class DropdownMenu extends HBox { private boolean openUpwards = false; @Setter private boolean openToTheRight = false; + private Double prefWidth = null; public DropdownMenu(String defaultIconId, String activeIconId, boolean useIconOnly) { defaultIcon = ImageUtil.getImageViewById(defaultIconId); @@ -151,6 +152,9 @@ private void attachListeners() { getStyleClass().add("dropdown-menu-active"); updateIcon(activeIcon); isMenuShowing.setValue(true); + if (prefWidth != null && contextMenu.getItems().getFirst() instanceof DropdownMenuItem) { + updateMenuItemWidth(); + } }); contextMenu.setOnHidden(e -> { getStyleClass().remove("dropdown-menu-active"); @@ -163,19 +167,24 @@ private void attachListeners() { isFirstRun = true; // Once the contextMenu has calculated the width on the first render time we update the items // so that they all have the same size. - for (MenuItem item : contextMenu.getItems()) { - if (item instanceof DropdownBisqMenuItem dropdownBisqMenuItem) { - dropdownBisqMenuItem.updateWidth(contextMenu.getWidth() - 18); // Remove margins - } - if (item instanceof DropdownMenuItem dropdownMenuItem) { - dropdownMenuItem.updateWidth(contextMenu.getWidth() - 18); // Remove margins - } - } + prefWidth = contextMenu.getWidth() - 18; // Remove margins + updateMenuItemWidth(); } }; contextMenu.widthProperty().addListener(new WeakChangeListener<>(widthPropertyChangeListener)); } + private void updateMenuItemWidth() { + for (MenuItem item : contextMenu.getItems()) { + if (item instanceof DropdownBisqMenuItem dropdownBisqMenuItem) { + dropdownBisqMenuItem.updateWidth(prefWidth); + } + if (item instanceof DropdownMenuItem dropdownMenuItem) { + dropdownMenuItem.updateWidth(prefWidth); + } + } + } + private void updateIcon(ImageView newIcon) { if (buttonIcon != newIcon) { getChildren().remove(buttonIcon); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/offerbook_list/OfferbookListView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/offerbook_list/OfferbookListView.java index d8c5251f1f..83d38639b4 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/offerbook_list/OfferbookListView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/offerbook_list/OfferbookListView.java @@ -50,6 +50,7 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.util.Callback; import lombok.extern.slf4j.Slf4j; @@ -245,10 +246,10 @@ private void updateMarketPaymentFilters() { cleanUpPaymentsFilterMenu(); model.getAvailableMarketPayments().forEach(payment -> { - ImageView icon = ImageUtil.getImageViewById(payment.getName()); - Label label = new Label(payment.getDisplayString(), icon); - label.setGraphicTextGap(5); - PaymentMenuItem item = new PaymentMenuItem(label); + ImageView paymentIcon = ImageUtil.getImageViewById(payment.getName()); + Label paymentLabel = new Label(payment.getDisplayString(), paymentIcon); + paymentLabel.setGraphicTextGap(10); + PaymentMenuItem item = new PaymentMenuItem(paymentLabel); item.setOnAction(e -> { item.updateSelection(!item.isSelected()); controller.toggleMethodFilter(payment, item.isSelected()); @@ -256,7 +257,10 @@ private void updateMarketPaymentFilters() { paymentsFilterMenu.addMenuItems(item); }); - Label customPaymentLabel = new Label(Res.get("bisqEasy.offerbook.offerList.table.filters.paymentMethods.customMethod")); + StackPane customPaymentIcon = BisqEasyViewUtils.getCustomPaymentMethodIcon("C"); + Label customPaymentLabel = new Label( + Res.get("bisqEasy.offerbook.offerList.table.filters.paymentMethods.customPayments"), customPaymentIcon); + customPaymentLabel.setGraphicTextGap(10); PaymentMenuItem customItem = new PaymentMenuItem(customPaymentLabel); customItem.setOnAction(e -> { customItem.updateSelection(!customItem.isSelected()); diff --git a/i18n/src/main/resources/bisq_easy.properties b/i18n/src/main/resources/bisq_easy.properties index 1026853046..0494bffbad 100644 --- a/i18n/src/main/resources/bisq_easy.properties +++ b/i18n/src/main/resources/bisq_easy.properties @@ -455,7 +455,7 @@ bisqEasy.offerbook.offerList.table.filters.offerDirection.buyFrom=Buy from bisqEasy.offerbook.offerList.table.filters.offerDirection.sellTo=Sell to bisqEasy.offerbook.offerList.table.filters.paymentMethods.title=Payments ({0}) bisqEasy.offerbook.offerList.table.filters.paymentMethods.title.all=All -bisqEasy.offerbook.offerList.table.filters.paymentMethods.customMethod=Custom methods +bisqEasy.offerbook.offerList.table.filters.paymentMethods.customPayments=Custom payments bisqEasy.offerbook.offerList.table.columns.price.tooltip.fixPrice=Fixed price: {0}\nPercentage from current market price: {1} bisqEasy.offerbook.offerList.table.columns.price.tooltip.marketPrice=Market price: {0}