mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Hide perc box if not perc based price used, fix toggle button
This commit is contained in:
parent
bc07df2d7a
commit
261a037020
4 changed files with 9 additions and 4 deletions
|
@ -364,7 +364,7 @@ public final class Offer implements StoragePayload, RequiresOwnerIsOnlinePayload
|
|||
return marketPriceMargin;
|
||||
}
|
||||
|
||||
public boolean isUsePercentageBasedPrice() {
|
||||
public boolean getUsePercentageBasedPrice() {
|
||||
return usePercentageBasedPrice;
|
||||
}
|
||||
|
||||
|
|
|
@ -938,6 +938,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
|||
fixedPriceButton.setToggleGroup(toggleGroup);
|
||||
fixedPriceButton.selectedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
model.dataModel.setUsePercentageBasedPrice(!newValue);
|
||||
percentagePriceButton.setSelected(!newValue);
|
||||
});
|
||||
|
||||
percentagePriceButton = new ToggleButton("Percentage");
|
||||
|
@ -945,6 +946,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
|||
percentagePriceButton.setToggleGroup(toggleGroup);
|
||||
percentagePriceButton.selectedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
model.dataModel.setUsePercentageBasedPrice(newValue);
|
||||
fixedPriceButton.setSelected(!newValue);
|
||||
});
|
||||
|
||||
HBox toggleButtons = new HBox();
|
||||
|
|
|
@ -263,7 +263,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
Offer offer = item.getOffer();
|
||||
Fiat price = offer.getPrice();
|
||||
String postFix = "";
|
||||
if (offer.isUsePercentageBasedPrice()) {
|
||||
if (offer.getUsePercentageBasedPrice()) {
|
||||
postFix = " (" + formatter.formatToPercentWithSymbol(offer.getMarketPriceMargin()) + ")";
|
||||
}
|
||||
if (showAllTradeCurrenciesProperty.get())
|
||||
|
|
|
@ -116,6 +116,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
// private Subscription noSufficientFeeSubscription;
|
||||
// private MonadicBinding<Boolean> noSufficientFeeBinding;
|
||||
private Subscription cancelButton2StyleSubscription;
|
||||
private VBox priceAsPercentageInputBox;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -195,6 +196,8 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
public void initWithData(Offer offer) {
|
||||
model.initWithData(offer);
|
||||
|
||||
priceAsPercentageInputBox.setVisible(offer.getUsePercentageBasedPrice());
|
||||
|
||||
if (model.getOffer().getDirection() == Offer.Direction.SELL) {
|
||||
imageView.setId("image-buy-large");
|
||||
directionLabel.setId("direction-icon-label-buy");
|
||||
|
@ -211,7 +214,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
takeOfferButton.setText("Review offer for selling bitcoin");
|
||||
}
|
||||
|
||||
|
||||
boolean showComboBox = model.getPossiblePaymentAccounts().size() > 1;
|
||||
paymentAccountsLabel.setVisible(showComboBox);
|
||||
paymentAccountsLabel.setManaged(showComboBox);
|
||||
|
@ -850,7 +852,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
|
||||
Tuple2<Label, VBox> priceAsPercentageInputBoxTuple = getTradeInputBox(priceAsPercentageValueCurrencyBox, "Distance in % from market price");
|
||||
priceAsPercentageInputBoxTuple.first.setPrefWidth(200);
|
||||
VBox priceAsPercentageInputBox = priceAsPercentageInputBoxTuple.second;
|
||||
priceAsPercentageInputBox = priceAsPercentageInputBoxTuple.second;
|
||||
|
||||
priceAsPercentageTextField.setPromptText("Enter % value");
|
||||
priceAsPercentageLabel.setText("% dist.");
|
||||
|
@ -873,6 +875,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
hBox.setSpacing(5);
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
hBox.getChildren().addAll(amountInputBoxTuple.second, xLabel, priceAsPercentageInputBox);
|
||||
|
||||
GridPane.setRowIndex(hBox, ++gridRow);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
GridPane.setMargin(hBox, new Insets(5, 10, 5, 0));
|
||||
|
|
Loading…
Add table
Reference in a new issue