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

Size the offer book on window activation #4031

Merged
merged 1 commit into from Mar 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

import bisq.network.p2p.NodeAddress;

import bisq.common.UserThread;
import bisq.common.config.Config;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
Expand Down Expand Up @@ -91,6 +92,7 @@

import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

import static bisq.desktop.util.FormBuilder.addTopLabelAutocompleteComboBox;
Expand Down Expand Up @@ -280,6 +282,7 @@ public Number fromString(String string) {
sellOfferTableView.getSelectionModel().selectedItemProperty().addListener(sellTableRowSelectionListener);

root.getScene().heightProperty().addListener(bisqWindowVerticalSizeListener);
layout();

updateChartData();
}
Expand Down Expand Up @@ -321,13 +324,7 @@ private void createListener() {
navigation.navigateTo(MainView.class, BuyOfferView.class);
};

bisqWindowVerticalSizeListener = (observable, oldValue, newValue) -> {
double newTableViewHeight = offerTableViewHeight.apply(newValue.doubleValue());
if (buyOfferTableView.getHeight() != newTableViewHeight) {
buyOfferTableView.setMinHeight(newTableViewHeight);
sellOfferTableView.setMinHeight(newTableViewHeight);
}
};
bisqWindowVerticalSizeListener = (observable, oldValue, newValue) -> layout();
}

@Override
Expand Down Expand Up @@ -665,4 +662,16 @@ private void reverseTableColumns() {
Collections.reverse(columns);
sellOfferTableView.getColumns().addAll(columns);
}

private void layout() {
UserThread.runAfter(() -> {
if (root.getScene() != null) {
double newTableViewHeight = offerTableViewHeight.apply(root.getScene().getHeight());
if (buyOfferTableView.getHeight() != newTableViewHeight) {
buyOfferTableView.setMinHeight(newTableViewHeight);
sellOfferTableView.setMinHeight(newTableViewHeight);
}
}
}, 100, TimeUnit.MILLISECONDS);
}
}