Skip to content

Commit

Permalink
Merge pull request #5831 from jmacxx/fix_display_failed_trade_tab
Browse files Browse the repository at this point in the history
Fix display of missing Failed Trade tab
  • Loading branch information
ripcurlx authored Nov 16, 2021
2 parents 83c9355 + daee634 commit 7faaa9d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class PortfolioView extends ActivatableView<TabPane, Void> {
private boolean editOpenOfferViewOpen;
private OpenOffer openOffer;
private OpenOffersView openOffersView;
private int initialTabCount = 0;

@Inject
public PortfolioView(CachingViewLoader viewLoader, Navigation navigation, FailedTradesManager failedTradesManager) {
Expand All @@ -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);

Expand Down Expand Up @@ -151,10 +153,10 @@ private void onDuplicateOfferRemoved() {
@Override
protected void activate() {
failedTradesManager.getObservableList().addListener((ListChangeListener<Trade>) 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);
Expand Down

0 comments on commit 7faaa9d

Please sign in to comment.