Skip to content

Commit

Permalink
Simplify containers and improve truncation behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ripcurlx committed Nov 8, 2021
1 parent 2b90633 commit 07e224e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
private ComboBox<PaymentAccount> paymentAccountsComboBox;
private ComboBox<TradeCurrency> currencyComboBox;
private ImageView qrCodeImageView;
private VBox currencySelection, fixedPriceBox, percentagePriceBox, currencyTextFieldBox, triggerPriceVBox, buyBsqBox;
private VBox currencySelection, fixedPriceBox, percentagePriceBox, currencyTextFieldBox, triggerPriceVBox;
private HBox fundingHBox, firstRowHBox, secondRowHBox, placeOfferBox, amountValueCurrencyBox,
priceAsPercentageValueCurrencyBox, volumeValueCurrencyBox, priceValueCurrencyBox,
minAmountValueCurrencyBox, advancedOptionsBox, triggerPriceHBox;
minAmountValueCurrencyBox, advancedOptionsBox, triggerPriceHBox, buyBsqBox;

private Subscription isWaitingForFundsSubscription, balanceSubscription;
private ChangeListener<Boolean> amountFocusedListener, minAmountFocusedListener, volumeFocusedListener,
Expand Down Expand Up @@ -1100,18 +1100,21 @@ private void addOptionsGroup() {
advancedOptionsBox.setSpacing(40);

GridPane.setRowIndex(advancedOptionsBox, gridRow);
GridPane.setColumnSpan(advancedOptionsBox, GridPane.REMAINING);
GridPane.setColumnIndex(advancedOptionsBox, 0);
GridPane.setHalignment(advancedOptionsBox, HPos.LEFT);
GridPane.setMargin(advancedOptionsBox, new Insets(Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
gridPane.getChildren().add(advancedOptionsBox);

Tuple2<AutoTooltipButton, VBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
Tuple2<AutoTooltipButton, HBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
navigation, preferences);
buyBsqBox = buyBsqButtonBox.second;
buyBsqBox.setManaged(false);
buyBsqBox.setVisible(false);

advancedOptionsBox.getChildren().addAll(getBuyerSecurityDepositBox(), getTradeFeeFieldsBox(), buyBsqBox);
VBox tradeFeeFieldsBox = getTradeFeeFieldsBox();
tradeFeeFieldsBox.setMinWidth(240);
advancedOptionsBox.getChildren().addAll(getBuyerSecurityDepositBox(), tradeFeeFieldsBox, buyBsqBox);

Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane, ++gridRow,
Res.get("shared.nextStep"), Res.get("shared.cancel"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

import javafx.geometry.HPos;
import javafx.geometry.Insets;
Expand Down Expand Up @@ -85,12 +84,13 @@ public static void addPayInfoEntry(GridPane infoGridPane, int row, String labelT
infoGridPane.getChildren().addAll(label, textField);
}

public static Tuple2<AutoTooltipButton, VBox> createBuyBsqButtonBox(Navigation navigation,
public static Tuple2<AutoTooltipButton, HBox> createBuyBsqButtonBox(Navigation navigation,
Preferences preferences) {
String buyBsqText = Res.get("shared.buyCurrency", "BSQ");
var buyBsqButton = new AutoTooltipButton(buyBsqText);
buyBsqButton.getStyleClass().add("action-button");
buyBsqButton.getStyleClass().add("tiny-button");
buyBsqButton.setMinWidth(60);
buyBsqButton.setOnAction(e -> openBuyBsqOfferBook(navigation, preferences)
);

Expand All @@ -101,17 +101,14 @@ public static Tuple2<AutoTooltipButton, VBox> createBuyBsqButtonBox(Navigation n
.actionButtonText(buyBsqText)
.buttonAlignment(HPos.CENTER)
.onAction(() -> openBuyBsqOfferBook(navigation, preferences)).show());
learnMore.setMinWidth(100);

final HBox buyBsqBox = new HBox(buyBsqButton, info, learnMore);
HBox buyBsqBox = new HBox(buyBsqButton, info, learnMore);
buyBsqBox.setAlignment(Pos.BOTTOM_LEFT);
buyBsqBox.setSpacing(10);
buyBsqBox.setPadding(new Insets(0, 0, 4, -20));

final VBox buyBsqButtonVBox = new VBox(buyBsqBox);
buyBsqButtonVBox.setAlignment(Pos.BOTTOM_LEFT);
buyBsqButtonVBox.setPadding(new Insets(0, 0, 0, -20));
VBox.setMargin(buyBsqButton, new Insets(0, 0, 4, 0));

return new Tuple2<>(buyBsqButton, buyBsqButtonVBox);
return new Tuple2<>(buyBsqButton, buyBsqBox);
}

private static void openBuyBsqOfferBook(Navigation navigation, Preferences preferences) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private ScrollPane scrollPane;
private GridPane gridPane;
private TitledGroupBg payFundsTitledGroupBg, paymentAccountTitledGroupBg, advancedOptionsGroup;
private VBox priceAsPercentageInputBox, amountRangeBox, buyBsqBox;
private VBox priceAsPercentageInputBox, amountRangeBox;
private HBox fundingHBox, amountValueCurrencyBox, priceValueCurrencyBox, volumeValueCurrencyBox,
priceAsPercentageValueCurrencyBox, minAmountValueCurrencyBox, advancedOptionsBox,
takeOfferBox, buttonBox, firstRowHBox;
takeOfferBox, buttonBox, firstRowHBox, buyBsqBox;
private ComboBox<PaymentAccount> paymentAccountsComboBox;
private Label amountDescriptionLabel,
paymentMethodLabel,
Expand Down Expand Up @@ -878,18 +878,21 @@ private void addOptionsGroup() {
advancedOptionsBox.setSpacing(40);

GridPane.setRowIndex(advancedOptionsBox, gridRow);
GridPane.setColumnSpan(advancedOptionsBox, GridPane.REMAINING);
GridPane.setColumnIndex(advancedOptionsBox, 0);
GridPane.setHalignment(advancedOptionsBox, HPos.LEFT);
GridPane.setMargin(advancedOptionsBox, new Insets(Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
gridPane.getChildren().add(advancedOptionsBox);

Tuple2<AutoTooltipButton, VBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
Tuple2<AutoTooltipButton, HBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
navigation, model.dataModel.preferences);
buyBsqBox = buyBsqButtonBox.second;
buyBsqBox.setManaged(false);
buyBsqBox.setVisible(false);

advancedOptionsBox.getChildren().addAll(getTradeFeeFieldsBox(), buyBsqBox);
VBox tradeFeeFieldsBox = getTradeFeeFieldsBox();
tradeFeeFieldsBox.setMinWidth(240);
advancedOptionsBox.getChildren().addAll(tradeFeeFieldsBox, buyBsqBox);
}

private void addButtons() {
Expand Down

0 comments on commit 07e224e

Please sign in to comment.