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.
This commit is contained in:
Steven Barclay 2019-10-03 07:03:51 +01:00
parent 7bed73e687
commit f5d24936b2

View File

@ -207,6 +207,9 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
});
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 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
protected void deactivate() {
super.deactivate();
onResultsListItemSelected(null);
phasesView.deactivate();
daoFacade.removeBsqStateListener(this);
@ -296,7 +297,7 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
});
});
if (!sb.toString().isEmpty()) {
if (sb.length() != 0) {
new Popup<>().information(Res.get("dao.results.invalidVotes", sb.toString())).show();
}
}
@ -327,10 +328,6 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
private void onSelectProposalResultListItem(ProposalListItem item) {
selectedProposalListItem = item;
GUIUtil.removeChildrenFromGridPaneRows(root, 5, gridRow);
gridRow = 3;
if (selectedProposalListItem != null) {
EvaluatedProposal evaluatedProposal = selectedProposalListItem.getEvaluatedProposal();
Optional<Ballot> optionalBallot = daoFacade.getAllValidBallots().stream()
@ -465,8 +462,8 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
proposalsTableView.setItems(sortedProposalList);
sortedProposalList.comparatorProperty().bind(proposalsTableView.comparatorProperty());
proposalList.clear();
proposalList.forEach(ProposalListItem::resetTableRow);
proposalList.clear();
Map<String, Ballot> ballotByProposalTxIdMap = daoFacade.getAllValidBallots().stream()
.collect(Collectors.toMap(Ballot::getTxId, ballot -> ballot));