This commit is contained in:
preland 2024-12-04 15:05:37 -06:00
parent cfaf163bbc
commit 63f54e8d1b
No known key found for this signature in database
GPG Key ID: 298D38A9E7C9F8A1

View File

@ -208,18 +208,18 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
}); });
Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> marketPriceBox = getMarketPriceBox(); //Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> marketPriceBox = getMarketPriceBox();
ComboBox<PriceFeedComboBoxItem> priceComboBox = marketPriceBox.first; //ComboBox<PriceFeedComboBoxItem> priceComboBox = marketPriceBox.first;
priceComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> //priceComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) ->
model.setPriceFeedComboBoxItem(newValue)); //model.setPriceFeedComboBoxItem(newValue));
ChangeListener<PriceFeedComboBoxItem> selectedPriceFeedItemListener = (observable, oldValue, newValue) -> { //ChangeListener<PriceFeedComboBoxItem> selectedPriceFeedItemListener = (observable, oldValue, newValue) -> {
if (newValue != null) //if (newValue != null)
priceComboBox.getSelectionModel().select(newValue); //priceComboBox.getSelectionModel().select(newValue);
}; //};
model.getSelectedPriceFeedComboBoxItemProperty().addListener(selectedPriceFeedItemListener); //model.getSelectedPriceFeedComboBoxItemProperty().addListener(selectedPriceFeedItemListener);
priceComboBox.setItems(model.getPriceFeedComboBoxItems()); //priceComboBox.setItems(model.getPriceFeedComboBoxItems());
Tuple2<Label, VBox> availableBalanceBox = getBalanceBox(Res.get("mainView.balance.available")); Tuple2<Label, VBox> availableBalanceBox = getBalanceBox(Res.get("mainView.balance.available"));
availableBalanceBox.first.textProperty().bind(model.getAvailableBalance()); availableBalanceBox.first.textProperty().bind(model.getAvailableBalance());
@ -311,16 +311,16 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
secondaryNav.setAlignment(Pos.CENTER); secondaryNav.setAlignment(Pos.CENTER);
HBox priceAndBalance = new HBox(marketPriceBox.second, getNavigationSeparator(), availableBalanceBox.second, //HBox priceAndBalance = new HBox(marketPriceBox.second, getNavigationSeparator(), availableBalanceBox.second,
getNavigationSeparator(), pendingBalanceBox.second, getNavigationSeparator(), reservedBalanceBox.second); //getNavigationSeparator(), pendingBalanceBox.second, getNavigationSeparator(), reservedBalanceBox.second);
priceAndBalance.setMaxHeight(41); //priceAndBalance.setMaxHeight(41);
priceAndBalance.setAlignment(Pos.CENTER); //priceAndBalance.setAlignment(Pos.CENTER);
priceAndBalance.setSpacing(9); //priceAndBalance.setSpacing(9);
priceAndBalance.getStyleClass().add("nav-price-balance"); //priceAndBalance.getStyleClass().add("nav-price-balance");
HBox navPane = new HBox(primaryNav, secondaryNav, getNavigationSpacer(), HBox navPane = new HBox(primaryNav, secondaryNav, getNavigationSpacer()
priceAndBalance) {{ ) {{
setLeftAnchor(this, 0d); setLeftAnchor(this, 0d);
setRightAnchor(this, 0d); setRightAnchor(this, 0d);
setTopAnchor(this, 0d); setTopAnchor(this, 0d);
@ -437,35 +437,35 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
}; };
} }
private Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> getMarketPriceBox() { //private Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> getMarketPriceBox() {
//
VBox marketPriceBox = new VBox(); // VBox marketPriceBox = new VBox();
marketPriceBox.setAlignment(Pos.CENTER_LEFT); // marketPriceBox.setAlignment(Pos.CENTER_LEFT);
//
ComboBox<PriceFeedComboBoxItem> priceComboBox = new JFXComboBox<>(); // ComboBox<PriceFeedComboBoxItem> priceComboBox = new JFXComboBox<>();
priceComboBox.setVisibleRowCount(12); // priceComboBox.setVisibleRowCount(12);
priceComboBox.setFocusTraversable(false); // priceComboBox.setFocusTraversable(false);
priceComboBox.setId("price-feed-combo"); // priceComboBox.setId("price-feed-combo");
priceComboBox.setPadding(new Insets(0, -4, -4, 0)); // priceComboBox.setPadding(new Insets(0, -4, -4, 0));
priceComboBox.setCellFactory(p -> getPriceFeedComboBoxListCell()); // priceComboBox.setCellFactory(p -> getPriceFeedComboBoxListCell());
ListCell<PriceFeedComboBoxItem> buttonCell = getPriceFeedComboBoxListCell(); // ListCell<PriceFeedComboBoxItem> buttonCell = getPriceFeedComboBoxListCell();
buttonCell.setId("price-feed-combo"); // buttonCell.setId("price-feed-combo");
priceComboBox.setButtonCell(buttonCell); // priceComboBox.setButtonCell(buttonCell);
//
Label marketPriceLabel = new Label(); // Label marketPriceLabel = new Label();
//
updateMarketPriceLabel(marketPriceLabel); // updateMarketPriceLabel(marketPriceLabel);
//
marketPriceLabel.getStyleClass().add("nav-balance-label"); // marketPriceLabel.getStyleClass().add("nav-balance-label");
marketPriceLabel.setPadding(new Insets(-2, 0, 4, 9)); // marketPriceLabel.setPadding(new Insets(-2, 0, 4, 9));
//
marketPriceBox.getChildren().addAll(priceComboBox, marketPriceLabel); // marketPriceBox.getChildren().addAll(priceComboBox, marketPriceLabel);
//
model.getMarketPriceUpdated().addListener((observable, oldValue, newValue) -> // model.getMarketPriceUpdated().addListener((observable, oldValue, newValue) ->
updateMarketPriceLabel(marketPriceLabel)); // updateMarketPriceLabel(marketPriceLabel));
//
return new Tuple2<>(priceComboBox, marketPriceBox); // return new Tuple2<>(priceComboBox, marketPriceBox);
} //}
@NotNull @NotNull
private String getPriceProvider() { private String getPriceProvider() {