From 995844feb33c714d1178af21ce5488294895dd24 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Fri, 29 Mar 2019 16:44:34 -0500 Subject: [PATCH] Remove setFitToRowsForTableView, update merit at activate --- .../governance/proposals/ProposalsView.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 1a5190642d..a1f658709b 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -54,6 +54,7 @@ import bisq.core.user.Preferences; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.common.UserThread; import bisq.common.app.DevEnv; import bisq.common.util.Tuple2; import bisq.common.util.Tuple3; @@ -148,7 +149,7 @@ public class ProposalsView extends ActivatableView implements Bs int extraRows = screenSize <= INITIAL_WINDOW_HEIGHT ? 0 : (int) ((screenSize - INITIAL_WINDOW_HEIGHT) / pixelsPerProposalTableRow); return extraRows == 0 ? initialProposalTableViewHeight : Math.ceil(initialProposalTableViewHeight + (extraRows * pixelsPerProposalTableRow)); }; - private ChangeListener bisqWindowVerticalSizeListener; + private ChangeListener sceneHeightListener; private TableGroupHeadline proposalsHeadline; @@ -187,14 +188,7 @@ public class ProposalsView extends ActivatableView implements Bs ballotListChangeListener = c -> updateListItems(); proposalListChangeListener = c -> updateListItems(); - bisqWindowVerticalSizeListener = (observable, oldValue, newValue) -> { - double newTableViewHeight = proposalTableViewHeight.apply(newValue.doubleValue()); - if (tableView.getHeight() != newTableViewHeight) { - tableView.setMinHeight(newTableViewHeight); - double diff = newTableViewHeight - tableView.getHeight(); - proposalsHeadline.setMaxHeight(proposalsHeadline.getHeight() + diff); - } - }; + sceneHeightListener = (observable, oldValue, newValue) -> updateTableHeight(newValue.doubleValue()); stakeListener = (observable, oldValue, newValue) -> updateViews(); } @@ -225,10 +219,14 @@ public class ProposalsView extends ActivatableView implements Bs bsqWalletService.getUnlockingBondsBalance()); updateListItems(); - GUIUtil.setFitToRowsForTableView(tableView, 38, 28, 4, 4); + tableView.setPrefHeight(100); updateViews(); - root.getScene().heightProperty().addListener(bisqWindowVerticalSizeListener); + updateListItems(); + applyMerit(); + + root.getScene().heightProperty().addListener(sceneHeightListener); + UserThread.execute(() -> updateTableHeight(root.getScene().getHeight())); } @Override @@ -591,6 +589,15 @@ public class ProposalsView extends ActivatableView implements Bs return daoFacade.isInPhaseButNotLastBlock(DaoPhase.Phase.BLIND_VOTE); } + private void updateTableHeight(double height) { + double newTableViewHeight = proposalTableViewHeight.apply(height); + if (tableView.getHeight() != newTableViewHeight) { + tableView.setMinHeight(newTableViewHeight); + double diff = newTableViewHeight - tableView.getHeight(); + proposalsHeadline.setMaxHeight(proposalsHeadline.getHeight() + diff); + } + } + /////////////////////////////////////////////////////////////////////////////////////////// // Create views