mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Size the offer book on window activation
Currently the offer book tables are only being sized when the window proportions change. However if the window is made bigger before the offer book is opened, then the tables are not resized from their default. Other windows (for example Market -> Trades) solve this by make a sizing call in the activate method. In order to do this the sizing code is separated into a layout method where it can be called from both activate and the existing heightProperty listener. The same approach is taken here. Fixes #4030
This commit is contained in:
parent
879c3f2eb2
commit
02d37b7042
1 changed files with 16 additions and 7 deletions
|
@ -42,6 +42,7 @@ import bisq.core.util.coin.CoinFormatter;
|
|||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
||||
import bisq.common.UserThread;
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.util.Tuple3;
|
||||
import bisq.common.util.Tuple4;
|
||||
|
@ -91,6 +92,7 @@ import javafx.util.StringConverter;
|
|||
|
||||
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;
|
||||
|
@ -280,6 +282,7 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
sellOfferTableView.getSelectionModel().selectedItemProperty().addListener(sellTableRowSelectionListener);
|
||||
|
||||
root.getScene().heightProperty().addListener(bisqWindowVerticalSizeListener);
|
||||
layout();
|
||||
|
||||
updateChartData();
|
||||
}
|
||||
|
@ -321,13 +324,7 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
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
|
||||
|
@ -665,4 +662,16 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue