From f5d24936b2fabcb89e264b74b0f91e63118312aa Mon Sep 17 00:00:00 2001 From: Steven Barclay Date: Thu, 3 Oct 2019 07:03:51 +0100 Subject: [PATCH] Fix proposal table hide when switching to another screen and back Do not remove the proposals table when VoteResultView is deactivated, as the cycle selection which triggered its display is still active upon switching to another screen and back again. This fixes #3269. Also remove a spurious 'GUIUtil.removeChildrenFromGridPaneRows' call when a proposal result is selected, as it is no longer needed since switching from an inline votes table to a popup. --- .../main/dao/governance/result/VoteResultView.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java index ee3f1ad6ad5..03771142bd2 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java @@ -207,6 +207,9 @@ protected void activate() { }); if (proposalsTableView != null) { GUIUtil.setFitToRowsForTableView(proposalsTableView, 25, 28, 6, 6); + + selectedProposalSubscription = EasyBind.subscribe(proposalsTableView.getSelectionModel().selectedItemProperty(), + this::onSelectProposalResultListItem); } GUIUtil.setFitToRowsForTableView(cyclesTableView, 25, 28, 6, 6); } @@ -215,8 +218,6 @@ protected void activate() { protected void deactivate() { super.deactivate(); - onResultsListItemSelected(null); - phasesView.deactivate(); daoFacade.removeBsqStateListener(this); @@ -296,7 +297,7 @@ private void onResultsListItemSelected(CycleListItem item) { }); }); - if (!sb.toString().isEmpty()) { + if (sb.length() != 0) { new Popup<>().information(Res.get("dao.results.invalidVotes", sb.toString())).show(); } } @@ -327,10 +328,6 @@ private void maybeShowVoteResultErrors(Cycle cycle) { private void onSelectProposalResultListItem(ProposalListItem item) { selectedProposalListItem = item; - GUIUtil.removeChildrenFromGridPaneRows(root, 5, gridRow); - gridRow = 3; - - if (selectedProposalListItem != null) { EvaluatedProposal evaluatedProposal = selectedProposalListItem.getEvaluatedProposal(); Optional optionalBallot = daoFacade.getAllValidBallots().stream() @@ -465,8 +462,8 @@ private void createProposalsTable() { proposalsTableView.setItems(sortedProposalList); sortedProposalList.comparatorProperty().bind(proposalsTableView.comparatorProperty()); - proposalList.clear(); proposalList.forEach(ProposalListItem::resetTableRow); + proposalList.clear(); Map ballotByProposalTxIdMap = daoFacade.getAllValidBallots().stream() .collect(Collectors.toMap(Ballot::getTxId, ballot -> ballot));