[bisq-network/bisq] Remove GUIUtil.setFitToRowsForTableView(); (#2601)
chimp1984
notifications at github.com
Fri Jan 28 14:56:41 CET 2022
What is not not clear with that code?
```
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);
});
}
```
Also the name suggests whats the intention. That the table hight is adjusted to the number of rows.
To just remove code you don't understand is not useful contribution.
--
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/issues/2601#issuecomment-1024247446
You are receiving this because you are subscribed to this thread.
Message ID: <bisq-network/bisq/issues/2601/1024247446 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20220128/ba06c3c5/attachment-0001.htm>
More information about the bisq-github
mailing list