mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
make volume and amount bi direct. editable and bindable, add validation for volume
This commit is contained in:
parent
1bc0dbfa31
commit
89d5c9ee86
@ -7,37 +7,37 @@
|
||||
xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController">
|
||||
|
||||
<Label fx:id="nameLabel" text="Name:"/>
|
||||
<TextField fx:id="nameTextField" editable="false" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="nameTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1"/>
|
||||
<Label text="Languages:" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="languagesTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="languagesTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
|
||||
<Label text="Reputation:" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="reputationTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="reputationTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
|
||||
<Label text="Max. trade volume:" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="maxTradeVolumeTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="maxTradeVolumeTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
|
||||
<Label text="Passive service fee:" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="passiveServiceFeeTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="passiveServiceFeeTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
|
||||
<Label text="Arbitration fee:" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="arbitrationFeeTextField" editable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="arbitrationFeeTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="5"/>
|
||||
|
||||
<Label text="Methods of arbitration:" GridPane.rowIndex="6"/>
|
||||
<TextField fx:id="methodsTextField" editable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="6"/>
|
||||
<TextField fx:id="methodsTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="6"/>
|
||||
|
||||
<Label text="ID verifications:" GridPane.rowIndex="7"/>
|
||||
<TextField fx:id="idVerificationsTextField" editable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="7"/>
|
||||
<TextField fx:id="idVerificationsTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="7"/>
|
||||
|
||||
<Label text="Web page:" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="webPageTextField" editable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="webPageTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="9"/>
|
||||
|
||||
<Label text="Description:" GridPane.rowIndex="10" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
<Insets top="10.0"/>
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<TextArea fx:id="descriptionTextArea" editable="false" prefHeight="150.0" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="10"/>
|
||||
<TextArea fx:id="descriptionTextArea" editable="false" focusTraversable="false" prefHeight="150.0" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="10"/>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0"/>
|
||||
|
@ -18,11 +18,11 @@
|
||||
<TextField fx:id="nameTextField" GridPane.columnIndex="1" GridPane.columnSpan="3"/>
|
||||
|
||||
<Label text="ID type:" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="idTypeTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="idTypeTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<ComboBox fx:id="idTypeComboBox" onAction="#onSelectIDType" promptText="Select ID type" prefWidth="150.0" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
||||
|
||||
<Label text="Supported language(s):" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="languagesTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="languagesTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
<Button onAction="#onClearLanguages" text="Clear" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
||||
<ComboBox fx:id="languageComboBox" onAction="#onAddLanguage" prefWidth="150.0" promptText="Add language" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
|
||||
|
||||
@ -42,12 +42,12 @@
|
||||
<TextField fx:id="minArbitrationFeeTextField" promptText="Recommended: 0.1 - 0.2 BTC" GridPane.columnIndex="1" GridPane.rowIndex="7" GridPane.columnSpan="3"/>
|
||||
|
||||
<Label text="Method(s) used for arbitration:" GridPane.rowIndex="8"/>
|
||||
<TextField fx:id="methodsTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||
<TextField fx:id="methodsTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||
<Button onAction="#onClearMethods" text="Clear" GridPane.columnIndex="2" GridPane.rowIndex="8"/>
|
||||
<ComboBox fx:id="methodsComboBox" onAction="#onAddMethod" prefWidth="150.0" promptText="Add method" GridPane.columnIndex="3" GridPane.rowIndex="8"/>
|
||||
|
||||
<Label text="Offer ID verification(s):" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="idVerificationsTextField" promptText="Optional" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="idVerificationsTextField" promptText="Optional" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
||||
<Button onAction="#onClearIDVerifications" text="Clear" GridPane.columnIndex="2" GridPane.rowIndex="9"/>
|
||||
<ComboBox fx:id="idVerificationsComboBox" onAction="#onAddIDVerification" prefWidth="150.0" promptText="Add verification" GridPane.columnIndex="3"
|
||||
GridPane.rowIndex="9"/>
|
||||
@ -99,7 +99,7 @@
|
||||
<GridPane hgap="5.0" vgap="5.0">
|
||||
|
||||
<Label text="Collateral address:"/>
|
||||
<TextField fx:id="collateralAddressTextField" editable="false" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="collateralAddressTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1"/>
|
||||
<Label fx:id="copyIcon" id="copy-icon" GridPane.columnIndex="2">
|
||||
<padding>
|
||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
||||
@ -110,7 +110,7 @@
|
||||
</Label>
|
||||
|
||||
<Label text="Balance:" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="balanceTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="balanceTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<ConfidenceProgressIndicator fx:id="progressIndicator" GridPane.columnIndex="2" GridPane.halignment="LEFT"
|
||||
GridPane.rowIndex="1" GridPane.rowSpan="2" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
.text-field:readonly {
|
||||
-fx-text-fill: #000000;
|
||||
-fx-background-color: #ffffff;
|
||||
-fx-background-color: #FAFAFA;
|
||||
}
|
||||
|
||||
#feedback-text {
|
||||
|
@ -107,9 +107,12 @@ public class ValidatingTextField extends TextField
|
||||
|
||||
private void validate(String input)
|
||||
{
|
||||
NumberValidator.ValidationResult validationResult = numberValidator.validate(input);
|
||||
valid.set(validationResult.isValid);
|
||||
applyErrorMessage(validationResult);
|
||||
if (input != null)
|
||||
{
|
||||
NumberValidator.ValidationResult validationResult = numberValidator.validate(input);
|
||||
valid.set(validationResult.isValid);
|
||||
applyErrorMessage(validationResult);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyErrorMessage(NumberValidator.ValidationResult validationResult)
|
||||
|
@ -22,6 +22,7 @@ public class AddressTextField extends AnchorPane
|
||||
public AddressTextField()
|
||||
{
|
||||
addressTextField = new TextField();
|
||||
addressTextField.setFocusTraversable(false);
|
||||
addressTextField.setEditable(false);
|
||||
|
||||
copyIcon = new Label();
|
||||
|
@ -33,9 +33,11 @@ public class BalanceTextField extends AnchorPane
|
||||
public BalanceTextField()
|
||||
{
|
||||
balanceTextField = new TextField();
|
||||
balanceTextField.setFocusTraversable(false);
|
||||
balanceTextField.setEditable(false);
|
||||
|
||||
progressIndicator = new ConfidenceProgressIndicator();
|
||||
progressIndicator.setFocusTraversable(false);
|
||||
progressIndicator.setPrefSize(24, 24);
|
||||
progressIndicator.setId("funds-confidence");
|
||||
progressIndicator.setLayoutY(1);
|
||||
|
@ -27,7 +27,6 @@ import io.bitsquare.user.User;
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.binding.DoubleBinding;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
@ -44,9 +43,6 @@ import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static javafx.beans.binding.Bindings.createDoubleBinding;
|
||||
import static javafx.beans.binding.Bindings.createStringBinding;
|
||||
|
||||
/**
|
||||
* Represents the visible state of the view
|
||||
*/
|
||||
@ -158,7 +154,7 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
//TODO just for dev testing
|
||||
if (BitSquare.fillFormsWithDummyData)
|
||||
{
|
||||
amountTextField.setText("1");
|
||||
amountTextField.setText("1.0");
|
||||
minAmountTextField.setText("0.1");
|
||||
priceTextField.setText("" + (int) (499 - new Random().nextDouble() * 1000 / 100));
|
||||
}
|
||||
@ -166,21 +162,40 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
|
||||
private void setupBindings()
|
||||
{
|
||||
// setup bindings
|
||||
DoubleBinding amountBinding = createDoubleBinding(() -> BitSquareFormatter.parseToDouble(viewModel.amount.get()), viewModel.amount);
|
||||
DoubleBinding priceBinding = createDoubleBinding(() -> BitSquareFormatter.parseToDouble(viewModel.price.get()), viewModel.price);
|
||||
viewModel.amount.addListener((ov, oldValue, newValue) -> {
|
||||
double amount = BitSquareFormatter.parseToDouble(newValue);
|
||||
double price = BitSquareFormatter.parseToDouble(viewModel.price.get());
|
||||
double volume = amount * price;
|
||||
viewModel.volume.set(BitSquareFormatter.formatVolume(volume));
|
||||
viewModel.totals.set(BitSquareFormatter.formatTotalsAsBtc(viewModel.amount.get(), collateral, FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
viewModel.collateral.set(BitSquareFormatter.formatCollateralAsBtc(viewModel.amount.get(), collateral));
|
||||
});
|
||||
|
||||
viewModel.volume.bind(createStringBinding(() -> BitSquareFormatter.formatVolume(amountBinding.get() * priceBinding.get()), amountBinding, priceBinding));
|
||||
viewModel.collateral.bind(createStringBinding(() -> BitSquareFormatter.formatCollateralAsBtc(viewModel.amount.get(), collateral), amountBinding));
|
||||
viewModel.totals.bind(createStringBinding(() -> BitSquareFormatter.formatTotalsAsBtc(viewModel.amount.get(), collateral, FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)), amountBinding, priceBinding));
|
||||
viewModel.price.addListener((ov, oldValue, newValue) -> {
|
||||
double price = BitSquareFormatter.parseToDouble(newValue);
|
||||
double amount = BitSquareFormatter.parseToDouble(viewModel.amount.get());
|
||||
double volume = amount * price;
|
||||
viewModel.volume.set(BitSquareFormatter.formatVolume(volume));
|
||||
});
|
||||
|
||||
viewModel.volume.addListener((ov, oldValue, newValue) -> {
|
||||
double volume = BitSquareFormatter.parseToDouble(newValue);
|
||||
double price = BitSquareFormatter.parseToDouble(viewModel.price.get());
|
||||
if (price != 0)
|
||||
{
|
||||
double amount = volume / price;
|
||||
viewModel.amount.set(BitSquareFormatter.formatVolume(amount));
|
||||
viewModel.totals.set(BitSquareFormatter.formatTotalsAsBtc(viewModel.amount.get(), collateral, FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
viewModel.collateral.set(BitSquareFormatter.formatCollateralAsBtc(viewModel.amount.get(), collateral));
|
||||
}
|
||||
});
|
||||
|
||||
// apply bindings to controls
|
||||
buyLabel.textProperty().bind(viewModel.directionLabel);
|
||||
amountTextField.textProperty().bindBidirectional(viewModel.amount);
|
||||
priceTextField.textProperty().bindBidirectional(viewModel.price);
|
||||
minAmountTextField.textProperty().bindBidirectional(viewModel.minAmount);
|
||||
volumeTextField.textProperty().bindBidirectional(viewModel.volume);
|
||||
|
||||
volumeTextField.textProperty().bind(viewModel.volume);
|
||||
minAmountTextField.textProperty().bindBidirectional(viewModel.minAmount);
|
||||
collateralLabel.textProperty().bind(viewModel.collateralLabel);
|
||||
collateralTextField.textProperty().bind(viewModel.collateral);
|
||||
totalsTextField.textProperty().bind(viewModel.totals);
|
||||
@ -207,8 +222,14 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
BtcValidator amountValidator = new BtcValidator();
|
||||
amountTextField.setNumberValidator(amountValidator);
|
||||
amountTextField.setErrorPopupLayoutReference((Region) amountTextField.getParent());
|
||||
|
||||
priceTextField.setNumberValidator(new FiatValidator());
|
||||
priceTextField.setErrorPopupLayoutReference((Region) amountTextField.getParent());
|
||||
|
||||
BtcValidator volumeValidator = new BtcValidator();
|
||||
volumeTextField.setNumberValidator(volumeValidator);
|
||||
volumeTextField.setErrorPopupLayoutReference((Region) volumeTextField.getParent());
|
||||
|
||||
BtcValidator minAmountValidator = new BtcValidator();
|
||||
minAmountTextField.setNumberValidator(minAmountValidator);
|
||||
|
||||
@ -219,6 +240,21 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
amountValidator,
|
||||
minAmountValidator);
|
||||
|
||||
amountTextField.focusedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
// only on focus out and ignore focus loss from window
|
||||
if (!newValue && amountTextField.getScene().getWindow().isFocused())
|
||||
volumeTextField.reValidate();
|
||||
});
|
||||
volumeTextField.focusedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
// only on focus out and ignore focus loss from window
|
||||
if (!newValue && volumeTextField.getScene().getWindow().isFocused())
|
||||
amountTextField.reValidate();
|
||||
});
|
||||
priceTextField.focusedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
// only on focus out and ignore focus loss from window
|
||||
if (!newValue && priceTextField.getScene().getWindow().isFocused())
|
||||
volumeTextField.reValidate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<Label text="BTC for:"/>
|
||||
<ValidatingTextField fx:id="priceTextField" prefWidth="70.0" alignment="CENTER_RIGHT"/>
|
||||
<Label text="EUR ="/>
|
||||
<ValidatingTextField fx:id="volumeTextField" prefWidth="70.0" alignment="CENTER_RIGHT" editable="false"/>
|
||||
<ValidatingTextField fx:id="volumeTextField" prefWidth="70.0" alignment="CENTER_RIGHT"/>
|
||||
<Label text="EUR in total"/>
|
||||
</HBox>
|
||||
|
||||
@ -29,19 +29,19 @@
|
||||
<ValidatingTextField fx:id="minAmountTextField" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
|
||||
<Label fx:id="collateralLabel" text="Collateral:" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="collateralTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="collateralTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
|
||||
<Label text="Total Fees (Offer + tx)" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="feeLabel" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="feeLabel" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
|
||||
<Label text="Total funds needed:" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="totalsTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="totalsTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
||||
|
||||
<Label text="BTC address for deposit:" GridPane.rowIndex="6"/>
|
||||
<AddressTextField fx:id="addressTextField" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||
<AddressTextField fx:id="addressTextField" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||
|
||||
<Label text="Actual balance:" GridPane.rowIndex="7"/>
|
||||
<BalanceTextField fx:id="balanceTextField" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||
<BalanceTextField fx:id="balanceTextField" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||
|
||||
<!--
|
||||
<Label id="form-header-text" text="Offer details" GridPane.rowIndex="8">
|
||||
@ -52,26 +52,26 @@
|
||||
-->
|
||||
|
||||
<Label text="Bank account type:" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="bankAccountTypeTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="bankAccountTypeTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
||||
|
||||
<Label text="Bank account currency:" GridPane.rowIndex="10"/>
|
||||
<TextField fx:id="bankAccountCurrencyTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="10"/>
|
||||
<TextField fx:id="bankAccountCurrencyTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="10"/>
|
||||
|
||||
<Label text="Bank account county:" GridPane.rowIndex="11"/>
|
||||
<TextField fx:id="bankAccountCountyTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="11"/>
|
||||
<TextField fx:id="bankAccountCountyTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="11"/>
|
||||
|
||||
<Label text="Accepted countries:" GridPane.rowIndex="12"/>
|
||||
<TextField fx:id="acceptedCountriesTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="12"/>
|
||||
<TextField fx:id="acceptedCountriesTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="12"/>
|
||||
|
||||
<Label text="Accepted languages:" GridPane.rowIndex="13"/>
|
||||
<TextField fx:id="acceptedLanguagesTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="13"/>
|
||||
<TextField fx:id="acceptedLanguagesTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="13"/>
|
||||
|
||||
|
||||
<Button fx:id="placeOfferButton" defaultButton="true" onAction="#onPlaceOffer" text="Place offer" GridPane.columnIndex="1" GridPane.rowIndex="14"/>
|
||||
|
||||
<Label fx:id="txTitleLabel" text="Transaction ID:" visible="false" GridPane.rowIndex="14"/>
|
||||
<TextField fx:id="transactionIdTextField" visible="false" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="14"/>
|
||||
<ConfidenceProgressIndicator fx:id="progressIndicator" visible="false" progress="0" GridPane.columnIndex="2" GridPane.halignment="LEFT"
|
||||
<TextField fx:id="transactionIdTextField" visible="false" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="14"/>
|
||||
<ConfidenceProgressIndicator fx:id="progressIndicator" visible="false" focusTraversable="false" progress="0" GridPane.columnIndex="2" GridPane.halignment="LEFT"
|
||||
GridPane.rowIndex="14" GridPane.rowSpan="2" GridPane.valignment="TOP">
|
||||
<GridPane.margin>
|
||||
<Insets top="2.0"/>
|
||||
@ -79,7 +79,7 @@
|
||||
</ConfidenceProgressIndicator>
|
||||
<Label fx:id="confirmationLabel" text="Checking confirmations..." visible="false" GridPane.columnIndex="3" GridPane.rowIndex="14"/>
|
||||
|
||||
<Button fx:id="closeButton" visible="false" defaultButton="true" onAction="#onClose" text="Close" GridPane.columnIndex="1" GridPane.rowIndex="15"/>
|
||||
<Button fx:id="closeButton" visible="false" defaultButton="true" focusTraversable="false" onAction="#onClose" text="Close" GridPane.columnIndex="1" GridPane.rowIndex="15"/>
|
||||
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES"/>
|
||||
|
@ -22,38 +22,38 @@
|
||||
<ValidatedTextField fx:id="amountTextField" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Price (EUR/BTC):" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="priceTextField" editable="false" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="priceTextField" editable="false" focusTraversable="false" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Volume (EUR):" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="volumeTextField" editable="false" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="volumeTextField" editable="false" focusTraversable="false" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label fx:id="collateralLabel" text="Collateral:" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="collateralTextField" editable="false" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="collateralTextField" editable="false" focusTraversable="false" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Total Fees (Offer + tx):" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="feeTextField" editable="false" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="feeTextField" editable="false" focusTraversable="false" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Total:" GridPane.rowIndex="6"/>
|
||||
<TextField fx:id="totalTextField" editable="false" GridPane.rowIndex="6" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="totalTextField" editable="false" focusTraversable="false" GridPane.rowIndex="6" GridPane.columnIndex="1"/>
|
||||
|
||||
<Button fx:id="takeOfferButton" text="Take offer and pay" onAction="#onTakeOffer" defaultButton="true" GridPane.rowIndex="7" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Offer details:" id="form-header-text" GridPane.rowIndex="8"/>
|
||||
|
||||
<Label text="Bank account type:" GridPane.rowIndex="9"/>
|
||||
<TextField fx:id="bankAccountTypeTextField" editable="false" GridPane.rowIndex="9" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="bankAccountTypeTextField" editable="false" focusTraversable="false" GridPane.rowIndex="9" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Country:" GridPane.rowIndex="10"/>
|
||||
<TextField fx:id="countryTextField" editable="false" GridPane.rowIndex="10" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="countryTextField" editable="false" focusTraversable="false" GridPane.rowIndex="10" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Arbitrators:" GridPane.rowIndex="11"/>
|
||||
<TextField fx:id="arbitratorsTextField" editable="false" GridPane.rowIndex="11" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="arbitratorsTextField" editable="false" focusTraversable="false" GridPane.rowIndex="11" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Supported languages:" GridPane.rowIndex="12"/>
|
||||
<TextField fx:id="supportedLanguagesTextField" editable="false" GridPane.rowIndex="12" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="supportedLanguagesTextField" editable="false" focusTraversable="false" GridPane.rowIndex="12" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Supported countries:" GridPane.rowIndex="13"/>
|
||||
<TextField fx:id="supportedCountriesTextField" editable="false" GridPane.rowIndex="13" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="supportedCountriesTextField" editable="false" focusTraversable="false" GridPane.rowIndex="13" GridPane.columnIndex="1"/>
|
||||
|
||||
|
||||
<columnConstraints>
|
||||
@ -94,7 +94,7 @@
|
||||
<Label fx:id="infoLabel" GridPane.rowIndex="1" GridPane.columnIndex="1" GridPane.valignment="TOP"/>
|
||||
|
||||
<Label text="Deposit transaction ID:" GridPane.rowIndex="2"/>
|
||||
<TextField fx:id="depositTxIdTextField" editable="false" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="depositTxIdTextField" editable="false" focusTraversable="false" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||
|
||||
<Button fx:id="receivedFiatButton" text="I have received the money at my bank account" onAction="#onReceivedFiat" defaultButton="true" disable="true" GridPane.rowIndex="3"
|
||||
GridPane.columnIndex="1"/>
|
||||
@ -126,21 +126,21 @@
|
||||
<ValidatedTextField fx:id="summaryPaidTextField" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="You have received (EUR):" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="summaryReceivedTextField" editable="false" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="summaryReceivedTextField" editable="false" focusTraversable="false" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Details" GridPane.rowIndex="4" id="form-header-text"/>
|
||||
|
||||
<Label text="Total fees (take offer fee + tx fee):" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="summaryFeesTextField" editable="false" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="summaryFeesTextField" editable="false" focusTraversable="false" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Refunded collateral:" GridPane.rowIndex="6"/>
|
||||
<TextField fx:id="summaryCollateralTextField" editable="false" GridPane.rowIndex="6" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="summaryCollateralTextField" editable="false" focusTraversable="false" GridPane.rowIndex="6" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Deposit transaction ID:" GridPane.rowIndex="7"/>
|
||||
<TextField fx:id="summaryDepositTxIdTextField" editable="false" GridPane.rowIndex="7" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="summaryDepositTxIdTextField" editable="false" focusTraversable="false" GridPane.rowIndex="7" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label text="Payout transaction ID:" GridPane.rowIndex="8"/>
|
||||
<TextField fx:id="summaryPayoutTxIdTextField" editable="false" GridPane.rowIndex="8" GridPane.columnIndex="1"/>
|
||||
<TextField fx:id="summaryPayoutTxIdTextField" editable="false" focusTraversable="false" GridPane.rowIndex="8" GridPane.columnIndex="1"/>
|
||||
|
||||
|
||||
<Button text="Close" onAction="#onClose" defaultButton="true" GridPane.rowIndex="9" GridPane.columnIndex="1"/>
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
<!-- row 1 -->
|
||||
<Label fx:id="txTitleLabel" text="Deposit transaction ID:" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="txTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="txTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<Label fx:id="txIDCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="1">
|
||||
<padding>
|
||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
||||
@ -79,11 +79,11 @@
|
||||
|
||||
<!-- row 3 -->
|
||||
<Label fx:id="bankAccountTypeTitleLabel" text="Bank account type:" GridPane.columnIndex="0" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="bankAccountTypeTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
<TextField fx:id="bankAccountTypeTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
|
||||
<!-- row 4 -->
|
||||
<Label fx:id="holderNameTitleLabel" text="Holder name:" GridPane.columnIndex="0" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="holderNameTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
<TextField fx:id="holderNameTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
||||
<Label fx:id="holderNameCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="4">
|
||||
<padding>
|
||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
||||
@ -95,7 +95,7 @@
|
||||
|
||||
<!-- row 5 -->
|
||||
<Label fx:id="primaryBankAccountIDTitleLabel" text="Primary bank account ID:" GridPane.columnIndex="0" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="primaryBankAccountIDTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
||||
<TextField fx:id="primaryBankAccountIDTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
||||
<Label fx:id="primaryBankAccountIDCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="5">
|
||||
<padding>
|
||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
||||
@ -107,7 +107,7 @@
|
||||
|
||||
<!-- row 6 -->
|
||||
<Label fx:id="secondaryBankAccountIDTitleLabel" text="Secondary bank account ID:" GridPane.columnIndex="0" GridPane.rowIndex="6"/>
|
||||
<TextField fx:id="secondaryBankAccountIDTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||
<TextField fx:id="secondaryBankAccountIDTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||
<Label fx:id="secondaryBankAccountIDCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="6">
|
||||
<padding>
|
||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
||||
|
@ -60,16 +60,19 @@ public class ValidationHelper
|
||||
TextField currentTextField)
|
||||
{
|
||||
amountValidator.overrideResult(null);
|
||||
if (!amountValidator.validate(amount.get()).isValid)
|
||||
String amountCleaned = amount.get() != null ? amount.get().replace(",", ".").trim() : "0";
|
||||
String minAmountCleaned = minAmount.get() != null ? minAmount.get().replace(",", ".").trim() : "0";
|
||||
|
||||
if (!amountValidator.validate(amountCleaned).isValid)
|
||||
return;
|
||||
|
||||
minAmountValidator.overrideResult(null);
|
||||
if (!minAmountValidator.validate(minAmount.get()).isValid)
|
||||
if (!minAmountValidator.validate(minAmountCleaned).isValid)
|
||||
return;
|
||||
|
||||
if (currentTextField == amountTextField)
|
||||
{
|
||||
if (Double.parseDouble(amount.get()) < Double.parseDouble(minAmount.get()))
|
||||
if (Double.parseDouble(amountCleaned) < Double.parseDouble(minAmountCleaned))
|
||||
{
|
||||
amountValidator.overrideResult(new NumberValidator.ValidationResult(false, "Amount cannot be smaller than minimum amount.", NumberValidator.ErrorType.AMOUNT_LESS_THAN_MIN_AMOUNT));
|
||||
amountTextField.reValidate();
|
||||
@ -82,7 +85,7 @@ public class ValidationHelper
|
||||
}
|
||||
else if (currentTextField == minAmountTextField)
|
||||
{
|
||||
if (Double.parseDouble(minAmount.get()) > Double.parseDouble(amount.get()))
|
||||
if (Double.parseDouble(minAmountCleaned) > Double.parseDouble(amountCleaned))
|
||||
{
|
||||
minAmountValidator.overrideResult(new NumberValidator.ValidationResult(false, "Minimum amount cannot be larger than amount.", NumberValidator.ErrorType.MIN_AMOUNT_LARGER_THAN_MIN_AMOUNT));
|
||||
minAmountTextField.reValidate();
|
||||
|
Loading…
Reference in New Issue
Block a user