From daee63490ecf84feec71b2022e3be5c7a952302e Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Mon, 15 Nov 2021 11:10:16 -0600 Subject: [PATCH] Fix display of missing failed trade tab --- .../java/bisq/desktop/main/portfolio/PortfolioView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/PortfolioView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/PortfolioView.java index 872000d8f33..08ed465c052 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/PortfolioView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/PortfolioView.java @@ -72,6 +72,7 @@ public class PortfolioView extends ActivatableView { private boolean editOpenOfferViewOpen; private OpenOffer openOffer; private OpenOffersView openOffersView; + private int initialTabCount = 0; @Inject public PortfolioView(CachingViewLoader viewLoader, Navigation navigation, FailedTradesManager failedTradesManager) { @@ -82,6 +83,7 @@ public PortfolioView(CachingViewLoader viewLoader, Navigation navigation, Failed @Override public void initialize() { + initialTabCount = root.getTabs().size(); root.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS); failedTradesTab.setClosable(false); @@ -151,10 +153,10 @@ private void onDuplicateOfferRemoved() { @Override protected void activate() { failedTradesManager.getObservableList().addListener((ListChangeListener) c -> { - if (failedTradesManager.getObservableList().size() > 0 && root.getTabs().size() == 3) + if (failedTradesManager.getObservableList().size() > 0 && root.getTabs().size() == initialTabCount) root.getTabs().add(failedTradesTab); }); - if (failedTradesManager.getObservableList().size() > 0 && root.getTabs().size() == 3) + if (failedTradesManager.getObservableList().size() > 0 && root.getTabs().size() == initialTabCount) root.getTabs().add(failedTradesTab); root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);