mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-25 07:19:30 -05:00
replace checkbox to reserve necessary funds with slider
This commit is contained in:
parent
bd5accb5a5
commit
c75e3aa455
@ -71,7 +71,6 @@ import javafx.geometry.Pos;
|
|||||||
import javafx.geometry.VPos;
|
import javafx.geometry.VPos;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
@ -137,7 +136,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
private TextField currencyTextField;
|
private TextField currencyTextField;
|
||||||
private AddressTextField addressTextField;
|
private AddressTextField addressTextField;
|
||||||
private BalanceTextField balanceTextField;
|
private BalanceTextField balanceTextField;
|
||||||
private CheckBox reserveExactAmountCheckbox;
|
private ToggleButton reserveExactAmountSlider;
|
||||||
private ToggleButton buyerAsTakerWithoutDepositSlider;
|
private ToggleButton buyerAsTakerWithoutDepositSlider;
|
||||||
private FundsTextField totalToPayTextField;
|
private FundsTextField totalToPayTextField;
|
||||||
private Label amountDescriptionLabel, priceCurrencyLabel, priceDescriptionLabel, volumeDescriptionLabel,
|
private Label amountDescriptionLabel, priceCurrencyLabel, priceDescriptionLabel, volumeDescriptionLabel,
|
||||||
@ -176,6 +175,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
@Setter
|
@Setter
|
||||||
private OfferView.OfferActionHandler offerActionHandler;
|
private OfferView.OfferActionHandler offerActionHandler;
|
||||||
|
|
||||||
|
private int heightAdjustment = -5;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Constructor, lifecycle
|
// Constructor, lifecycle
|
||||||
@ -436,7 +437,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
qrCodeImageView.setVisible(true);
|
qrCodeImageView.setVisible(true);
|
||||||
balanceTextField.setVisible(true);
|
balanceTextField.setVisible(true);
|
||||||
cancelButton2.setVisible(true);
|
cancelButton2.setVisible(true);
|
||||||
reserveExactAmountCheckbox.setVisible(true);
|
reserveExactAmountSlider.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOfferElementsStyle() {
|
private void updateOfferElementsStyle() {
|
||||||
@ -958,7 +959,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addPaymentGroup() {
|
private void addPaymentGroup() {
|
||||||
paymentTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 1, Res.get("offerbook.createOffer"));
|
paymentTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 1, Res.get("offerbook.createOffer"), heightAdjustment);
|
||||||
GridPane.setColumnSpan(paymentTitledGroupBg, 2);
|
GridPane.setColumnSpan(paymentTitledGroupBg, 2);
|
||||||
|
|
||||||
HBox paymentGroupBox = new HBox();
|
HBox paymentGroupBox = new HBox();
|
||||||
@ -976,7 +977,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
|
|
||||||
GridPane.setRowIndex(paymentGroupBox, gridRow);
|
GridPane.setRowIndex(paymentGroupBox, gridRow);
|
||||||
GridPane.setColumnSpan(paymentGroupBox, 2);
|
GridPane.setColumnSpan(paymentGroupBox, 2);
|
||||||
GridPane.setMargin(paymentGroupBox, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
|
GridPane.setMargin(paymentGroupBox, new Insets(Layout.FIRST_ROW_DISTANCE + heightAdjustment, 0, 0, 0));
|
||||||
gridPane.getChildren().add(paymentGroupBox);
|
gridPane.getChildren().add(paymentGroupBox);
|
||||||
|
|
||||||
tradingAccountBoxTuple.first.setMinWidth(800);
|
tradingAccountBoxTuple.first.setMinWidth(800);
|
||||||
@ -1012,7 +1013,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
|
|
||||||
private void addAmountPriceGroup() {
|
private void addAmountPriceGroup() {
|
||||||
amountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2,
|
amountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2,
|
||||||
Res.get("createOffer.setAmountPrice"), 25);
|
Res.get("createOffer.setAmountPrice"), 25 + heightAdjustment);
|
||||||
GridPane.setColumnSpan(amountTitledGroupBg, 2);
|
GridPane.setColumnSpan(amountTitledGroupBg, 2);
|
||||||
|
|
||||||
addAmountPriceFields();
|
addAmountPriceFields();
|
||||||
@ -1021,7 +1022,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
|
|
||||||
private void addOptionsGroup() {
|
private void addOptionsGroup() {
|
||||||
setDepositTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2,
|
setDepositTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2,
|
||||||
Res.get("shared.advancedOptions"), Layout.COMPACT_GROUP_DISTANCE);
|
Res.get("shared.advancedOptions"), 25 + heightAdjustment);
|
||||||
|
|
||||||
securityDepositAndFeeBox = new HBox();
|
securityDepositAndFeeBox = new HBox();
|
||||||
securityDepositAndFeeBox.setSpacing(40);
|
securityDepositAndFeeBox.setSpacing(40);
|
||||||
@ -1136,7 +1137,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
private void addFundingGroup() {
|
private void addFundingGroup() {
|
||||||
// don't increase gridRow as we removed button when this gets visible
|
// don't increase gridRow as we removed button when this gets visible
|
||||||
payFundsTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 3,
|
payFundsTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 3,
|
||||||
Res.get("createOffer.fundsBox.title"), 25);
|
Res.get("createOffer.fundsBox.title"), 20 + heightAdjustment);
|
||||||
payFundsTitledGroupBg.getStyleClass().add("last");
|
payFundsTitledGroupBg.getStyleClass().add("last");
|
||||||
GridPane.setColumnSpan(payFundsTitledGroupBg, 2);
|
GridPane.setColumnSpan(payFundsTitledGroupBg, 2);
|
||||||
payFundsTitledGroupBg.setVisible(false);
|
payFundsTitledGroupBg.setVisible(false);
|
||||||
@ -1144,7 +1145,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
totalToPayTextField = addFundsTextfield(gridPane, gridRow,
|
totalToPayTextField = addFundsTextfield(gridPane, gridRow,
|
||||||
Res.get("shared.totalsNeeded"), Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE);
|
Res.get("shared.totalsNeeded"), Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE);
|
||||||
totalToPayTextField.setVisible(false);
|
totalToPayTextField.setVisible(false);
|
||||||
GridPane.setMargin(totalToPayTextField, new Insets(65, 10, 0, 0));
|
GridPane.setMargin(totalToPayTextField, new Insets(60 + heightAdjustment, 10, 0, 0));
|
||||||
|
|
||||||
qrCodeImageView = new ImageView();
|
qrCodeImageView = new ImageView();
|
||||||
qrCodeImageView.setVisible(false);
|
qrCodeImageView.setVisible(false);
|
||||||
@ -1170,15 +1171,15 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
Res.get("shared.tradeWalletBalance"));
|
Res.get("shared.tradeWalletBalance"));
|
||||||
balanceTextField.setVisible(false);
|
balanceTextField.setVisible(false);
|
||||||
|
|
||||||
reserveExactAmountCheckbox = FormBuilder.addLabelCheckBox(gridPane, ++gridRow,
|
|
||||||
Res.get("shared.reserveExactAmount"));
|
|
||||||
|
|
||||||
GridPane.setHalignment(reserveExactAmountCheckbox, HPos.LEFT);
|
reserveExactAmountSlider = FormBuilder.addSlideToggleButton(gridPane, ++gridRow, Res.get("shared.reserveExactAmount"), heightAdjustment);
|
||||||
|
GridPane.setHalignment(reserveExactAmountSlider, HPos.LEFT);
|
||||||
reserveExactAmountCheckbox.setVisible(false);
|
GridPane.setMargin(reserveExactAmountSlider, new Insets(-5, 0, -5, 0));
|
||||||
reserveExactAmountCheckbox.setSelected(preferences.getSplitOfferOutput());
|
reserveExactAmountSlider.setPadding(new Insets(0, 0, 0, 0));
|
||||||
reserveExactAmountCheckbox.setOnAction(event -> {
|
reserveExactAmountSlider.setVisible(false);
|
||||||
boolean selected = reserveExactAmountCheckbox.isSelected();
|
reserveExactAmountSlider.setSelected(preferences.getSplitOfferOutput());
|
||||||
|
reserveExactAmountSlider.setOnAction(event -> {
|
||||||
|
boolean selected = reserveExactAmountSlider.isSelected();
|
||||||
if (selected != preferences.getSplitOfferOutput()) {
|
if (selected != preferences.getSplitOfferOutput()) {
|
||||||
preferences.setSplitOfferOutput(selected);
|
preferences.setSplitOfferOutput(selected);
|
||||||
model.dataModel.setReserveExactAmount(selected);
|
model.dataModel.setReserveExactAmount(selected);
|
||||||
@ -1338,7 +1339,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
firstRowHBox.getChildren().addAll(amountBox, xLabel, percentagePriceBox, resultLabel, volumeBox);
|
firstRowHBox.getChildren().addAll(amountBox, xLabel, percentagePriceBox, resultLabel, volumeBox);
|
||||||
GridPane.setColumnSpan(firstRowHBox, 2);
|
GridPane.setColumnSpan(firstRowHBox, 2);
|
||||||
GridPane.setRowIndex(firstRowHBox, gridRow);
|
GridPane.setRowIndex(firstRowHBox, gridRow);
|
||||||
GridPane.setMargin(firstRowHBox, new Insets(40, 10, 0, 0));
|
GridPane.setMargin(firstRowHBox, new Insets(40 + heightAdjustment, 10, 0, 0));
|
||||||
gridPane.getChildren().add(firstRowHBox);
|
gridPane.getChildren().add(firstRowHBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user