Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GUIUtil.setFitToRowsForTableView #6003

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ protected void activate() {
bondedReputationRepository.getBonds().addListener(bondedReputationListener);
bondedRolesRepository.getBonds().addListener(bondedRolesListener);
updateList();
GUIUtil.setFitToRowsForTableView(tableView, 37, 28, 2, 30);
}

@Override
Expand Down Expand Up @@ -150,7 +149,6 @@ private void updateList() {
.map(bond -> new BondListItem(bond, bsqFormatter))
.sorted(Comparator.comparing(BondListItem::getLockupDateString).reversed())
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(tableView, 37, 28, 2, 30);
if (selectedBond != null) {
Bond bond = selectedBond;
selectedBond = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ protected void activate() {
setNewRandomSalt();

updateList();
GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 30);
}

@Override
Expand Down Expand Up @@ -261,7 +260,6 @@ private void updateList() {
.map(myBondedReputation -> new MyReputationListItem(myBondedReputation, bsqFormatter))
.sorted(Comparator.comparing(MyReputationListItem::getLockupDateString).reversed())
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 30);
}

private void setNewRandomSalt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ protected void activate() {
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
daoFacade.getBondedRoles().addListener(bondedRoleListChangeListener);
updateList();
GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 30);
}

@Override
Expand All @@ -124,7 +123,6 @@ private void updateList() {
.map(bond -> new RolesListItem(bond, daoFacade))
.sorted(Comparator.comparing(RolesListItem::getLockupDate).reversed())
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 30);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ protected void activate() {
});


GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 100);
updateButtonState();

feeAmountInputTextField.resetValidation();
Expand Down Expand Up @@ -301,7 +300,6 @@ private void updateList() {
observableList.setAll(statefulAssets.stream()
.map(statefulAsset -> new AssetListItem(statefulAsset, bsqFormatter))
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 100);
}

private void updateButtonState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ protected void activate() {
preImageTextField.setValidator(new InputValidator());

updateList();
GUIUtil.setFitToRowsForTableView(myItemsTableView, 41, 28, 4, 6);
GUIUtil.setFitToRowsForTableView(allTxsTableView, 41, 28, 2, 10);
updateButtonState();
}

Expand Down Expand Up @@ -265,12 +263,10 @@ private void updateList() {
.map(myProofOfBurn -> new MyProofOfBurnListItem(myProofOfBurn, proofOfBurnService, bsqFormatter))
.sorted(Comparator.comparing(MyProofOfBurnListItem::getDate).reversed())
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(myItemsTableView, 41, 28, 4, 6);

allItemsObservableList.setAll(proofOfBurnService.getProofOfBurnTxList().stream()
.map(tx -> new ProofOfBurnListItem(tx, proofOfBurnService, bsqFormatter))
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(allTxsTableView, 41, 28, 2, 10);
}

private void updateButtonState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,9 @@ protected void activate() {
GUIUtil.exportJSON("voteResultsHistory.json", cyclesJsonArray, (Stage) root.getScene().getWindow());
});
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);
}

@Override
Expand Down Expand Up @@ -434,8 +431,6 @@ private void doFillCycleList() {
cyclesAdded.add(resultsOfCycle.getCycle());
});
cycleListItemList.sort(Comparator.comparing(e -> ((CycleListItem) e).getResultsOfCycle().getCycleIndex()).reversed());

GUIUtil.setFitToRowsForTableView(cyclesTableView, 25, 28, 6, 6);
}


Expand Down Expand Up @@ -516,7 +511,6 @@ private void createProposalsTable() {
isVoteIncludedInResult,
bsqFormatter))
.collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(proposalsTableView, 25, 28, 6, 100);
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ protected void activate() {
if (daoStateService.isParseBlockChainComplete()) {
onDataUpdate();
}

GUIUtil.setFitToRowsForTableView(tableView, 25, 28, 2, 5);
GUIUtil.setFitToRowsForTableView(conflictTableView, 38, 28, 2, 4);
}

@Override
Expand Down Expand Up @@ -255,7 +252,6 @@ private void onSelectItem(BLI item) {
if (item != null) {
conflictListItems.setAll(item.getStateBlock().getInConflictMap().entrySet().stream()
.map(this::getStateInConflictListItem).collect(Collectors.toList()));
GUIUtil.setFitToRowsForTableView(conflictTableView, 38, 28, 2, 4);
}
}

Expand All @@ -280,8 +276,6 @@ protected void onDataUpdate() {
statusTextField.setText(Res.get("dao.monitor.daoStateInSync"));
statusTextField.getStyleClass().remove("dao-inConflict");
}

GUIUtil.setFitToRowsForTableView(tableView, 25, 28, 2, 5);
}

private void resyncDaoState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ protected void addContent() {
.map(transactionOutput -> new TransactionOutputItem(transactionOutput, candidates.contains(transactionOutput)))
.collect(Collectors.toList()));
tableView.setItems(new SortedList<>(items));
GUIUtil.setFitToRowsForTableView(tableView, 26, 28, 0, items.size());

balanceTextField = FormBuilder.addBalanceTextField(gridPane, rowIndex++, Res.get("inputControlWindow.balanceLabel"), Layout.FIRST_ROW_DISTANCE);
balanceTextField.setFormatter(formatter);
Expand Down
24 changes: 0 additions & 24 deletions desktop/src/main/java/bisq/desktop/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1030,30 +1030,6 @@ public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txVsize, Bs
showBsqFeeInfoPopup(fee, miningFee, null, txVsize, bsqFormatter, btcFormatter, type, actionHandler);
}

public static void setFitToRowsForTableView(TableView<?> tableView,
int rowHeight,
int headerHeight,
int minNumRows,
int maxNumRows) {
int size = tableView.getItems().size();
int minHeight = rowHeight * minNumRows + headerHeight;
int maxHeight = rowHeight * maxNumRows + headerHeight;
checkArgument(maxHeight >= minHeight, "maxHeight cannot be smaller as minHeight");
int height = Math.min(maxHeight, Math.max(minHeight, size * rowHeight + headerHeight));

tableView.setPrefHeight(-1);
tableView.setVisible(false);
// We need to delay the setter to the next render frame as otherwise views don' get updated in some cases
// Not 100% clear what causes that issue, but seems the requestLayout method is not called otherwise.
// We still need to set the height immediately, otherwise some views render an incorrect layout.
tableView.setPrefHeight(height);

UserThread.execute(() -> {
tableView.setPrefHeight(height);
tableView.setVisible(true);
});
}

public static Tuple2<ComboBox<TradeCurrency>, Integer> addRegionCountryTradeCurrencyComboBoxes(GridPane gridPane,
int gridRow,
Consumer<Country> onCountrySelectedHandler,
Expand Down