Merge pull request #1858 from ripcurlx/create-offer-adaptions

Redesign: Create Offer flow adaptions
This commit is contained in:
Manfred Karrer 2018-11-02 11:40:19 -05:00 committed by GitHub
commit 32f709c2c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 406 additions and 222 deletions

View file

@ -172,8 +172,8 @@ shared.messageArrived=Message arrived.
shared.messageStoredInMailbox=Message stored in mailbox.
shared.messageSendingFailed=Message sending failed. Error: {0}
shared.unlock=Unlock
shared.toReceive=to receive:
shared.toSpend=to spend:
shared.toReceive=to receive
shared.toSpend=to spend
shared.btcAmount=BTC amount
shared.yourLanguage=Your languages:
shared.addLanguage=Add language
@ -191,6 +191,7 @@ shared.fiat=Fiat
shared.crypto=Crypto
shared.all=All
shared.edit=Edit
shared.advancedOptions=Advanced options
####################################################################
@ -214,7 +215,6 @@ mainView.menu.dao=DAO
mainView.marketPrice.provider=Price by
mainView.marketPrice.label=Market price
mainView.marketPriceWithProvider.label=Market price by {0}
mainView.marketPrice.tooltip.provider=The displayed price is provided by {0}
mainView.marketPrice.bisqInternalPrice=Price of latest Bisq trade
mainView.marketPrice.tooltip.bisqInternalPrice=There is no market price from external price feed providers available.\n\
The displayed price is the latest Bisq trade price for that currency.
@ -1712,22 +1712,22 @@ filterWindow.preventPublicBtcNetwork=Prevent usage of public Bitcoin network:
filterWindow.add=Add filter
filterWindow.remove=Remove filter
offerDetailsWindow.minBtcAmount=Min. BTC amount:
offerDetailsWindow.minBtcAmount=Min. BTC amount
offerDetailsWindow.min=(min. {0})
offerDetailsWindow.distance=(distance from market price: {0})
offerDetailsWindow.myTradingAccount=My trading account:
offerDetailsWindow.offererBankId=(maker's bank ID/BIC/SWIFT):
offerDetailsWindow.myTradingAccount=My trading account
offerDetailsWindow.offererBankId=(maker's bank ID/BIC/SWIFT)
offerDetailsWindow.offerersBankName=(maker's bank name)
offerDetailsWindow.bankId=Bank ID (e.g. BIC or SWIFT):
offerDetailsWindow.countryBank=Maker's country of bank:
offerDetailsWindow.acceptedArbitrators=Accepted arbitrators:
offerDetailsWindow.bankId=Bank ID (e.g. BIC or SWIFT)
offerDetailsWindow.countryBank=Maker's country of bank
offerDetailsWindow.acceptedArbitrators=Accepted arbitrators
offerDetailsWindow.commitment=Commitment
offerDetailsWindow.agree=I agree:
offerDetailsWindow.tac=Terms and conditions:
offerDetailsWindow.agree=I agree
offerDetailsWindow.tac=Terms and conditions
offerDetailsWindow.confirm.maker=Confirm: Place offer to {0} bitcoin
offerDetailsWindow.confirm.taker=Confirm: Take offer to {0} bitcoin
offerDetailsWindow.creationDate=Creation date:
offerDetailsWindow.makersOnion=Maker's onion address:
offerDetailsWindow.creationDate=Creation date
offerDetailsWindow.makersOnion=Maker's onion address
qRCodeWindow.headline=QR-Code
qRCodeWindow.msg=Please use that QR-Code for funding your Bisq wallet from your external wallet.

View file

@ -113,6 +113,7 @@ bg color of non edit textFields: fafafa
-bs-rd-font-balance: #4F4F4F;
-bs-rd-font-balance-label: #8E8E8E;
-bs-rd-font-dark-grey: #3c3c3c;
-bs-rd-font-confirmation-label: -bs-rd-grey-background-darker-2;
-bs-rd-nav-border: #535353;
-bs-rd-tab-border: #E2E0E0;
-bs-rd-nav-background-dark: #0E0E0E;
@ -225,6 +226,24 @@ bg color of non edit textFields: fafafa
-fx-text-fill: -bs-light-grey;
}
.confirmation-label {
-fx-font-size: 1.077em;
-fx-text-fill: -bs-rd-font-confirmation-label;
}
.confirmation-value {
-fx-font-size: 1.077em;
-fx-font-family: "IBM Plex Mono";
-fx-text-fill: -bs-rd-font-dark-grey;
}
.confirmation-text-field-as-label:readonly {
-fx-background-color: transparent !important;
-fx-font-size: 1.077em;
-fx-font-family: "IBM Plex Mono";
-fx-padding: 0 !important;
}
/* Other UI Elements */
.separator *.line {
@ -391,6 +410,60 @@ bg color of non edit textFields: fafafa
-fx-font-size: 1em;
}
.input-with-border {
-fx-background-color: -bs-rd-white;
-fx-border-width: 1;
-fx-border-color: -bs-rd-grey-background-dark;
-fx-border-radius: 3;
-fx-pref-height: 43;
-fx-pref-width: 300;
-fx-effect: innershadow(gaussian, -bs-rd-black-transparent, 3, 0, 0, 1);
}
.input-with-border .text-field {
-fx-alignment: center-right;
-fx-pref-height: 43;
-fx-font-size: 1.385em;
}
.input-with-border > .input-label {
-fx-font-size: 0.692em;
-fx-min-width: 60;
-fx-padding: 16;
-fx-alignment: center;
}
.input-with-border .icon {
-fx-padding: 10;
}
.input-with-border-readonly {
-fx-background-color: -bs-rd-grey-medium-light;
-fx-border-width: 0;
-fx-pref-width: 300;
}
.input-with-border-readonly .text-field {
-fx-alignment: center-right;
-fx-font-size: 1em;
-fx-background-color: -bs-rd-grey-medium-light;
}
.input-with-border-readonly .text-field > .input-line {
-fx-background-color: transparent;
}
.input-with-border-readonly > .input-label {
-fx-font-size: 0.692em;
-fx-min-width: 30;
-fx-padding: 8;
-fx-alignment: center;
}
.input-with-border-readonly .icon {
-fx-padding: 2;
}
.jfx-badge .badge-pane {
-fx-background-color: -bs-red;
-fx-background-radius: 15;
@ -448,33 +521,6 @@ bg color of non edit textFields: fafafa
-fx-background-color: -jfx-default-color;
}
.input-with-border {
-fx-background-color: -bs-rd-white;
-fx-border-width: 1;
-fx-border-color: -bs-rd-grey-background-dark;
-fx-border-radius: 3;
-fx-pref-height: 43;
-fx-pref-width: 243;
-fx-effect: innershadow(gaussian, -bs-rd-black-transparent, 3, 0, 0, 1);
}
.input-with-border .text-field {
-fx-alignment: center-right;
-fx-pref-height: 43;
-fx-font-size: 1.385em;
}
.input-label {
-fx-font-size: 0.692em;
-fx-min-width: 60;
-fx-padding: 16;
-fx-alignment: center;
}
.input-with-border .icon {
-fx-padding: 10;
}
.scroll-bar {
-fx-background-color: transparent;
-fx-background-radius: 0;
@ -751,6 +797,13 @@ bg color of non edit textFields: fafafa
.opaque-icon-character {
-fx-font-size: 3em;
-fx-text-fill: -bs-rd-grey-light;
-fx-padding: 24 2 0 2;
}
.opaque-icon-character.small {
-fx-font-size: 1em;
/*-fx-text-fill: -bs-rd-grey-light;
-fx-padding: 14 2 0 2;*/
}
/*******************************************************************************
@ -1191,7 +1244,6 @@ textfield */
#trade-fee-textfield {
-fx-font-size: 0.9em;
-fx-alignment: center-right;
-fx-background-color: transparent;
}
/* Open Offer */

View file

@ -46,6 +46,10 @@ public class TextFieldWithCopyIcon extends AnchorPane {
///////////////////////////////////////////////////////////////////////////////////////////
public TextFieldWithCopyIcon() {
this(null);
}
public TextFieldWithCopyIcon(String customStyleClass) {
Label copyIcon = new Label();
copyIcon.setLayoutY(3);
copyIcon.getStyleClass().addAll("icon", "highlight");
@ -69,6 +73,7 @@ public class TextFieldWithCopyIcon extends AnchorPane {
});
textField = new JFXTextField();
textField.setEditable(false);
if (customStyleClass != null) textField.getStyleClass().add(customStyleClass);
textField.textProperty().bindBidirectional(text);
AnchorPane.setRightAnchor(copyIcon, 5.0);
AnchorPane.setRightAnchor(textField, 30.0);

View file

@ -41,7 +41,7 @@ public class TitledGroupBg extends Pane {
label = new AutoTooltipLabel();
label.textProperty().bind(text);
label.setLayoutX(8);
label.setLayoutX(4);
label.setLayoutY(-8);
label.setPadding(new Insets(0, 7, 0, 5));
setActive();

View file

@ -419,7 +419,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
if (model.getIsPriceAvailable().get()) {
if (model.getIsExternallyProvidedPrice().get()) {
label.setText(Res.get("mainView.marketPriceWithProvider.label", getPriceProvider()));
label.setTooltip(new Tooltip(Res.get("mainView.marketPrice.tooltip.provider", getPriceProvider())));
label.setTooltip(new Tooltip(getPriceProviderTooltipString()));
} else {
label.setText(Res.get("mainView.marketPrice.bisqInternalPrice"));
final Tooltip tooltip = new Tooltip(Res.get("mainView.marketPrice.tooltip.bisqInternalPrice"));
@ -432,6 +432,27 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
}
}
@NotNull
private String getPriceProviderTooltipString() {
String res;
if (model.getIsFiatCurrencyPriceFeedSelected().get()) {
res = Res.get("mainView.marketPrice.tooltip",
"https://bitcoinaverage.com",
"",
formatter.formatTime(model.getPriceFeedService().getLastRequestTimeStampBtcAverage()),
model.getPriceFeedService().getProviderNodeAddress());
} else {
String altcoinExtra = "\n" + Res.get("mainView.marketPrice.tooltip.altcoinExtra");
res = Res.get("mainView.marketPrice.tooltip",
"https://poloniex.com",
altcoinExtra,
formatter.formatTime(model.getPriceFeedService().getLastRequestTimeStampPoloniex()),
model.getPriceFeedService().getProviderNodeAddress());
}
return res;
}
private VBox createSplashScreen() {
VBox vBox = new VBox();
vBox.setAlignment(Pos.CENTER);

View file

@ -36,7 +36,7 @@ import bisq.core.btc.wallet.WalletsManager;
import bisq.core.crypto.ScryptUtil;
import bisq.core.locale.Res;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
import org.bitcoinj.crypto.KeyCrypterScrypt;
@ -47,6 +47,7 @@ import com.jfoenix.validation.RequiredFieldValidator;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.beans.value.ChangeListener;
@ -98,7 +99,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
if (oldValue != newValue) validatePasswords();
};
Tuple3<Button, BusyAnimation, Label> tuple = addButtonBusyAnimationLabel(root, ++gridRow, "", 10);
Tuple4<Button, BusyAnimation, Label, HBox> tuple = addButtonBusyAnimationLabel(root, ++gridRow, 0, "", 10);
pwButton = (AutoTooltipButton) tuple.first;
BusyAnimation busyAnimation = tuple.second;
Label deriveStatusLabel = tuple.third;

View file

@ -56,6 +56,7 @@ import bisq.core.util.BsqFormatter;
import bisq.common.app.DevEnv;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.InsufficientMoneyException;
@ -72,6 +73,7 @@ import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
@ -687,7 +689,7 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
revealTxIdContainer = tuple.third;
voteFields.add(revealTxIdContainer);
Tuple3<Button, BusyAnimation, Label> voteButtonTuple = addButtonBusyAnimationLabelAfterGroup(root, ++gridRow,
Tuple4<Button, BusyAnimation, Label, HBox> voteButtonTuple = addButtonBusyAnimationLabelAfterGroup(root, ++gridRow,
Res.get("dao.proposal.myVote.button"));
voteButton = voteButtonTuple.first;
voteButtons.add(voteButton);

View file

@ -139,8 +139,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
private Button priceTypeToggleButton;
private InputTextField buyerSecurityDepositInputTextField, fixedPriceTextField, marketBasedPriceTextField;
protected InputTextField amountTextField, minAmountTextField, volumeTextField;
private TextField currencyTextField, tradeFeeInBtcTextField, tradeFeeInBsqTextField;
private VBox currencyTextFieldBox;
private TextField currencyTextField;
private AddressTextField addressTextField;
private BalanceTextField balanceTextField;
private FundsTextField totalToPayTextField;
@ -148,14 +147,18 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
priceCurrencyLabel, priceDescriptionLabel,
volumeDescriptionLabel,
waitingForFundsLabel, marketBasedPriceLabel, percentagePriceDescription,
buyerSecurityDepositBtcLabel;
buyerSecurityDepositBtcLabel, tradeFeeDescriptionLabel, resultLabel,
tradeFeeInBtcLabel, tradeFeeInBsqLabel;
protected Label amountBtcLabel, volumeCurrencyLabel, minAmountBtcLabel;
private ComboBox<PaymentAccount> paymentAccountsComboBox;
private ComboBox<TradeCurrency> currencyComboBox;
private VBox currencySelection;
private ImageView qrCodeImageView;
private VBox fixedPriceBox, percentagePriceBox, tradeFeeBox;
private HBox fundingHBox, firstRowHBox, secondRowHBox, buyerSecurityDepositValueCurrencyBox;
private VBox fixedPriceBox, percentagePriceBox,
currencyTextFieldBox;
private HBox fundingHBox, firstRowHBox, secondRowHBox, placeOfferBox, amountValueCurrencyBox,
priceAsPercentageValueCurrencyBox, volumeValueCurrencyBox, priceValueCurrencyBox,
minAmountValueCurrencyBox, advancedOptionsBox;
private Subscription isWaitingForFundsSubscription, balanceSubscription, cancelButton2StyleSubscription;
private ChangeListener<Boolean> amountFocusedListener, minAmountFocusedListener, volumeFocusedListener,
@ -175,7 +178,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
protected TitledGroupBg amountTitledGroupBg;
private AutoTooltipSlideToggleButton tradeFeeInBtcToggle, tradeFeeInBsqToggle;
private ChangeListener<Boolean> tradeFeeInBtcToggleListener, tradeFeeInBsqToggleListener;
private AutoTooltipLabel tradeFeeDescriptionLabel;
private Text xIcon, fakeXIcon;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor, lifecycle
@ -396,6 +399,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
}
private void onShowPayFundsScreen() {
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
nextButton.setVisible(false);
nextButton.setManaged(false);
nextButton.setOnAction(null);
@ -412,15 +417,17 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
transitions.fadeOutAndRemove(setDepositTitledGroupBg, delay, (event) -> {
});
delay -= diff;
transitions.fadeOutAndRemove(buyerSecurityDepositValueCurrencyBox, delay);
transitions.fadeOutAndRemove(advancedOptionsBox, delay);
model.onShowPayFundsScreen();
editOfferElements.stream().forEach(node -> {
editOfferElements.forEach(node -> {
node.setMouseTransparent(true);
node.setFocusTraversable(false);
});
updateOfferElementsStyle();
balanceTextField.setTargetAmount(model.getDataModel().totalToPayAsCoinProperty().get());
//noinspection PointlessBooleanExpression
@ -472,6 +479,25 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
qrCodeImageView.setImage(qrImage);
}
private void updateOfferElementsStyle() {
final String activeInputStyle = "input-with-border";
final String readOnlyInputStyle = "input-with-border-readonly";
amountValueCurrencyBox.getStyleClass().remove(activeInputStyle);
amountValueCurrencyBox.getStyleClass().add(readOnlyInputStyle);
priceAsPercentageValueCurrencyBox.getStyleClass().remove(activeInputStyle);
priceAsPercentageValueCurrencyBox.getStyleClass().add(readOnlyInputStyle);
volumeValueCurrencyBox.getStyleClass().remove(activeInputStyle);
volumeValueCurrencyBox.getStyleClass().add(readOnlyInputStyle);
priceValueCurrencyBox.getStyleClass().remove(activeInputStyle);
priceValueCurrencyBox.getStyleClass().add(readOnlyInputStyle);
minAmountValueCurrencyBox.getStyleClass().remove(activeInputStyle);
minAmountValueCurrencyBox.getStyleClass().add(readOnlyInputStyle);
resultLabel.getStyleClass().add("small");
xIcon.setStyle(String.format("-fx-font-family: %s; -fx-font-size: %s;", MaterialDesignIcon.CLOSE.fontFamily(), "1em"));
fakeXIcon.setStyle(String.format("-fx-font-family: %s; -fx-font-size: %s;", MaterialDesignIcon.CLOSE.fontFamily(), "1em"));
}
private void maybeShowClearXchangeWarning(PaymentAccount paymentAccount) {
if (paymentAccount.getPaymentMethod().getId().equals(PaymentMethod.CLEAR_X_CHANGE_ID) &&
!clearXchangeWarningDisplayed) {
@ -557,8 +583,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
totalToPayTextField.textProperty().bind(model.totalToPay);
addressTextField.amountAsCoinProperty().bind(model.getDataModel().getMissingCoin());
buyerSecurityDepositInputTextField.textProperty().bindBidirectional(model.buyerSecurityDeposit);
tradeFeeInBtcTextField.textProperty().bind(model.tradeFeeInBtcWithFiat);
tradeFeeInBsqTextField.textProperty().bind(model.tradeFeeInBsqWithFiat);
tradeFeeInBtcLabel.textProperty().bind(model.tradeFeeInBtcWithFiat);
tradeFeeInBsqLabel.textProperty().bind(model.tradeFeeInBsqWithFiat);
tradeFeeDescriptionLabel.textProperty().bind(model.tradeFeeDescription);
// Validation
@ -572,8 +598,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
fundingHBox.visibleProperty().bind(model.getDataModel().getIsBtcWalletFunded().not().and(model.showPayFundsScreenDisplayed));
fundingHBox.managedProperty().bind(model.getDataModel().getIsBtcWalletFunded().not().and(model.showPayFundsScreenDisplayed));
waitingForFundsLabel.textProperty().bind(model.waitingForFundsText);
placeOfferButton.visibleProperty().bind(model.getDataModel().getIsBtcWalletFunded().and(model.showPayFundsScreenDisplayed));
placeOfferButton.managedProperty().bind(model.getDataModel().getIsBtcWalletFunded().and(model.showPayFundsScreenDisplayed));
placeOfferBox.visibleProperty().bind(model.getDataModel().getIsBtcWalletFunded().and(model.showPayFundsScreenDisplayed));
placeOfferBox.managedProperty().bind(model.getDataModel().getIsBtcWalletFunded().and(model.showPayFundsScreenDisplayed));
placeOfferButton.disableProperty().bind(model.isPlaceOfferButtonDisabled);
cancelButton2.disableProperty().bind(model.cancelButtonDisabled);
@ -604,8 +630,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
totalToPayTextField.textProperty().unbind();
addressTextField.amountAsCoinProperty().unbind();
buyerSecurityDepositInputTextField.textProperty().unbindBidirectional(model.buyerSecurityDeposit);
tradeFeeInBtcTextField.textProperty().unbind();
tradeFeeInBsqTextField.textProperty().unbind();
tradeFeeInBtcLabel.textProperty().unbind();
tradeFeeInBsqLabel.textProperty().unbind();
tradeFeeDescriptionLabel.textProperty().unbind();
// Validation
@ -619,8 +645,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
fundingHBox.visibleProperty().unbind();
fundingHBox.managedProperty().unbind();
waitingForFundsLabel.textProperty().unbind();
placeOfferButton.visibleProperty().unbind();
placeOfferButton.managedProperty().unbind();
placeOfferBox.visibleProperty().unbind();
placeOfferBox.managedProperty().unbind();
placeOfferButton.disableProperty().unbind();
cancelButton2.disableProperty().unbind();
@ -793,8 +819,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
private void setIsCurrencyForMakerFeeBtc(boolean isCurrencyForMakerFeeBtc) {
model.setIsCurrencyForMakerFeeBtc(isCurrencyForMakerFeeBtc);
if (DevEnv.isDaoActivated()) {
tradeFeeInBtcTextField.setOpacity(isCurrencyForMakerFeeBtc ? 1 : 0.3);
tradeFeeInBsqTextField.setOpacity(isCurrencyForMakerFeeBtc ? 0.3 : 1);
tradeFeeInBtcLabel.setOpacity(isCurrencyForMakerFeeBtc ? 1 : 0.3);
tradeFeeInBsqLabel.setOpacity(isCurrencyForMakerFeeBtc ? 0.3 : 1);
}
}
@ -886,7 +912,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
private void addScrollPane() {
scrollPane = new ScrollPane();
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
AnchorPane.setLeftAnchor(scrollPane, 0d);
@ -943,7 +969,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
// we display either currencyComboBox (multi currency account) or currencyTextField (single)
currencyComboBox = currencyBoxTuple.third;
editOfferElements.add(currencySelection);
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
currencyComboBox.setConverter(new StringConverter<>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getNameAndCode();
@ -972,7 +998,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
}
private void addAmountPriceGroup() {
amountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("createOffer.setAmountPrice"), Layout.GROUP_DISTANCE);
amountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("createOffer.setAmountPrice"), Layout.COMPACT_GROUP_DISTANCE);
GridPane.setColumnSpan(amountTitledGroupBg, 2);
addAmountPriceFields();
@ -980,17 +1006,28 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
}
private void addOptionsGroup() {
setDepositTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("createOffer.setDeposit"), Layout.GROUP_DISTANCE);
setDepositTitledGroupBg.getStyleClass().add("last");
setDepositTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("shared.advancedOptions"), Layout.COMPACT_GROUP_DISTANCE);
advancedOptionsBox = new HBox();
advancedOptionsBox.setSpacing(40);
GridPane.setRowIndex(advancedOptionsBox, gridRow);
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);
advancedOptionsBox.getChildren().addAll(getBuyerSecurityDepositBox(), getTradeFeeFieldsBox());
addBuyerSecurityDepositRow();
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane, ++gridRow,
Res.get("shared.nextStep"), Res.get("shared.cancel"));
nextButton = (AutoTooltipButton) tuple.first;
nextButton.setMaxWidth(200);
editOfferElements.add(nextButton);
nextButton.disableProperty().bind(model.isNextButtonDisabled);
cancelButton1 = (AutoTooltipButton) tuple.second;
cancelButton1.setMaxWidth(200);
editOfferElements.add(cancelButton1);
cancelButton1.setDefaultButton(false);
cancelButton1.setOnAction(e -> {
@ -1053,39 +1090,37 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
}
}
private void addBuyerSecurityDepositRow() {
final double top = model.getDataModel().isBsqForFeeAvailable() ? 0 : Layout.FIRST_ROW_AND_GROUP_DISTANCE;
private VBox getBuyerSecurityDepositBox() {
Tuple3<HBox, InputTextField, Label> tuple = getEditableValueBox(
Res.get("createOffer.securityDeposit.prompt"));
buyerSecurityDepositValueCurrencyBox = tuple.first;
buyerSecurityDepositInputTextField = tuple.second;
buyerSecurityDepositBtcLabel = tuple.third;
VBox depositBox = getTradeInputBox(tuple.first, Res.get("createOffer.setDeposit")).second;
depositBox.setMaxWidth(300);
editOfferElements.add(buyerSecurityDepositInputTextField);
editOfferElements.add(buyerSecurityDepositBtcLabel);
GridPane.setRowIndex(buyerSecurityDepositValueCurrencyBox, gridRow);
GridPane.setColumnIndex(buyerSecurityDepositValueCurrencyBox, 0);
GridPane.setHalignment(buyerSecurityDepositValueCurrencyBox, HPos.LEFT);
GridPane.setMargin(buyerSecurityDepositValueCurrencyBox, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(buyerSecurityDepositValueCurrencyBox);
return depositBox;
}
private void addFundingGroup() {
// don't increase gridRow as we removed button when this gets visible
payFundsTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 3,
Res.get("createOffer.fundsBox.title"), Layout.GROUP_DISTANCE);
Res.get("createOffer.fundsBox.title"), Layout.COMPACT_GROUP_DISTANCE);
payFundsTitledGroupBg.getStyleClass().add("last");
GridPane.setColumnSpan(payFundsTitledGroupBg, 2);
payFundsTitledGroupBg.setVisible(false);
totalToPayTextField = addFundsTextfield(gridPane, gridRow,
Res.get("shared.totalsNeeded"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
Res.get("shared.totalsNeeded"), Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE);
totalToPayTextField.setVisible(false);
qrCodeImageView = new ImageView();
qrCodeImageView.setVisible(false);
qrCodeImageView.setFitHeight(150);
qrCodeImageView.setFitWidth(150);
qrCodeImageView.getStyleClass().add("qr-code");
Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(
@ -1095,7 +1130,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
GridPane.setRowIndex(qrCodeImageView, gridRow);
GridPane.setColumnIndex(qrCodeImageView, 1);
GridPane.setRowSpan(qrCodeImageView, 3);
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE - 9, 0, 0, 5));
GridPane.setValignment(qrCodeImageView, VPos.BOTTOM);
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_DISTANCE - 9, 0, 0, 10));
gridPane.getChildren().add(qrCodeImageView);
addressTextField = addAddressTextField(gridPane, ++gridRow,
@ -1111,7 +1147,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
fundingHBox.setManaged(false);
fundingHBox.setSpacing(10);
Button fundFromSavingsWalletButton = new AutoTooltipButton(Res.get("shared.fundFromSavingsWalletButton"));
fundFromSavingsWalletButton.setDefaultButton(false);
fundFromSavingsWalletButton.setDefaultButton(true);
fundFromSavingsWalletButton.getStyleClass().add("action-button");
fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet());
Label label = new AutoTooltipLabel(Res.get("shared.OR"));
label.setPadding(new Insets(5, 0, 0, 0));
@ -1124,21 +1161,37 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, fundFromExternalWalletButton, waitingForFundsBusyAnimation, waitingForFundsLabel);
GridPane.setRowIndex(fundingHBox, ++gridRow);
GridPane.setColumnIndex(fundingHBox, 0);
GridPane.setMargin(fundingHBox, new Insets(15, 10, 0, 0));
GridPane.setColumnSpan(fundingHBox, 2);
GridPane.setMargin(fundingHBox, new Insets(5, 0, 0, 0));
gridPane.getChildren().add(fundingHBox);
placeOfferBox = new HBox();
placeOfferBox.setSpacing(10);
GridPane.setRowIndex(placeOfferBox, gridRow);
GridPane.setColumnSpan(placeOfferBox, 2);
GridPane.setMargin(placeOfferBox, new Insets(5, 20, 0, 0));
gridPane.getChildren().add(placeOfferBox);
placeOfferButton = (AutoTooltipButton) addButtonAfterGroup(gridPane, gridRow, "");
GridPane.setColumnIndex(placeOfferButton, 0);
GridPane.setHalignment(placeOfferButton, HPos.LEFT);
placeOfferButton = new AutoTooltipButton();
placeOfferButton.setOnAction(e -> onPlaceOffer());
placeOfferButton.setMinHeight(40);
placeOfferButton.setPadding(new Insets(0, 20, 0, 20));
cancelButton2 = (AutoTooltipButton) addButton(gridPane, ++gridRow, Res.get("shared.cancel"));
GridPane.setColumnIndex(cancelButton2, 0);
GridPane.setHalignment(cancelButton2, HPos.LEFT);
placeOfferBox.getChildren().add(placeOfferButton);
placeOfferBox.visibleProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
fundingHBox.getChildren().remove(cancelButton2);
placeOfferBox.getChildren().add(cancelButton2);
} else if (!fundingHBox.getChildren().contains(cancelButton2)) {
placeOfferBox.getChildren().remove(cancelButton2);
fundingHBox.getChildren().add(cancelButton2);
}
});
cancelButton2 = new AutoTooltipButton(Res.get("shared.cancel"));
fundingHBox.getChildren().add(cancelButton2);
cancelButton2.setOnAction(e -> {
if (model.getDataModel().getIsBtcWalletFunded().get()) {
new Popup<>().warning(Res.get("createOffer.warnCancelOffer"))
@ -1176,7 +1229,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
private void addAmountPriceFields() {
// amountBox
Tuple3<HBox, InputTextField, Label> amountValueCurrencyBoxTuple = getEditableValueBox(Res.get("createOffer.amount.prompt"));
HBox amountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
amountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
amountTextField = amountValueCurrencyBoxTuple.second;
editOfferElements.add(amountTextField);
amountBtcLabel = amountValueCurrencyBoxTuple.third;
@ -1188,37 +1241,34 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
// x
Label xLabel = new Label();
final Text xIcon = getIconForLabel(MaterialDesignIcon.CLOSE, "2em", xLabel);
xIcon = getIconForLabel(MaterialDesignIcon.CLOSE, "2em", xLabel);
xIcon.getStyleClass().add("opaque-icon");
xLabel.setPadding(new Insets(14, 3, 0, 3));
xLabel.setPadding(new Insets(24, 3, 0, 3));
// price as percent
Tuple3<HBox, InfoInputTextField, Label> priceAsPercentageTuple = getEditableValueBoxWithInfo(Res.get("createOffer.price.prompt"));
HBox priceAsPercentageValueCurrencyBox = priceAsPercentageTuple.first;
priceAsPercentageValueCurrencyBox = priceAsPercentageTuple.first;
marketBasedPriceInfoInputTextField = priceAsPercentageTuple.second;
marketBasedPriceTextField = marketBasedPriceInfoInputTextField.getInputTextField();
marketBasedPriceTextField.setPrefWidth(200);
editOfferElements.add(marketBasedPriceTextField);
marketBasedPriceLabel = priceAsPercentageTuple.third;
editOfferElements.add(marketBasedPriceLabel);
Tuple2<Label, VBox> priceAsPercentageInputBoxTuple = getTradeInputBox(priceAsPercentageValueCurrencyBox,
Res.get("shared.distanceInPercent"));
percentagePriceDescription = priceAsPercentageInputBoxTuple.first;
percentagePriceDescription.setPrefWidth(200);
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription);
percentagePriceBox = priceAsPercentageInputBoxTuple.second;
// =
AutoTooltipLabel resultLabel = new AutoTooltipLabel("=");
resultLabel = new AutoTooltipLabel("=");
resultLabel.getStyleClass().add("opaque-icon-character");
resultLabel.setPadding(new Insets(14, 2, 0, 2));
// volume
Tuple3<HBox, InfoInputTextField, Label> volumeValueCurrencyBoxTuple = getEditableValueBoxWithInfo(Res.get("createOffer.volume.prompt"));
HBox volumeValueCurrencyBox = volumeValueCurrencyBoxTuple.first;
volumeValueCurrencyBox = volumeValueCurrencyBoxTuple.first;
volumeInfoInputTextField = volumeValueCurrencyBoxTuple.second;
volumeTextField = volumeInfoInputTextField.getInputTextField();
editOfferElements.add(volumeTextField);
@ -1235,7 +1285,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
firstRowHBox.getChildren().addAll(amountBox, xLabel, percentagePriceBox, resultLabel, volumeBox);
GridPane.setRowIndex(firstRowHBox, gridRow);
GridPane.setColumnIndex(firstRowHBox, 0);
GridPane.setMargin(firstRowHBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 10, 0, 0));
GridPane.setMargin(firstRowHBox, new Insets(Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE, 10, 0, 0));
gridPane.getChildren().add(firstRowHBox);
}
@ -1251,19 +1301,17 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
fixedPriceBox.setDisable(!fixedPriceSelected);
if (fixedPriceSelected) {
if (firstRowHBox.getChildren().contains(percentagePriceBox))
firstRowHBox.getChildren().remove(percentagePriceBox);
if (secondRowHBox.getChildren().contains(fixedPriceBox))
secondRowHBox.getChildren().remove(fixedPriceBox);
firstRowHBox.getChildren().remove(percentagePriceBox);
secondRowHBox.getChildren().remove(fixedPriceBox);
if (!firstRowHBox.getChildren().contains(fixedPriceBox))
firstRowHBox.getChildren().add(2, fixedPriceBox);
if (!secondRowHBox.getChildren().contains(percentagePriceBox))
secondRowHBox.getChildren().add(2, percentagePriceBox);
} else {
if (firstRowHBox.getChildren().contains(fixedPriceBox))
firstRowHBox.getChildren().remove(fixedPriceBox);
if (secondRowHBox.getChildren().contains(percentagePriceBox))
secondRowHBox.getChildren().remove(percentagePriceBox);
firstRowHBox.getChildren().remove(fixedPriceBox);
secondRowHBox.getChildren().remove(percentagePriceBox);
if (!firstRowHBox.getChildren().contains(percentagePriceBox))
firstRowHBox.getChildren().add(2, percentagePriceBox);
if (!secondRowHBox.getChildren().contains(fixedPriceBox))
@ -1275,7 +1323,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
// price as fiat
Tuple3<HBox, InputTextField, Label> priceValueCurrencyBoxTuple = getEditableValueBox(
Res.get("createOffer.price.prompt"));
HBox priceValueCurrencyBox = priceValueCurrencyBoxTuple.first;
priceValueCurrencyBox = priceValueCurrencyBoxTuple.first;
fixedPriceTextField = priceValueCurrencyBoxTuple.second;
editOfferElements.add(fixedPriceTextField);
priceCurrencyLabel = priceValueCurrencyBoxTuple.third;
@ -1292,17 +1340,17 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
marketBasedPriceLabel.setText("%");
Tuple3<HBox, InputTextField, Label> amountValueCurrencyBoxTuple = getEditableValueBox(Res.get("createOffer.amount.prompt"));
HBox amountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
minAmountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
minAmountTextField = amountValueCurrencyBoxTuple.second;
editOfferElements.add(minAmountTextField);
minAmountBtcLabel = amountValueCurrencyBoxTuple.third;
editOfferElements.add(minAmountBtcLabel);
Tuple2<Label, VBox> amountInputBoxTuple = getTradeInputBox(amountValueCurrencyBox, Res.get("createOffer.amountPriceBox.minAmountDescription"));
Tuple2<Label, VBox> amountInputBoxTuple = getTradeInputBox(minAmountValueCurrencyBox, Res.get("createOffer.amountPriceBox.minAmountDescription"));
Label fakeXLabel = new Label();
getIconForLabel(MaterialDesignIcon.CLOSE, "2em", fakeXLabel);
fakeXIcon = getIconForLabel(MaterialDesignIcon.CLOSE, "2em", fakeXLabel);
fakeXLabel.setPadding(new Insets(14, 3, 0, 3));
fakeXLabel.setVisible(false); // we just use it to get the same layout as the upper row
@ -1311,40 +1359,33 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
editOfferElements.add(priceTypeToggleButton);
HBox.setMargin(priceTypeToggleButton, new Insets(16, 0, 0, 0));
priceTypeToggleButton.setOnAction((actionEvent) -> {
updatePriceToggleButtons(model.getDataModel().getUseMarketBasedPrice().getValue());
});
// Trade fee
setupTradeFeeFields();
priceTypeToggleButton.setOnAction((actionEvent) ->
updatePriceToggleButtons(model.getDataModel().getUseMarketBasedPrice().getValue()));
secondRowHBox = new HBox();
secondRowHBox.setSpacing(5);
secondRowHBox.setAlignment(Pos.CENTER_LEFT);
HBox.setMargin(tradeFeeBox, new Insets(0, 0, 0, 1));
secondRowHBox.getChildren().addAll(amountInputBoxTuple.second, fakeXLabel, fixedPriceBox, priceTypeToggleButton, tradeFeeBox);
secondRowHBox.getChildren().addAll(amountInputBoxTuple.second, fakeXLabel, fixedPriceBox, priceTypeToggleButton);
GridPane.setRowIndex(secondRowHBox, ++gridRow);
GridPane.setColumnIndex(secondRowHBox, 0);
GridPane.setMargin(secondRowHBox, new Insets(0, 10, 18, 0));
gridPane.getChildren().add(secondRowHBox);
}
private void setupTradeFeeFields() {
tradeFeeInBtcTextField = new TextField();
tradeFeeInBtcTextField.setMouseTransparent(true);
tradeFeeInBtcTextField.setId("trade-fee-textfield");
tradeFeeInBtcTextField.setPadding(new Insets(-6, 5, -8, 0));
private VBox getTradeFeeFieldsBox() {
tradeFeeInBtcLabel = new Label();
tradeFeeInBtcLabel.setMouseTransparent(true);
tradeFeeInBtcLabel.setId("trade-fee-textfield");
tradeFeeInBsqTextField = new TextField();
tradeFeeInBsqTextField.setMouseTransparent(true);
tradeFeeInBsqTextField.setId("trade-fee-textfield");
tradeFeeInBsqTextField.setPadding(new Insets(-9, 5, -7, 0));
tradeFeeInBsqLabel = new Label();
tradeFeeInBsqLabel.setMouseTransparent(true);
tradeFeeInBsqLabel.setId("trade-fee-textfield");
VBox vBox = new VBox();
vBox.setMaxWidth(243);
vBox.getStyleClass().add("input-with-border");
vBox.getChildren().addAll(tradeFeeInBtcTextField, tradeFeeInBsqTextField);
vBox.setSpacing(6);
vBox.setMaxWidth(300);
vBox.setAlignment(DevEnv.isDaoActivated() ? Pos.CENTER_RIGHT : Pos.CENTER_LEFT);
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
tradeFeeInBtcToggle.setText("BTC");
@ -1357,10 +1398,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
VBox tradeFeeToggleButtonBox = new VBox();
tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);
tradeFeeDescriptionLabel = new AutoTooltipLabel("Select trade fee currency");
tradeFeeDescriptionLabel.setId("input-description-label");
tradeFeeDescriptionLabel.setPrefWidth(170);
HBox hBox = new HBox();
hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
hBox.setMinHeight(47);
@ -1368,9 +1405,11 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
HBox.setHgrow(vBox, Priority.ALWAYS);
HBox.setHgrow(tradeFeeToggleButtonBox, Priority.NEVER);
tradeFeeBox = new VBox();
tradeFeeBox.setSpacing(2);
tradeFeeBox.getChildren().addAll(tradeFeeDescriptionLabel, hBox);
final Tuple2<Label, VBox> tradeInputBox = getTradeInputBox(hBox, Res.get("createOffer.tradeFee.descriptionBSQEnabled"));
tradeFeeDescriptionLabel = tradeInputBox.first;
return tradeInputBox.second;
}

View file

@ -836,11 +836,13 @@ public abstract class Overlay<T extends Overlay> {
protected void addCloseButton() {
if (!hideCloseButton) {
closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText);
closeButton.getStyleClass().add("compact-button");
closeButton.setOnAction(event -> doClose());
}
if (actionHandlerOptional.isPresent() || actionButtonText != null) {
actionButton = new AutoTooltipButton(actionButtonText == null ? Res.get("shared.ok") : actionButtonText);
actionButton.setDefaultButton(true);
actionButton.getStyleClass().add("action-button");
//TODO app wide focus
//actionButton.requestFocus();
actionButton.setOnAction(event -> {
@ -852,7 +854,7 @@ public abstract class Overlay<T extends Overlay> {
HBox hBox = new HBox();
hBox.setSpacing(10);
if (!hideCloseButton)
hBox.getChildren().addAll(spacer, closeButton, actionButton);
hBox.getChildren().addAll(spacer, actionButton, closeButton);
else
hBox.getChildren().addAll(spacer, actionButton);
HBox.setHgrow(spacer, Priority.ALWAYS);

View file

@ -37,7 +37,8 @@ import bisq.core.user.User;
import bisq.core.util.BSFormatter;
import bisq.common.crypto.KeyRing;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple4;
import org.bitcoinj.core.Coin;
@ -48,9 +49,10 @@ import com.google.common.base.Joiner;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.geometry.Insets;
@ -68,12 +70,11 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
private final BSFormatter formatter;
private final User user;
private final KeyRing keyRing;
private final Navigation navigation;
private Offer offer;
private Coin tradeAmount;
private Price tradePrice;
private Optional<Runnable> placeOfferHandlerOptional = Optional.<Runnable>empty();
private Optional<Runnable> takeOfferHandlerOptional = Optional.<Runnable>empty();
private Optional<Runnable> placeOfferHandlerOptional = Optional.empty();
private Optional<Runnable> takeOfferHandlerOptional = Optional.empty();
private BusyAnimation busyAnimation;
@ -87,7 +88,6 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
this.formatter = formatter;
this.user = user;
this.keyRing = keyRing;
this.navigation = navigation;
type = Type.Confirmation;
}
@ -141,6 +141,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
}
private void addContent() {
gridPane.getColumnConstraints().get(0).setMinWidth(224);
int rows = 5;
List<String> acceptedBanks = offer.getAcceptedBankIds();
boolean showAcceptedBanks = acceptedBanks != null && !acceptedBanks.isEmpty();
@ -162,55 +164,55 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
String btcDirectionInfo = ":";
OfferPayload.Direction direction = offer.getDirection();
String currencyCode = offer.getCurrencyCode();
String offerTypeLabel = Res.getWithCol("shared.offerType");
String offerTypeLabel = Res.get("shared.offerType");
String toReceive = " " + Res.get("shared.toReceive");
String toSpend = " " + Res.get("shared.toSpend");
double firstRowDistance = Layout.FIRST_ROW_DISTANCE;
double firstRowDistance = Layout.TWICE_FIRST_ROW_DISTANCE;
if (takeOfferHandlerOptional.isPresent()) {
FormBuilder.addTopLabelTextField(gridPane, rowIndex, offerTypeLabel,
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
formatter.getDirectionForTakeOffer(direction, currencyCode), firstRowDistance);
fiatDirectionInfo = direction == OfferPayload.Direction.BUY ? toReceive : toSpend;
btcDirectionInfo = direction == OfferPayload.Direction.SELL ? toReceive : toSpend;
} else if (placeOfferHandlerOptional.isPresent()) {
FormBuilder.addTopLabelTextField(gridPane, rowIndex, offerTypeLabel,
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
formatter.getOfferDirectionForCreateOffer(direction, currencyCode), firstRowDistance);
fiatDirectionInfo = direction == OfferPayload.Direction.SELL ? toReceive : toSpend;
btcDirectionInfo = direction == OfferPayload.Direction.BUY ? toReceive : toSpend;
} else {
FormBuilder.addTopLabelTextField(gridPane, rowIndex, offerTypeLabel,
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
formatter.getDirectionBothSides(direction, currencyCode), firstRowDistance);
}
String btcAmount = Res.get("shared.btcAmount");
if (takeOfferHandlerOptional.isPresent()) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
formatter.formatCoinWithCode(tradeAmount));
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, formatter.formatVolumeLabel(currencyCode) + fiatDirectionInfo,
addConfirmationLabelLabel(gridPane, ++rowIndex, formatter.formatVolumeLabel(currencyCode) + fiatDirectionInfo,
formatter.formatVolumeWithCode(offer.getVolumeByAmount(tradeAmount)));
} else {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
formatter.formatCoinWithCode(offer.getAmount()));
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.minBtcAmount"),
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.minBtcAmount"),
formatter.formatCoinWithCode(offer.getMinAmount()));
String volume = formatter.formatVolumeWithCode(offer.getVolume());
String minVolume = "";
if (offer.getVolume() != null && offer.getMinVolume() != null &&
!offer.getVolume().equals(offer.getMinVolume()))
minVolume = " " + Res.get("offerDetailsWindow.min", formatter.formatVolumeWithCode(offer.getMinVolume()));
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex,
addConfirmationLabelLabel(gridPane, ++rowIndex,
formatter.formatVolumeLabel(currencyCode) + fiatDirectionInfo, volume + minVolume);
}
String priceLabel = Res.getWithCol("shared.price");
String priceLabel = Res.get("shared.price");
if (takeOfferHandlerOptional.isPresent()) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, priceLabel, formatter.formatPrice(tradePrice));
addConfirmationLabelLabel(gridPane, ++rowIndex, priceLabel, formatter.formatPrice(tradePrice));
} else {
Price price = offer.getPrice();
if (offer.isUseMarketBasedPrice()) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, priceLabel, formatter.formatPrice(price) +
addConfirmationLabelLabel(gridPane, ++rowIndex, priceLabel, formatter.formatPrice(price) +
" " + Res.get("offerDetailsWindow.distance",
formatter.formatPercentagePrice(offer.getMarketPriceMargin())));
} else {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, priceLabel, formatter.formatPrice(price));
addConfirmationLabelLabel(gridPane, ++rowIndex, priceLabel, formatter.formatPrice(price));
}
}
final PaymentMethod paymentMethod = offer.getPaymentMethod();
@ -226,36 +228,36 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
final PaymentAccount myPaymentAccount = user.getPaymentAccount(makerPaymentAccountId);
String countryCode = offer.getCountryCode();
if (offer.isMyOffer(keyRing) && makerPaymentAccountId != null && myPaymentAccount != null) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.myTradingAccount"), myPaymentAccount.getAccountName());
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.myTradingAccount"), myPaymentAccount.getAccountName());
} else {
final String method = Res.get(paymentMethod.getId());
String methodWithBankId = method + bankId;
String paymentMethodLabel = Res.get("shared.paymentMethod");
if (countryCode != null && (isNationalBanks || isSpecificBanks || isSepa)) {
if (BankUtil.isBankIdRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex,
addConfirmationLabelLabel(gridPane, ++rowIndex,
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offererBankId"),
methodWithBankId);
else if (BankUtil.isBankNameRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex,
addConfirmationLabelLabel(gridPane, ++rowIndex,
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offerersBankName"),
methodWithBankId);
} else if (paymentMethod.equals(PaymentMethod.CASH_DEPOSIT)) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex,
addConfirmationLabelLabel(gridPane, ++rowIndex,
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offererBankId"),
methodWithBankId);
} else {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), method);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), method);
}
}
if (showAcceptedBanks) {
if (paymentMethod.equals(PaymentMethod.SAME_BANK)) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.bankId"), acceptedBanks.get(0));
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.bankId"), acceptedBanks.get(0));
} else if (isSpecificBanks) {
String value = Joiner.on(", ").join(acceptedBanks);
String acceptedBanksLabel = Res.getWithCol("shared.acceptedBanks");
String acceptedBanksLabel = Res.get("shared.acceptedBanks");
Tooltip tooltip = new Tooltip(acceptedBanksLabel + " " + value);
TextField acceptedBanksTextField = FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, acceptedBanksLabel, value).second;
Label acceptedBanksTextField = addConfirmationLabelLabel(gridPane, ++rowIndex, acceptedBanksLabel, value).second;
acceptedBanksTextField.setMouseTransparent(false);
acceptedBanksTextField.setTooltip(tooltip);
}
@ -264,7 +266,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
String countries;
Tooltip tooltip = null;
if (CountryUtil.containsAllSepaEuroCountries(acceptedCountryCodes)) {
countries = Res.getWithCol("shared.allEuroCountries");
countries = Res.get("shared.allEuroCountries");
} else {
if (acceptedCountryCodes.size() == 1) {
countries = CountryUtil.getNameAndCode(acceptedCountryCodes.get(0));
@ -274,8 +276,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes));
}
}
TextField acceptedCountries = FormBuilder.addTopLabelTextField(gridPane, ++rowIndex,
Res.getWithCol("shared.acceptedTakerCountries"), countries).second;
Label acceptedCountries = addConfirmationLabelLabel(gridPane, ++rowIndex,
Res.get("shared.acceptedTakerCountries"), countries).second;
if (tooltip != null) {
acceptedCountries.setMouseTransparent(false);
acceptedCountries.setTooltip(tooltip);
@ -283,8 +285,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
}
if (isF2F) {
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.getWithCol("payment.f2f.city"), offer.getF2FCity());
TextArea textArea = addTopLabelTextArea(gridPane, ++rowIndex, Res.getWithCol("payment.f2f.extra"), "").second;
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("payment.f2f.city"), offer.getF2FCity());
TextArea textArea = FormBuilder.addTopLabelTextArea(gridPane, ++rowIndex, Res.get("payment.f2f.extra"), "").second;
textArea.setText(offer.getF2FExtraInfo());
textArea.setMinHeight(33);
textArea.setMaxHeight(textArea.getMinHeight());
@ -292,8 +294,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
}
rows = 4;
String paymentMethodCountryCode = countryCode;
if (paymentMethodCountryCode != null)
if (countryCode != null)
rows++;
if (offer.getOfferFeePaymentTxId() != null)
rows++;
@ -301,11 +302,11 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
rows++;
addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("shared.details"), Layout.GROUP_DISTANCE);
addTopLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.getWithCol("shared.offerId"), offer.getId(),
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addTopLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("offerDetailsWindow.makersOnion"),
addConfirmationLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.get("shared.offerId"), offer.getId(),
Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("offerDetailsWindow.makersOnion"),
offer.getMakerNodeAddress().getFullAddress());
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.creationDate"),
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.creationDate"),
formatter.formatDateTime(offer.getDate()));
String value = Res.getWithColAndCap("shared.buyer") +
" " +
@ -314,31 +315,35 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
Res.getWithColAndCap("shared.seller") +
" " +
formatter.formatCoinWithCode(offer.getSellerSecurityDeposit());
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.getWithCol("shared.securityDeposit"), value);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), value);
if (paymentMethodCountryCode != null && !isF2F)
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.countryBank"),
CountryUtil.getNameAndCode(paymentMethodCountryCode));
if (countryCode != null && !isF2F)
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.countryBank"),
CountryUtil.getNameAndCode(countryCode));
addTopLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("offerDetailsWindow.acceptedArbitrators"),
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("offerDetailsWindow.acceptedArbitrators"),
formatter.arbitratorAddressesToString(offer.getArbitratorNodeAddresses()));
if (offer.getOfferFeePaymentTxId() != null)
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId());
FormBuilder.addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId());
if (placeOfferHandlerOptional.isPresent()) {
addTitledGroupBg(gridPane, ++rowIndex, 1, Res.get("offerDetailsWindow.commitment"), Layout.GROUP_DISTANCE);
FormBuilder.addTopLabelTextField(gridPane, rowIndex, Res.get("offerDetailsWindow.agree"), Res.get("createOffer.tac"),
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
final Tuple2<Label, Label> labelLabelTuple2 = addConfirmationLabelLabel(gridPane, rowIndex, Res.get("offerDetailsWindow.agree"), Res.get("createOffer.tac"),
Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
labelLabelTuple2.second.setWrapText(true);
addConfirmAndCancelButtons(true);
} else if (takeOfferHandlerOptional.isPresent()) {
addTitledGroupBg(gridPane, ++rowIndex, 1, Res.get("shared.contract"), Layout.GROUP_DISTANCE);
FormBuilder.addTopLabelTextField(gridPane, rowIndex, Res.get("offerDetailsWindow.tac"), Res.get("takeOffer.tac"),
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
final Tuple2<Label, Label> labelLabelTuple2 = addConfirmationLabelLabel(gridPane, rowIndex, Res.get("offerDetailsWindow.tac"), Res.get("takeOffer.tac"),
Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
labelLabelTuple2.second.setWrapText(true);
addConfirmAndCancelButtons(false);
} else {
Button closeButton = addButtonAfterGroup(gridPane, ++rowIndex, Res.get("shared.close"));
GridPane.setColumnIndex(closeButton, 1);
closeButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(Runnable::run);
hide();
@ -348,7 +353,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
private void addConfirmAndCancelButtons(boolean isPlaceOffer) {
boolean isBuyOffer = offer.isBuyOffer();
boolean isBuyerRole = isPlaceOffer ? isBuyOffer : !isBuyOffer;
boolean isBuyerRole = isPlaceOffer == isBuyOffer;
String placeOfferButtonText = isBuyerRole ?
Res.get("offerDetailsWindow.confirm.maker", Res.get("shared.buy")) :
Res.get("offerDetailsWindow.confirm.maker", Res.get("shared.sell"));
@ -359,8 +364,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
ImageView iconView = new ImageView();
iconView.setId(isBuyerRole ? "image-buy-white" : "image-sell-white");
Tuple3<Button, BusyAnimation, Label> placeOfferTuple = addButtonBusyAnimationLabelAfterGroup(gridPane,
++rowIndex,
Tuple4<Button, BusyAnimation, Label, HBox> placeOfferTuple = addButtonBusyAnimationLabelAfterGroup(gridPane,
++rowIndex, 1,
isPlaceOffer ? placeOfferButtonText : takeOfferButtonText);
AutoTooltipButton button = (AutoTooltipButton) placeOfferTuple.first;
@ -374,7 +379,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
busyAnimation = placeOfferTuple.second;
Label spinnerInfoLabel = placeOfferTuple.third;
Button cancelButton = addButton(gridPane, ++rowIndex, Res.get("shared.cancel"));
Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
cancelButton.setDefaultButton(false);
cancelButton.setId("cancel-button");
cancelButton.setOnAction(e -> {
@ -382,6 +387,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
hide();
});
placeOfferTuple.forth.getChildren().add(cancelButton);
button.setOnAction(e -> {
if (user.getAcceptedArbitrators() != null &&
user.getAcceptedArbitrators().size() > 0) {

View file

@ -35,7 +35,7 @@ import bisq.network.p2p.network.NetworkNode;
import bisq.common.UserThread;
import bisq.common.storage.FileUtil;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
import bisq.common.util.Utilities;
import com.google.inject.name.Named;
@ -212,7 +212,7 @@ public class TorNetworkSettingsWindow extends Overlay<TorNetworkSettingsWindow>
GridPane.setHalignment(deleteFilesLabel, HPos.LEFT);
GridPane.setValignment(deleteFilesLabel, VPos.TOP);
Tuple3<Button, BusyAnimation, Label> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++rowIndex, Res.get("torNetworkSettingWindow.deleteFiles.button"));
Tuple4<Button, BusyAnimation, Label, HBox> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++rowIndex, Res.get("torNetworkSettingWindow.deleteFiles.button"));
Button deleteFilesButton = tuple.first;
deleteFilesButton.setOnAction(e -> {
tuple.second.play();

View file

@ -32,13 +32,14 @@ import bisq.core.user.Preferences;
import bisq.core.util.BSFormatter;
import bisq.core.util.BsqFormatter;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
import com.google.inject.Inject;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.geometry.Insets;
@ -165,7 +166,7 @@ public class EditOfferView extends MutableOfferView<EditOfferViewModel> {
private void addConfirmEditGroup() {
int tmpGridRow = 4;
final Tuple3<Button, BusyAnimation, Label> editOfferTuple = addButtonBusyAnimationLabelAfterGroup(gridPane, tmpGridRow++, Res.get("editOffer.confirmEdit"));
final Tuple4<Button, BusyAnimation, Label, HBox> editOfferTuple = addButtonBusyAnimationLabelAfterGroup(gridPane, tmpGridRow++, Res.get("editOffer.confirmEdit"));
confirmButton = editOfferTuple.first;
confirmButton.setMinHeight(40);

View file

@ -75,11 +75,12 @@ import bisq.core.user.DontShowAgainLookup;
import bisq.common.Timer;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.Subscription;
@ -315,7 +316,7 @@ public class BuyerStep2View extends TradeStepView {
GridPane.setRowSpan(accountTitledGroupBg, gridRow - 3);
Tuple3<Button, BusyAnimation, Label> tuple3 = FormBuilder.addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow,
Tuple4<Button, BusyAnimation, Label, HBox> tuple3 = FormBuilder.addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow,
Res.get("portfolio.pending.step2_buyer.paymentStarted"));
confirmButton = tuple3.first;
confirmButton.setOnAction(e -> onPaymentStarted());

View file

@ -47,12 +47,13 @@ import bisq.core.user.DontShowAgainLookup;
import bisq.common.Timer;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.Subscription;
@ -203,7 +204,7 @@ public class SellerStep3View extends TradeStepView {
GridPane.setRowSpan(titledGroupBg, 4);
}
Tuple3<Button, BusyAnimation, Label> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, Res.get("portfolio.pending.step3_seller.confirmReceipt"));
Tuple4<Button, BusyAnimation, Label, HBox> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, Res.get("portfolio.pending.step3_seller.confirmReceipt"));
confirmButton = tuple.first;
confirmButton.setOnAction(e -> onPaymentReceived());
busyAnimation = tuple.second;

View file

@ -214,6 +214,10 @@ public class FormBuilder {
return addTopLabelTextField(gridPane, rowIndex, title, "", top - 15);
}
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title, String value) {
return addTopLabelReadOnlyTextField(gridPane, rowIndex, title, value, 0);
}
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, int columnIndex, String title, String value, double top) {
Tuple3<Label, TextField, VBox> tuple = addTopLabelTextField(gridPane, rowIndex, title, value, top - 15);
GridPane.setColumnIndex(tuple.third, columnIndex);
@ -255,6 +259,22 @@ public class FormBuilder {
return new Tuple3<>(topLabelWithVBox.first, textField, topLabelWithVBox.second);
}
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane, int rowIndex, String title1, String title2) {
return addConfirmationLabelLabel(gridPane, rowIndex, title1, title2, 0);
}
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane, int rowIndex, String title1, String title2, double top) {
Label label1 = addLabel(gridPane, rowIndex, title1);
label1.getStyleClass().add("confirmation-label");
Label label2 = addLabel(gridPane, rowIndex, title2);
label2.getStyleClass().add("confirmation-value");
GridPane.setColumnIndex(label2, 1);
GridPane.setMargin(label1, new Insets(top, 0, 0, 0));
GridPane.setHalignment(label1, HPos.LEFT);
GridPane.setMargin(label2, new Insets(top, 0, 0, 0));
return new Tuple2<>(label1, label2);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Label + TextFieldWithIcon
@ -1049,8 +1069,11 @@ public class FormBuilder {
}
public static Tuple2<Label, TextFieldWithCopyIcon> addTopLabelTextFieldWithCopyIcon(GridPane gridPane, int rowIndex, String title, String value, double top) {
return addTopLabelTextFieldWithCopyIcon(gridPane, rowIndex, title, value, top, null);
}
TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon();
public static Tuple2<Label, TextFieldWithCopyIcon> addTopLabelTextFieldWithCopyIcon(GridPane gridPane, int rowIndex, String title, String value, double top, String styleClass) {
TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon(styleClass);
textFieldWithCopyIcon.setText(value);
final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textFieldWithCopyIcon, top);
@ -1058,6 +1081,24 @@ public class FormBuilder {
return new Tuple2<>(topLabelWithVBox.first, textFieldWithCopyIcon);
}
public static Tuple2<Label, TextFieldWithCopyIcon> addConfirmationLabelTextFieldWithCopyIcon(GridPane gridPane, int rowIndex, String title, String value) {
return addConfirmationLabelTextFieldWithCopyIcon(gridPane, rowIndex, title, value, 0);
}
public static Tuple2<Label, TextFieldWithCopyIcon> addConfirmationLabelTextFieldWithCopyIcon(GridPane gridPane, int rowIndex, String title, String value, double top) {
Label label = addLabel(gridPane, rowIndex, title, top);
label.getStyleClass().add("confirmation-label");
GridPane.setHalignment(label, HPos.LEFT);
TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon("confirmation-text-field-as-label");
textFieldWithCopyIcon.setText(value);
GridPane.setRowIndex(textFieldWithCopyIcon, rowIndex);
GridPane.setColumnIndex(textFieldWithCopyIcon, 1);
GridPane.setMargin(textFieldWithCopyIcon, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(textFieldWithCopyIcon);
return new Tuple2<>(label, textFieldWithCopyIcon);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Label + AddressTextField
///////////////////////////////////////////////////////////////////////////////////////////
@ -1350,16 +1391,23 @@ public class FormBuilder {
// Button + ProgressIndicator + Label
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<Button, BusyAnimation, Label> addButtonBusyAnimationLabelAfterGroup(GridPane gridPane,
int rowIndex,
String buttonTitle) {
return addButtonBusyAnimationLabel(gridPane, rowIndex, buttonTitle, 15);
public static Tuple4<Button, BusyAnimation, Label, HBox> addButtonBusyAnimationLabelAfterGroup(GridPane gridPane,
int rowIndex,
int colIndex,
String buttonTitle) {
return addButtonBusyAnimationLabel(gridPane, rowIndex, colIndex, buttonTitle, 15);
}
public static Tuple3<Button, BusyAnimation, Label> addButtonBusyAnimationLabel(GridPane gridPane,
int rowIndex,
String buttonTitle,
double top) {
public static Tuple4<Button, BusyAnimation, Label, HBox> addButtonBusyAnimationLabelAfterGroup(GridPane gridPane,
int rowIndex,
String buttonTitle) {
return addButtonBusyAnimationLabelAfterGroup(gridPane, rowIndex, 0, buttonTitle);
}
public static Tuple4<Button, BusyAnimation, Label, HBox> addButtonBusyAnimationLabel(GridPane gridPane,
int rowIndex,
int colIndex, String buttonTitle,
double top) {
HBox hBox = new HBox();
hBox.setSpacing(10);
@ -1370,15 +1418,16 @@ public class FormBuilder {
BusyAnimation busyAnimation = new BusyAnimation(false);
Label label = new AutoTooltipLabel();
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.setAlignment(Pos.CENTER_RIGHT);
hBox.getChildren().addAll(button, busyAnimation, label);
GridPane.setRowIndex(hBox, rowIndex);
GridPane.setColumnIndex(hBox, 0);
GridPane.setHalignment(hBox, HPos.RIGHT);
GridPane.setColumnIndex(hBox, colIndex);
GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(hBox);
return new Tuple3<>(button, busyAnimation, label);
return new Tuple4<>(button, busyAnimation, label, hBox);
}
@ -1394,8 +1443,9 @@ public class FormBuilder {
label.getStyleClass().add("input-label");
HBox box = new HBox();
HBox.setHgrow(input, Priority.ALWAYS);
input.setMaxWidth(Double.MAX_VALUE);
box.getStyleClass().add("input-with-border");
box.setMaxWidth(243);
box.getChildren().addAll(input, label);
return new Tuple3<>(box, input, label);
}
@ -1409,8 +1459,9 @@ public class FormBuilder {
label.getStyleClass().add("input-label");
HBox box = new HBox();
HBox.setHgrow(infoInputTextField, Priority.ALWAYS);
infoInputTextField.setMaxWidth(Double.MAX_VALUE);
box.getStyleClass().add("input-with-border");
box.setMaxWidth(243);
box.getChildren().addAll(infoInputTextField, label);
return new Tuple3<>(box, infoInputTextField, label);
}
@ -1467,16 +1518,13 @@ public class FormBuilder {
// Trade: Label, VBox
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple2<Label, VBox> getTradeInputBox(HBox amountValueBox) {
return getTradeInputBox(amountValueBox, "");
}
public static Tuple2<Label, VBox> getTradeInputBox(HBox amountValueBox, String descriptionText) {
public static Tuple2<Label, VBox> getTradeInputBox(Pane amountValueBox, String descriptionText) {
Label descriptionLabel = new AutoTooltipLabel(descriptionText);
descriptionLabel.setId("input-description-label");
descriptionLabel.setPrefWidth(170);
VBox box = new VBox();
box.setPadding(new Insets(10, 0, 0, 0));
box.setSpacing(2);
box.getChildren().addAll(descriptionLabel, amountValueBox);
return new Tuple2<>(descriptionLabel, box);

View file

@ -21,9 +21,13 @@ public class Layout {
public static final double INITIAL_SCENE_WIDTH = 1200;
public static final double INITIAL_SCENE_HEIGHT = 710; //740
public static final double FIRST_ROW_DISTANCE = 20d;
public static final double TWICE_FIRST_ROW_DISTANCE = 20d * 2;
public static final double FLOATING_LABEL_DISTANCE = 20d;
public static final double GROUP_DISTANCE = 40d;
public static final double COMPACT_GROUP_DISTANCE = 30d;
public static final double FIRST_ROW_AND_GROUP_DISTANCE = GROUP_DISTANCE + FIRST_ROW_DISTANCE;
public static final double COMPACT_FIRST_ROW_AND_GROUP_DISTANCE = COMPACT_GROUP_DISTANCE + FIRST_ROW_DISTANCE;
public static final double TWICE_FIRST_ROW_AND_GROUP_DISTANCE = GROUP_DISTANCE + TWICE_FIRST_ROW_DISTANCE;
public static final double PADDING_WINDOW = 20d;
public static double PADDING = 10d;
public static double SPACING_H_BOX = 10d;