Skip to content

Commit

Permalink
Merge pull request #4031 from jmacxx/fix_resize_issue_4030
Browse files Browse the repository at this point in the history
Size the offer book on window activation
  • Loading branch information
ripcurlx authored Mar 18, 2020
2 parents d9b5422 + 02d37b7 commit 89cfb34
Showing 1 changed file with 16 additions and 7 deletions.
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);
}
}

0 comments on commit 89cfb34

Please sign in to comment.