Add setup screens.

This commit is contained in:
Manfred Karrer 2014-09-07 13:04:31 +02:00
parent c00c4b4400
commit 9732215c59
41 changed files with 1732 additions and 353 deletions

View file

@ -169,6 +169,19 @@ public class MainController extends ViewController {
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Blur effect
///////////////////////////////////////////////////////////////////////////////////////////
public void removeContentScreenBlur() {
Transitions.removeBlur(viewBuilder.baseContentContainer);
}
public void blurContentScreen() {
Transitions.blur(viewBuilder.baseContentContainer);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Startup Handlers // Startup Handlers
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -213,7 +226,7 @@ public class MainController extends ViewController {
private void fadeOutSplash() { private void fadeOutSplash() {
Profiler.printMsgWithTime("MainController.fadeOutSplash"); Profiler.printMsgWithTime("MainController.fadeOutSplash");
Transitions.blurOutAndRemove(viewBuilder.splashVBox); Transitions.blurAndRemove(viewBuilder.splashVBox);
Transitions.fadeIn(viewBuilder.menuBar); Transitions.fadeIn(viewBuilder.menuBar);
Transitions.fadeIn(viewBuilder.contentScreen); Transitions.fadeIn(viewBuilder.contentScreen);
} }

View file

@ -17,16 +17,32 @@
package io.bitsquare.gui.account.fiataccount; package io.bitsquare.gui.account.fiataccount;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.account.setup.SetupCB; import io.bitsquare.gui.account.setup.SetupCB;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.help.Help;
import io.bitsquare.gui.help.HelpId;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.Currency;
import java.util.List;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.inject.Inject; import javax.inject.Inject;
import javafx.collections.ListChangeListener;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*;
import org.controlsfx.control.action.Action;
import org.controlsfx.dialog.Dialog;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -35,6 +51,15 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
private static final Logger log = LoggerFactory.getLogger(FiatAccountCB.class); private static final Logger log = LoggerFactory.getLogger(FiatAccountCB.class);
@FXML private ComboBox<Region> regionComboBox;
@FXML private ComboBox<Country> countryComboBox;
@FXML private TextField titleTextField, holderNameTextField, primaryIDTextField, secondaryIDTextField;
@FXML private Button saveButton, addBankAccountButton, changeBankAccountButton, removeBankAccountButton;
@FXML private ComboBox<BankAccount> selectionComboBox;
@FXML private ComboBox<BankAccountType> typesComboBox;
@FXML private ComboBox<Currency> currencyComboBox;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -53,11 +78,24 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
super.initialize(url, rb); super.initialize(url, rb);
typesComboBox.setItems(presentationModel.getAllTypes());
typesComboBox.setConverter(presentationModel.getTypesConverter());
selectionComboBox.setConverter(presentationModel.getSelectionConverter());
currencyComboBox.setItems(presentationModel.getAllCurrencies());
currencyComboBox.setConverter(presentationModel.getCurrencyConverter());
regionComboBox.setItems(presentationModel.getAllRegions());
regionComboBox.setConverter(presentationModel.getRegionConverter());
countryComboBox.setConverter(presentationModel.getCountryConverter());
} }
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
setupListeners();
setupBindings();
selectionComboBox.setItems(presentationModel.getAllBankAccounts());
} }
@Override @Override
@ -71,24 +109,148 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Public Methods
///////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers // UI handlers
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@FXML @FXML
private void onDone() { public void onSelectAccount() {
presentationModel.setCurrentBankAccount(selectionComboBox.getSelectionModel().getSelectedItem());
}
@FXML
public void onSelectType() {
presentationModel.setType(typesComboBox.getSelectionModel().getSelectedItem());
}
@FXML
public void onSelectCurrency() {
presentationModel.setCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
}
@FXML
private void onSelectRegion() {
countryComboBox.setVisible(true);
Region region = regionComboBox.getSelectionModel().getSelectedItem();
countryComboBox.setItems(presentationModel.getAllCountriesFor(region));
}
@FXML
private void onSelectCountry() {
presentationModel.setCountry(countryComboBox.getSelectionModel().getSelectedItem());
}
@FXML
private void onSave() {
InputValidator.ValidationResult result = presentationModel.saveBankAccount();
if (result.isValid)
((SetupCB) parentController).onCompleted(this); ((SetupCB) parentController).onCompleted(this);
} }
@FXML
private void onAddAccount() {
log.error("onAddAccount");
}
@FXML
private void onRemoveAccount() {
presentationModel.removeBankAccount();
}
@FXML
private void onChangeAccount() {
log.error("onChangeAccount");
}
@FXML
private void onOpenHelp() {
Help.openWindow(HelpId.SETUP_FIAT_ACCOUNT);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private methods // Private methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void setupListeners() {
presentationModel.type.addListener((ov, oldValue, newValue) -> {
if (newValue != null)
typesComboBox.getSelectionModel().select(typesComboBox.getItems().indexOf(newValue));
else
typesComboBox.getSelectionModel().clearSelection();
});
presentationModel.currency.addListener((ov, oldValue, newValue) -> {
if (newValue != null)
currencyComboBox.getSelectionModel().select(currencyComboBox.getItems().indexOf(newValue));
else
currencyComboBox.getSelectionModel().clearSelection();
});
presentationModel.getCurrentBankAccount().addListener((ov, oldValue, newValue) -> {
if (newValue != null)
selectionComboBox.getSelectionModel().select(selectionComboBox.getItems().indexOf(newValue));
else
selectionComboBox.getSelectionModel().clearSelection();
});
presentationModel.country.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
regionComboBox.getSelectionModel().select(regionComboBox.getItems().indexOf(newValue.getRegion()));
countryComboBox.getSelectionModel().select(countryComboBox.getItems().indexOf(newValue));
}
else {
regionComboBox.getSelectionModel().clearSelection();
countryComboBox.getSelectionModel().clearSelection();
}
});
presentationModel.getAllBankAccounts().addListener((ListChangeListener<BankAccount>) change -> {
Object a = presentationModel.getAllBankAccounts();
Object a2 = change.getList();
if (presentationModel.getCurrentBankAccount() != null)
selectionComboBox.getSelectionModel().select(selectionComboBox.getItems()
.indexOf(presentationModel.getCurrentBankAccount()));
else
selectionComboBox.getSelectionModel().clearSelection();
});
presentationModel.countryNotInAcceptedCountriesList.addListener((ov, oldValue, newValue) -> {
if (newValue) {
List<Action> actions = new ArrayList<>();
actions.add(Dialog.Actions.YES);
actions.add(Dialog.Actions.NO);
Action response = Popups.openConfirmPopup("Warning",
"The country of your bank account is not included in the accepted countries in the general " +
"settings.\n\nDo you want to add it automatically?",
null,
actions);
if (response == Dialog.Actions.YES)
presentationModel.addCountryToAcceptedCountriesList();
}
});
}
private void setupBindings() {
// input
titleTextField.textProperty().bindBidirectional(presentationModel.title);
holderNameTextField.textProperty().bindBidirectional(presentationModel.holderName);
primaryIDTextField.textProperty().bindBidirectional(presentationModel.primaryID);
secondaryIDTextField.textProperty().bindBidirectional(presentationModel.secondaryID);
primaryIDTextField.promptTextProperty().bind(presentationModel.primaryIDPrompt);
secondaryIDTextField.promptTextProperty().bind(presentationModel.secondaryIDPrompt);
selectionComboBox.promptTextProperty().bind(presentationModel.selectionPrompt);
selectionComboBox.disableProperty().bind(presentationModel.selectionDisable);
saveButton.disableProperty().bind(presentationModel.saveButtonDisable);
addBankAccountButton.disableProperty().bind(presentationModel.addBankAccountButtonDisable);
changeBankAccountButton.disableProperty().bind(presentationModel.changeBankAccountButtonDisable);
removeBankAccountButton.disableProperty().bind(presentationModel.removeBankAccountButtonDisable);
}
} }

View file

@ -17,49 +17,206 @@
package io.bitsquare.gui.account.fiataccount; package io.bitsquare.gui.account.fiataccount;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.CountryUtil;
import io.bitsquare.locale.CurrencyUtil;
import io.bitsquare.locale.Region;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.settings.Settings;
import io.bitsquare.user.User;
import com.google.inject.Inject; import com.google.inject.Inject;
import java.util.Currency;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class FiatAccountModel extends UIModel { public class FiatAccountModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(FiatAccountModel.class); private static final Logger log = LoggerFactory.getLogger(FiatAccountModel.class);
private User user;
private Settings settings;
private Persistence persistence;
StringProperty title = new SimpleStringProperty();
StringProperty holderName = new SimpleStringProperty();
StringProperty primaryID = new SimpleStringProperty();
StringProperty secondaryID = new SimpleStringProperty();
StringProperty primaryIDPrompt = new SimpleStringProperty();
StringProperty secondaryIDPrompt = new SimpleStringProperty();
BooleanProperty countryNotInAcceptedCountriesList = new SimpleBooleanProperty();
ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>();
ObjectProperty<Country> country = new SimpleObjectProperty<>();
ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
ObjectProperty<BankAccount> currentBankAccount = new SimpleObjectProperty<>();
ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType
.getAllBankAccountTypes());
ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList();
ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencies());
ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions());
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
public FiatAccountModel() { public FiatAccountModel(User user, Persistence persistence, Settings settings) {
this.persistence = persistence;
this.user = user;
this.settings = settings;
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void initialized() {
super.initialized();
}
@Override
public void activate() {
super.activate();
currentBankAccount.set(user.getCurrentBankAccount());
allBankAccounts.setAll(user.getBankAccounts());
}
@Override
public void deactivate() {
super.deactivate();
}
@Override
public void terminate() {
super.terminate();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Interface implementation: Initializable // Package scope
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void saveBankAccount() {
BankAccount bankAccount = new BankAccount(type.get(),
currency.get(),
country.get(),
title.get(),
holderName.get(),
primaryID.get(),
secondaryID.get());
user.addBankAccount(bankAccount);
saveUser();
countryNotInAcceptedCountriesList.set(!settings.getAcceptedCountries().contains(country.get()));
}
void removeBankAccount() {
user.removeCurrentBankAccount();
saveUser();
}
// We ask the user if he likes to add his own bank account country to the accepted country list if he has not
// already added it before
void addCountryToAcceptedCountriesList() {
settings.addAcceptedCountry(country.get());
saveSettings();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion));
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Setters // Setters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void setCurrentBankAccount(BankAccount bankAccount) {
currentBankAccount.set(bankAccount);
user.setCurrentBankAccount(bankAccount);
persistence.write(user);
if (bankAccount != null) {
title.set(bankAccount.getAccountTitle());
holderName.set(bankAccount.getAccountHolderName());
primaryID.set(bankAccount.getAccountPrimaryID());
secondaryID.set(bankAccount.getAccountSecondaryID());
primaryIDPrompt.set(bankAccount.getBankAccountType().getPrimaryId());
secondaryIDPrompt.set(bankAccount.getBankAccountType().getSecondaryId());
type.set(bankAccount.getBankAccountType());
country.set(bankAccount.getCountry());
currency.set(bankAccount.getCurrency());
}
else {
title.set(null);
holderName.set(null);
primaryID.set(null);
secondaryID.set(null);
primaryIDPrompt.set(null);
secondaryIDPrompt.set(null);
type.set(null);
country.set(null);
currency.set(null);
}
}
void setType(BankAccountType type) {
this.type.set(type);
if (type != null) {
primaryIDPrompt.set(type.getPrimaryId());
secondaryIDPrompt.set(type.getSecondaryId());
}
else {
primaryIDPrompt.set(null);
secondaryIDPrompt.set(null);
}
}
void setCountry(Country country) {
this.country.set(country);
}
void setCurrency(Currency currency) {
this.currency.set(currency);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private methods // Private methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void saveUser() {
persistence.write(user);
}
private void saveSettings() {
persistence.write(settings);
}
} }

View file

@ -17,16 +17,56 @@
package io.bitsquare.gui.account.fiataccount; package io.bitsquare.gui.account.fiataccount;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.util.validation.BankAccountValidator;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.BSResources;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region;
import com.google.inject.Inject; import com.google.inject.Inject;
import java.util.Currency;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.util.StringConverter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class FiatAccountPm extends PresentationModel<FiatAccountModel> { public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
private static final Logger log = LoggerFactory.getLogger(FiatAccountPm.class); private static final Logger log = LoggerFactory.getLogger(FiatAccountPm.class);
private BankAccountValidator bankAccountValidator = new BankAccountValidator();
StringProperty title = new SimpleStringProperty();
StringProperty holderName = new SimpleStringProperty();
StringProperty primaryID = new SimpleStringProperty();
StringProperty secondaryID = new SimpleStringProperty();
StringProperty primaryIDPrompt = new SimpleStringProperty();
StringProperty secondaryIDPrompt = new SimpleStringProperty();
StringProperty selectionPrompt = new SimpleStringProperty();
BooleanProperty selectionDisable = new SimpleBooleanProperty();
BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true);
BooleanProperty addBankAccountButtonDisable = new SimpleBooleanProperty(true);
BooleanProperty changeBankAccountButtonDisable = new SimpleBooleanProperty(true);
BooleanProperty removeBankAccountButtonDisable = new SimpleBooleanProperty(true);
BooleanProperty countryNotInAcceptedCountriesList = new SimpleBooleanProperty();
ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>();
ObjectProperty<Country> country = new SimpleObjectProperty<>();
ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -38,28 +78,268 @@ public class FiatAccountPm extends PresentationModel<FiatAccountModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Public methods // Lifecycle
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void initialized() {
super.initialized();
// input
title.bindBidirectional(model.title);
holderName.bindBidirectional(model.holderName);
primaryID.bindBidirectional(model.primaryID);
secondaryID.bindBidirectional(model.secondaryID);
type.bindBidirectional(model.type);
country.bindBidirectional(model.country);
currency.bindBidirectional(model.currency);
primaryIDPrompt.bind(model.primaryIDPrompt);
secondaryIDPrompt.bind(model.secondaryIDPrompt);
countryNotInAcceptedCountriesList.bind(model.countryNotInAcceptedCountriesList);
selectionPrompt.set("No bank account available");
selectionDisable.set(true);
model.title.addListener((ov, oldValue, newValue) -> {
validateInput();
/*
InputValidator.ValidationResult result = validateInput();
if (result.isValid) {
result = bankAccountValidator.validate(newValue);
saveButtonDisable.set(!result.isValid);
}*/
});
holderName.addListener((ov, oldValue, newValue) -> validateInput());
primaryID.addListener((ov, oldValue, newValue) -> validateInput());
secondaryID.addListener((ov, oldValue, newValue) -> validateInput());
}
@Override
public void activate() {
super.activate();
model.allBankAccounts.addListener((ListChangeListener<BankAccount>) change -> {
if (model.allBankAccounts.isEmpty()) {
selectionPrompt.set("No bank account available");
selectionDisable.set(true);
}
else {
selectionPrompt.set("Select bank account");
selectionDisable.set(false);
}
});
}
@Override
public void deactivate() {
super.deactivate();
}
@Override
public void terminate() {
super.terminate();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Interface implementation: Initializable // Package scope
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
InputValidator.ValidationResult saveBankAccount() {
InputValidator.ValidationResult result = validateInput();
if (result.isValid) {
model.saveBankAccount();
addBankAccountButtonDisable.set(false);
changeBankAccountButtonDisable.set(false);
removeBankAccountButtonDisable.set(false);
}
return result;
}
void removeBankAccount() {
model.removeBankAccount();
}
void updateDoneButtonDisabled() {
/* boolean isValid = model.languageList != null && model.languageList.size() > 0 &&
model.countryList != null && model.countryList.size() > 0 &&
model.arbitratorList != null && model.arbitratorList.size() > -1;
doneButtonDisabled.set(!isValid);*/
}
void addCountryToAcceptedCountriesList() {
model.addCountryToAcceptedCountriesList();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Converters
///////////////////////////////////////////////////////////////////////////////////////////
StringConverter<BankAccountType> getTypesConverter() {
return new StringConverter<BankAccountType>() {
@Override
public String toString(BankAccountType TypeInfo) {
return BSResources.get(TypeInfo.toString());
}
@Override
public BankAccountType fromString(String s) {
return null;
}
};
}
StringConverter<BankAccount> getSelectionConverter() {
return new StringConverter<BankAccount>() {
@Override
public String toString(BankAccount bankAccount) {
return bankAccount.getAccountTitle();
}
@Override
public BankAccount fromString(String s) {
return null;
}
};
}
StringConverter<Currency> getCurrencyConverter() {
return new StringConverter<Currency>() {
@Override
public String toString(Currency currency) {
return currency.getCurrencyCode() + " (" + currency.getDisplayName() + ")";
}
@Override
public Currency fromString(String s) {
return null;
}
};
}
StringConverter<Region> getRegionConverter() {
return new StringConverter<io.bitsquare.locale.Region>() {
@Override
public String toString(io.bitsquare.locale.Region region) {
return region.getName();
}
@Override
public io.bitsquare.locale.Region fromString(String s) {
return null;
}
};
}
StringConverter<Country> getCountryConverter() {
return new StringConverter<Country>() {
@Override
public String toString(Country country) {
return country.getName();
}
@Override
public Country fromString(String s) {
return null;
}
};
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
ObservableList<BankAccountType> getAllTypes() {
return model.allTypes;
}
ObjectProperty<BankAccount> getCurrentBankAccount() {
return model.currentBankAccount;
}
ObservableList<BankAccount> getAllBankAccounts() {
return model.allBankAccounts;
}
ObservableList<Currency> getAllCurrencies() {
return model.allCurrencies;
}
ObservableList<Region> getAllRegions() {
return model.allRegions;
}
ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return model.getAllCountriesFor(selectedRegion);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Setters // Setters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void setCurrentBankAccount(BankAccount bankAccount) {
model.setCurrentBankAccount(bankAccount);
validateInput();
}
void setType(BankAccountType type) {
model.setType(type);
validateInput();
}
void setCountry(Country country) {
model.setCountry(country);
validateInput();
}
void setCurrency(Currency currency) {
model.setCurrency(currency);
validateInput();
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private methods // Private methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private InputValidator.ValidationResult validateInput() {
InputValidator.ValidationResult result = bankAccountValidator.validate(model.title.get());
if (result.isValid) {
result = bankAccountValidator.validate(model.holderName.get());
if (result.isValid) {
result = bankAccountValidator.validate(model.primaryID.get());
if (result.isValid) {
result = bankAccountValidator.validate(model.secondaryID.get());
if (result.isValid) {
if (model.currency.get() == null)
result = new InputValidator.ValidationResult(false,
"You have not selected a currency");
if (result.isValid) {
if (model.country.get() == null)
result = new InputValidator.ValidationResult(false,
"You have not selected a country of the payments account");
if (result.isValid) {
if (model.type.get() == null)
result = new InputValidator.ValidationResult(false,
"You have not selected a payments method");
}
}
}
}
}
}
saveButtonDisable.set(!result.isValid);
return result;
}
} }

View file

@ -18,22 +18,25 @@
--> -->
<?import io.bitsquare.gui.components.InfoDisplay?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.fiataccount.FiatAccountCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.fiataccount.FiatAccountCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<children> <children>
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="4"> <!--
Setup
-->
<Pane id="form-group-background-active" GridPane.rowIndex="0" GridPane.columnSpan="2" GridPane.rowSpan="8">
<GridPane.margin> <GridPane.margin>
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/> <Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
</GridPane.margin> </GridPane.margin>
<children> <children>
<Label id="form-group-title-active" text="Setup password" layoutX="8" layoutY="-8"> <Label id="form-group-title-active" text="Setup your payments account" layoutX="8" layoutY="-8">
<padding> <padding>
<Insets left="5" right="7"/> <Insets left="5" right="7"/>
</padding> </padding>
@ -41,38 +44,121 @@
</children> </children>
</Pane> </Pane>
<Label text="Payments method:" GridPane.rowIndex="0">
<Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2"
defaultButton="true">
<GridPane.margin> <GridPane.margin>
<Insets bottom="10"/> <Insets top="10"/>
</GridPane.margin>
</Label>
<ComboBox fx:id="typesComboBox" promptText="Select payments method" onAction="#onSelectType"
GridPane.rowIndex="0" GridPane.columnIndex="1">
<GridPane.margin>
<Insets top="10"/>
</GridPane.margin>
</ComboBox>
<Label text="Title:" GridPane.rowIndex="1"/>
<TextField fx:id="titleTextField" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="Holder name:" GridPane.rowIndex="2"/>
<TextField fx:id="holderNameTextField" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label text="Primary ID:" GridPane.rowIndex="3"/>
<TextField fx:id="primaryIDTextField" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label text="Secondary ID:" GridPane.rowIndex="4"/>
<TextField fx:id="secondaryIDTextField" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label text="Currency:" GridPane.rowIndex="5"/>
<ComboBox fx:id="currencyComboBox" promptText="Select currency"
onAction="#onSelectCurrency" GridPane.columnIndex="1"
GridPane.rowIndex="5"/>
<Label text="Country of payments account:" GridPane.rowIndex="6"/>
<HBox GridPane.columnIndex="1" GridPane.rowIndex="6" spacing="10">
<children>
<ComboBox fx:id="regionComboBox" promptText="Select region"
onAction="#onSelectRegion" prefWidth="150.0"/>
<ComboBox fx:id="countryComboBox" promptText="Select country" onAction="#onSelectCountry"
visible="false" prefWidth="150.0"/>
</children>
</HBox>
<InfoDisplay gridPane="$root" onAction="#onOpenHelp" rowIndex="7"
text="The payments account data will be saved in a encrypted form to the Bitcoin block chain and will be used in the trade process for account verification."/>
<Button fx:id="saveButton" text="Save bank account" onAction="#onSave" GridPane.columnIndex="1"
GridPane.rowIndex="8" defaultButton="true" disable="true">
<GridPane.margin>
<Insets top="15.0" bottom="5.0"/>
</GridPane.margin> </GridPane.margin>
</Button> </Button>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
GridPane.rowIndex="3" GridPane.valignment="TOP">
<image>
<Image url="@/images/info_44.png"/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<Label GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="340.0" wrapText="true" <!--
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."> Manage
-->
<Pane id="form-group-background-active" GridPane.columnSpan="2" GridPane.rowIndex="9" GridPane.rowSpan="4">
<GridPane.margin>
<Insets bottom="-10" left="-10" right="-10" top="20"/>
</GridPane.margin>
<children>
<Label id="form-group-title-active" text="Manage payments accounts" layoutX="8" layoutY="-8">
<padding>
<Insets left="5" right="7"/>
</padding>
</Label> </Label>
</children> </children>
<padding>
<Insets top="40.0"/>
</padding>
</Pane>
<Label text="Add new account:" GridPane.rowIndex="9">
<GridPane.margin>
<Insets top="40"/>
</GridPane.margin>
</Label>
<Button fx:id="addBankAccountButton" text="Add payments account" onAction="#onAddAccount"
GridPane.columnIndex="1" GridPane.rowIndex="9" disable="true">
<GridPane.margin>
<Insets top="40"/>
</GridPane.margin>
</Button>
<Label text="Select payments account:" GridPane.rowIndex="10"/>
<ComboBox fx:id="selectionComboBox" onAction="#onSelectAccount" GridPane.rowIndex="10"
GridPane.columnIndex="1"/>
<Label text="Change selected account:" GridPane.rowIndex="11"/>
<Button fx:id="changeBankAccountButton" text="Change selected payments account" onAction="#onChangeAccount"
GridPane.columnIndex="1"
GridPane.rowIndex="11" disable="true"/>
<Label text="Remove selected account:" GridPane.rowIndex="12"/>
<Button fx:id="removeBankAccountButton" text="Remove selected payments account" onAction="#onRemoveAccount"
GridPane.columnIndex="1"
GridPane.rowIndex="12" disable="true"/>
</children>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" prefWidth="200.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="200.0"/>
<ColumnConstraints hgrow="ALWAYS" prefWidth="410"/> <ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints/> <RowConstraints vgrow="NEVER"/>
<RowConstraints/> <RowConstraints vgrow="NEVER"/>
<RowConstraints/> <RowConstraints vgrow="NEVER"/>
<RowConstraints/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/>
</rowConstraints> </rowConstraints>
</GridPane> </GridPane>

View file

@ -17,18 +17,17 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. ~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
--> -->
<?import io.bitsquare.gui.components.InfoDisplay?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.password.PasswordCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.password.PasswordCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<children> <children>
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="4"> <Pane id="form-group-background-active" GridPane.columnSpan="2" GridPane.rowSpan="4">
<GridPane.margin> <GridPane.margin>
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/> <Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
</GridPane.margin> </GridPane.margin>
@ -65,28 +64,15 @@
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" <InfoDisplay gridPane="$root" onAction="#onOpenHelp" rowIndex="3"
GridPane.rowIndex="3" GridPane.valignment="TOP">
<image>
<Image url="@/images/info_44.png"/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="410.0">
<Label prefWidth="410.0" wrapText="true"
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/> text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenHelp"/>
</TextFlow>
</children> </children>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" prefWidth="140.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" prefWidth="470"/> <ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>

View file

@ -17,58 +17,19 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. ~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
--> -->
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.registration.RegistrationCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.registration.RegistrationCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<children> <children>
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="4">
<GridPane.margin>
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
</GridPane.margin>
<children>
<Label id="form-group-title-active" text="Setup password" layoutX="8" layoutY="-8">
<padding>
<Insets left="5" right="7"/>
</padding>
</Label>
</children>
</Pane>
<Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2"
defaultButton="true">
<GridPane.margin>
<Insets bottom="10"/>
</GridPane.margin>
</Button>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
GridPane.rowIndex="3" GridPane.valignment="TOP">
<image>
<Image url="@/images/info_44.png"/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="410.0">
<Label prefWidth="410.0" wrapText="true"
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoins from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenHelp"/>
</TextFlow>
</children> </children>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" prefWidth="200.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" prefWidth="410"/> <ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>

View file

@ -40,7 +40,6 @@ import javax.inject.Inject;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.geometry.Pos;
import javafx.scene.*; import javafx.scene.*;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.image.*; import javafx.scene.image.*;
@ -221,19 +220,14 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
@Override @Override
public ListCell<Locale> call(ListView<Locale> list) { public ListCell<Locale> call(ListView<Locale> list) {
return new ListCell<Locale>() { return new ListCell<Locale>() {
final HBox hBox = new HBox();
final Label label = new Label(); final Label label = new Label();
final Button removeButton = new Button();
final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE); final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{ {
label.setPrefWidth(395);
icon.setMouseTransparent(true);
removeButton.setGraphic(icon);
removeButton.setId("icon-button"); removeButton.setId("icon-button");
hBox.setSpacing(3); AnchorPane.setRightAnchor(removeButton, 0d);
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(label, removeButton);
} }
@Override @Override
@ -242,7 +236,7 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
if (item != null && !empty) { if (item != null && !empty) {
label.setText(item.getDisplayName()); label.setText(item.getDisplayName());
removeButton.setOnAction(actionEvent -> removeLanguage(item)); removeButton.setOnAction(actionEvent -> removeLanguage(item));
setGraphic(hBox); setGraphic(pane);
} }
else { else {
setGraphic(null); setGraphic(null);
@ -284,19 +278,14 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
@Override @Override
public ListCell<Country> call(ListView<Country> list) { public ListCell<Country> call(ListView<Country> list) {
return new ListCell<Country>() { return new ListCell<Country>() {
final HBox hBox = new HBox();
final Label label = new Label(); final Label label = new Label();
final Button removeButton = new Button();
final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE); final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{ {
label.setPrefWidth(395);
icon.setMouseTransparent(true);
removeButton.setGraphic(icon);
removeButton.setId("icon-button"); removeButton.setId("icon-button");
hBox.setSpacing(3); AnchorPane.setRightAnchor(removeButton, 0d);
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(label, removeButton);
} }
@Override @Override
@ -305,7 +294,7 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
if (item != null && !empty) { if (item != null && !empty) {
label.setText(item.getName()); label.setText(item.getName());
removeButton.setOnAction(actionEvent -> removeCountry(item)); removeButton.setOnAction(actionEvent -> removeCountry(item));
setGraphic(hBox); setGraphic(pane);
} }
else { else {
setGraphic(null); setGraphic(null);
@ -333,28 +322,24 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
@Override @Override
public ListCell<Arbitrator> call(ListView<Arbitrator> list) { public ListCell<Arbitrator> call(ListView<Arbitrator> list) {
return new ListCell<Arbitrator>() { return new ListCell<Arbitrator>() {
final HBox hBox = new HBox();
final Label label = new Label(); final Label label = new Label();
final Button removeButton = new Button();
final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE); final ImageView icon = ImageUtil.getIconImageView(ImageUtil.REMOVE);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{ {
label.setPrefWidth(395);
icon.setMouseTransparent(true);
removeButton.setGraphic(icon);
removeButton.setId("icon-button"); removeButton.setId("icon-button");
hBox.setSpacing(3); AnchorPane.setRightAnchor(removeButton, 0d);
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(label, removeButton);
} }
@Override @Override
public void updateItem(final Arbitrator item, boolean empty) { public void updateItem(final Arbitrator item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
label.setText(item.getName()); label.setText(item.getName());
removeButton.setOnAction(actionEvent -> removeArbitrator(item)); removeButton.setOnAction(actionEvent -> removeArbitrator(item));
setGraphic(hBox); setGraphic(pane);
} }
else { else {
setGraphic(null); setGraphic(null);

View file

@ -53,9 +53,9 @@ public class RestrictionsModel extends UIModel {
private final Persistence persistence; private final Persistence persistence;
private final MessageFacade messageFacade; private final MessageFacade messageFacade;
ObservableList<Locale> languageList; ObservableList<Locale> languageList = FXCollections.observableArrayList();
ObservableList<Country> countryList; ObservableList<Country> countryList = FXCollections.observableArrayList();
ObservableList<Arbitrator> arbitratorList; ObservableList<Arbitrator> arbitratorList = FXCollections.observableArrayList();
ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil.getAllLanguageLocales()); ObservableList<Locale> allLanguages = FXCollections.observableArrayList(LanguageUtil.getAllLanguageLocales());
ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions()); ObservableList<Region> allRegions = FXCollections.observableArrayList(CountryUtil.getAllRegions());

View file

@ -0,0 +1,152 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.account.restrictions;
import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.gui.PresentationModel;
import io.bitsquare.locale.Country;
import io.bitsquare.locale.Region;
import com.google.inject.Inject;
import java.util.Locale;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RestrictionsPM extends PresentationModel<RestrictionsModel> {
private static final Logger log = LoggerFactory.getLogger(RestrictionsPM.class);
public BooleanProperty doneButtonDisabled = new SimpleBooleanProperty(true);
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public RestrictionsPM(RestrictionsModel model) {
super(model);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public void initialized() {
super.initialized();
}
@Override
public void activate() {
super.activate();
updateDoneButtonDisabled();
}
@Override
public void deactivate() {
super.deactivate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Package scope
///////////////////////////////////////////////////////////////////////////////////////////
void onAddLanguage(Locale locale) {
model.addLanguage(locale);
updateDoneButtonDisabled();
}
ObservableList<Locale> getLanguageList() {
updateDoneButtonDisabled();
return model.languageList;
}
ObservableList<Locale> getAllLanguages() {
updateDoneButtonDisabled();
return model.allLanguages;
}
void removeLanguage(Locale locale) {
model.removeLanguage(locale);
updateDoneButtonDisabled();
}
void onAddCountry(Country country) {
model.addCountry(country);
updateDoneButtonDisabled();
}
ObservableList<Country> getListWithAllEuroCountries() {
ObservableList<Country> result = model.getListWithAllEuroCountries();
updateDoneButtonDisabled();
return result;
}
ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
return model.getAllCountriesFor(selectedRegion);
}
ObservableList<Region> getAllRegions() {
return model.allRegions;
}
ObservableList<Country> getCountryList() {
updateDoneButtonDisabled();
return model.countryList;
}
void removeCountry(Country country) {
model.removeCountry(country);
updateDoneButtonDisabled();
}
ObservableList<Arbitrator> getArbitratorList() {
updateDoneButtonDisabled();
return model.arbitratorList;
}
void removeArbitrator(Arbitrator arbitrator) {
model.removeArbitrator(arbitrator);
updateDoneButtonDisabled();
}
void updateArbitratorList() {
model.updateArbitratorList();
updateDoneButtonDisabled();
}
//TODO Revert -1 to 0(2 later). For mock testing disabled arbitratorList test
void updateDoneButtonDisabled() {
boolean isValid = model.languageList != null && model.languageList.size() > 0 &&
model.countryList != null && model.countryList.size() > 0 &&
model.arbitratorList != null && model.arbitratorList.size() > -1;
doneButtonDisabled.set(!isValid);
}
}

View file

@ -16,21 +16,20 @@
~ You should have received a copy of the GNU Affero General Public License ~ You should have received a copy of the GNU Affero General Public License
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. ~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
--> -->
<?import io.bitsquare.gui.components.InfoDisplay?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.restrictions.RestrictionsCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.restrictions.RestrictionsCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<children> <children>
<!-- <!--
languages languages
--> -->
<Pane id="form-group-background-active" GridPane.columnSpan="3" GridPane.rowSpan="3"> <Pane id="form-group-background-active" GridPane.columnSpan="2" GridPane.rowSpan="3">
<GridPane.margin> <GridPane.margin>
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/> <Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
</GridPane.margin> </GridPane.margin>
@ -48,28 +47,14 @@
<Insets top="10"/> <Insets top="10"/>
</padding> </padding>
</Label> </Label>
<ListView fx:id="languagesListView" GridPane.columnIndex="1" GridPane.rowIndex="0" prefHeight="120.0"/> <ListView fx:id="languagesListView" GridPane.columnIndex="1" GridPane.rowIndex="0" prefHeight="80.0"/>
<ComboBox fx:id="languageComboBox" onAction="#onAddLanguage" promptText="Add language" <ComboBox fx:id="languageComboBox" onAction="#onAddLanguage" promptText="Add language"
GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.columnIndex="1" GridPane.rowIndex="1"
prefWidth="150.0"/> prefWidth="150.0"/>
<ImageView GridPane.rowIndex="2" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
preserveRatio="true"> <InfoDisplay gridPane="$root" onAction="#onOpenLanguagesHelp" rowIndex="2"
<image> text="Trade with users who have at least 1 shared language."/>
<Image fx:id="infoIcon" url="@/images/info_44.png"/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="2" prefWidth="410.0">
<Label prefWidth="410.0" wrapText="true"
text="Add languages you can support in case of arbitration."/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenLanguagesHelp"/>
<GridPane.margin>
<Insets top="10" bottom="5.0"/>
</GridPane.margin>
</TextFlow>
<!-- <!--
countries countries
@ -94,12 +79,13 @@
<Insets top="50"/> <Insets top="50"/>
</GridPane.margin> </GridPane.margin>
</Label> </Label>
<ListView fx:id="countriesListView" GridPane.columnIndex="1" GridPane.rowIndex="3" prefHeight="120.0" <ListView fx:id="countriesListView" GridPane.columnIndex="1" GridPane.rowIndex="3" prefHeight="80.0"
> >
<GridPane.margin> <GridPane.margin>
<Insets top="40"/> <Insets top="40"/>
</GridPane.margin> </GridPane.margin>
</ListView> </ListView>
<HBox GridPane.columnIndex="1" GridPane.rowIndex="4" spacing="10"> <HBox GridPane.columnIndex="1" GridPane.rowIndex="4" spacing="10">
<children> <children>
<ComboBox fx:id="regionComboBox" onAction="#onSelectRegion" promptText="Select region" <ComboBox fx:id="regionComboBox" onAction="#onSelectRegion" promptText="Select region"
@ -110,23 +96,11 @@
prefWidth="150.0" visible="false"/> prefWidth="150.0" visible="false"/>
</children> </children>
</HBox> </HBox>
<ImageView GridPane.rowIndex="5" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
preserveRatio="true">
<image> <InfoDisplay gridPane="$root" onAction="#onOpenCountriesHelp" rowIndex="5"
<fx:reference source="infoIcon"/> text="Restrict trades with these payments account countries."/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="5" prefWidth="410.0">
<Label prefWidth="410.0" wrapText="true"
text="Add payments account countries you accept for trades."/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenCountriesHelp"/>
<GridPane.margin>
<Insets top="10" bottom="5.0"/>
</GridPane.margin>
</TextFlow>
<!-- <!--
arbitrators arbitrators
@ -151,30 +125,18 @@
<Insets top="50"/> <Insets top="50"/>
</GridPane.margin> </GridPane.margin>
</Label> </Label>
<ListView fx:id="arbitratorsListView" GridPane.columnIndex="1" GridPane.rowIndex="6" prefHeight="120.0"> <ListView fx:id="arbitratorsListView" GridPane.columnIndex="1" GridPane.rowIndex="6" prefHeight="80.0">
<GridPane.margin> <GridPane.margin>
<Insets top="40"/> <Insets top="40"/>
</GridPane.margin> </GridPane.margin>
</ListView> </ListView>
<Button text="Add arbitrator" onAction="#onOpenArbitratorScreen" GridPane.columnIndex="1" <Button text="Add arbitrator" onAction="#onOpenArbitratorScreen" GridPane.columnIndex="1"
GridPane.rowIndex="7"/> GridPane.rowIndex="7"/>
<ImageView GridPane.rowIndex="8" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
preserveRatio="true">
<image> <InfoDisplay gridPane="$root" onAction="#onOpenArbitratorsHelp" rowIndex="8"
<fx:reference source="infoIcon"/> text="You need to choose at least 3 arbitrators."/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="8" prefWidth="410.0">
<Label prefWidth="410.0" wrapText="true"
text="Select your arbitrators. You need to choose at least 3 arbitrators. The more you choose the more trading possibilities you gain."/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenArbitratorsHelp"/>
<GridPane.margin>
<Insets top="10" bottom="5.0"/>
</GridPane.margin>
</TextFlow>
<Button fx:id="doneButton" text="Completed" onAction="#onDone" disable="true" GridPane.columnIndex="1" <Button fx:id="doneButton" text="Completed" onAction="#onDone" disable="true" GridPane.columnIndex="1"
GridPane.rowIndex="9" GridPane.rowIndex="9"
defaultButton="true"> defaultButton="true">
@ -185,21 +147,21 @@
</children> </children>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" prefWidth="140.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" prefWidth="470"/> <ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints vgrow="SOMETIMES"/> <RowConstraints vgrow="SOMETIMES"/>
<RowConstraints vgrow="NEVER" minHeight="30.0"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="SOMETIMES"/> <RowConstraints vgrow="SOMETIMES"/>
<RowConstraints vgrow="NEVER" minHeight="30.0"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="SOMETIMES"/> <RowConstraints vgrow="SOMETIMES"/>
<RowConstraints vgrow="NEVER" minHeight="30.0"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>
<RowConstraints vgrow="NEVER"/> <RowConstraints vgrow="NEVER"/>

View file

@ -17,15 +17,17 @@
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. ~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
--> -->
<?import io.bitsquare.gui.components.InfoDisplay?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?> <?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.seedwords.SeedWordsCB" hgap="5.0" vgap="5.0" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.account.seedwords.SeedWordsCB" hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<children> <children>
<Pane id="form-group-background-active" fx:id="payFundsPane" GridPane.columnSpan="3" GridPane.rowSpan="4"> <Pane id="form-group-background-active" fx:id="payFundsPane" GridPane.columnSpan="2" GridPane.rowSpan="4">
<GridPane.margin> <GridPane.margin>
<Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/> <Insets bottom="-10.0" left="-10.0" right="-10.0" top="-10.0"/>
</GridPane.margin> </GridPane.margin>
@ -45,40 +47,25 @@
</GridPane.margin> </GridPane.margin>
</Label> </Label>
<TextArea fx:id="seedWordsTextArea" GridPane.columnIndex="1" GridPane.rowIndex="1" wrapText="true" <TextArea fx:id="seedWordsTextArea" GridPane.columnIndex="1" GridPane.rowIndex="1" wrapText="true"
prefHeight="50"> prefHeight="80">
<font> <font>
<Font size="16.0"/> <Font size="16.0"/>
</font> </font>
</TextArea> </TextArea>
<Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2" <Button text="I have made my backup" onAction="#onDone" GridPane.columnIndex="1" GridPane.rowIndex="2"
defaultButton="true"> defaultButton="true">
<GridPane.margin> <GridPane.margin>
<Insets bottom="5"/> <Insets bottom="5"/>
</GridPane.margin> </GridPane.margin>
</Button> </Button>
<InfoDisplay gridPane="$root" onAction="#onOpenHelp" rowIndex="3"
<ImageView GridPane.rowIndex="3" GridPane.valignment="TOP" fitHeight="24.0" fitWidth="24.0"
pickOnBounds="true" preserveRatio="true">
<image>
<Image fx:id="infoIcon" url="@/images/info_44.png"/>
</image>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="3" prefWidth="410.0">
<Label prefWidth="410.0" wrapText="true"
text="You can recreate your wallet our of these words when you lose your wallet. Backup it on paper to have better protection against online theft. Open the help menu for more information."/> text="You can recreate your wallet our of these words when you lose your wallet. Backup it on paper to have better protection against online theft. Open the help menu for more information."/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenHelp"/>
</TextFlow>
</children> </children>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" prefWidth="140.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>
<ColumnConstraints hgrow="ALWAYS" prefWidth="470"/> <ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>

View file

@ -76,10 +76,10 @@ public class SetupCB extends CachedCodeBehind<SetupPM> {
password = new WizardItem(this, content, "Setup password", "Protect your wallet with a password", password = new WizardItem(this, content, "Setup password", "Protect your wallet with a password",
NavigationItem.PASSWORD); NavigationItem.PASSWORD);
restrictions = new WizardItem(this, content, "Setup your preferences", restrictions = new WizardItem(this, content, "Setup your preferences",
"You need to setup your preferences used for trade restrictions", "Define your preferences with whom you want to trade",
NavigationItem.RESTRICTIONS); NavigationItem.RESTRICTIONS);
fiatAccount = new WizardItem(this, content, " Setup Bank account", fiatAccount = new WizardItem(this, content, " Setup Payments account(s)",
"You need to add the bank account details to your trading account", "You need to add a payments account to your trading account",
NavigationItem.FIAT_ACCOUNT); NavigationItem.FIAT_ACCOUNT);
registration = new WizardItem(this, root, "Register your account", registration = new WizardItem(this, root, "Register your account",
"Pay in the registration fee of 0.0002 BTC and store your account in the BTC block chain", "Pay in the registration fee of 0.0002 BTC and store your account in the BTC block chain",

View file

@ -25,7 +25,7 @@
<VBox fx:id="leftVBox" spacing="5" prefWidth="300" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="20" <VBox fx:id="leftVBox" spacing="5" prefWidth="300" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="20"
AnchorPane.topAnchor="20"/> AnchorPane.topAnchor="20"/>
<AnchorPane fx:id="content" AnchorPane.bottomAnchor="10" AnchorPane.leftAnchor="350" <AnchorPane fx:id="content" AnchorPane.bottomAnchor="10" AnchorPane.rightAnchor="30" AnchorPane.leftAnchor="350"
AnchorPane.topAnchor="30" prefWidth="620"/> AnchorPane.topAnchor="30" prefWidth="620"/>
</AnchorPane> </AnchorPane>

View file

@ -17,6 +17,10 @@ tab pane upper bg gradient color mid dark grey to bright grey: cfcfcf -> dddddd
-fx-background-color: linear-gradient(to bottom, #cfcfcf, #dddddd); -fx-background-color: linear-gradient(to bottom, #cfcfcf, #dddddd);
} }
#info-icon-label {
-fx-font-size:16;
-fx-text-fill: #333000;
}
/* Create offer */ /* Create offer */
#direction-icon-label { #direction-icon-label {
@ -45,10 +49,6 @@ tab pane upper bg gradient color mid dark grey to bright grey: cfcfcf -> dddddd
-fx-border-insets: 0 0 0 -2; -fx-border-insets: 0 0 0 -2;
} }
#info-link {
-fx-padding: 0 0 0 -2;
}
#totals-separator { #totals-separator {
-fx-background: #aaa; -fx-background: #aaa;
} }

View file

@ -0,0 +1,192 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.components;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.locale.BSResources;
import javafx.application.Platform;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Convenience Component for info icon, info text and link display in a GridPane.
* Only the properties needed are supported.
* We need to extend from Parent so we can use it in FXML, but the InfoDisplay is not used as node,
* but add the children nodes to the gridPane.
*/
public class InfoDisplay extends Parent {
private static final Logger log = LoggerFactory.getLogger(InfoDisplay.class);
private final StringProperty text = new SimpleStringProperty();
private final IntegerProperty rowIndex = new SimpleIntegerProperty(0);
private final IntegerProperty columnIndex = new SimpleIntegerProperty(0);
private final ObjectProperty<EventHandler<ActionEvent>> onAction = new SimpleObjectProperty<>();
private final ObjectProperty<GridPane> gridPane = new SimpleObjectProperty<>();
private final ImageView icon;
private final VBox vBox;
private final Label label;
private final Hyperlink link;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public InfoDisplay() {
icon = ImageUtil.getIconImageView(ImageUtil.INFO);
icon.setPickOnBounds(true);
icon.setPreserveRatio(true);
GridPane.setValignment(icon, VPos.TOP);
GridPane.setMargin(icon, new Insets(4, 2, 0, 0));
GridPane.setRowSpan(icon, 2);
label = new Label();
label.textProperty().bindBidirectional(text);
label.setWrapText(true);
link = new Hyperlink(BSResources.get("shared.readMore"));
link.setPadding(new Insets(0, 0, 0, -2));
vBox = new VBox();
vBox.setSpacing(0);
vBox.getChildren().addAll(label, link);
visibleProperty().addListener((ov, oldValue, newValue) -> {
icon.setVisible(newValue);
vBox.setVisible(newValue);
});
// The text in the label does not get correctly displayed if there is not enough available overall height.
// Did not find a better way yet to solve the issue...
label.heightProperty().addListener((ov, o, n) -> {
vBox.setMinHeight((double) n + 100);
label.setMinHeight((double) n);
Platform.runLater(() -> vBox.setMinHeight(label.getHeight() + 15));
});
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
public void setText(String text) {
this.text.set(text);
label.setText(text);
}
public void setGridPane(GridPane gridPane) {
this.gridPane.set(gridPane);
gridPane.getChildren().addAll(icon, vBox);
GridPane.setColumnIndex(icon, columnIndex.get());
GridPane.setColumnIndex(vBox, columnIndex.get() + 1);
GridPane.setRowIndex(icon, rowIndex.get());
GridPane.setRowIndex(vBox, rowIndex.get());
}
public void setRowIndex(int rowIndex) {
this.rowIndex.set(rowIndex);
GridPane.setRowIndex(icon, rowIndex);
GridPane.setRowIndex(vBox, rowIndex);
}
public void setColumnIndex(int columnIndex) {
this.columnIndex.set(columnIndex);
GridPane.setColumnIndex(icon, columnIndex);
GridPane.setColumnIndex(vBox, columnIndex + 1);
}
public final void setOnAction(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler) {
onAction.set(eventHandler);
link.setOnAction(eventHandler);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public String getText() {
return text.get();
}
public StringProperty textProperty() {
return text;
}
public int getColumnIndex() {
return columnIndex.get();
}
public IntegerProperty columnIndexProperty() {
return columnIndex;
}
public int getRowIndex() {
return rowIndex.get();
}
public IntegerProperty rowIndexProperty() {
return rowIndex;
}
public EventHandler<ActionEvent> getOnAction() {
return onAction.get();
}
public ObjectProperty<EventHandler<ActionEvent>> onActionProperty() {
return onAction;
}
public GridPane getGridPane() {
return gridPane.get();
}
public ObjectProperty<GridPane> gridPaneProperty() {
return gridPane;
}
}

View file

@ -26,6 +26,7 @@ public enum HelpId {
SETUP_RESTRICTION_LANGUAGES, SETUP_RESTRICTION_LANGUAGES,
SETUP_RESTRICTION_COUNTRIES, SETUP_RESTRICTION_COUNTRIES,
SETUP_RESTRICTION_ARBITRATORS, SETUP_RESTRICTION_ARBITRATORS,
SETUP_REGISTRATION SETUP_REGISTRATION,
SETUP_FIAT_ACCOUNT
} }

View file

@ -20,6 +20,7 @@ package io.bitsquare.gui.trade.createoffer;
import io.bitsquare.gui.CachedCodeBehind; import io.bitsquare.gui.CachedCodeBehind;
import io.bitsquare.gui.MainController; import io.bitsquare.gui.MainController;
import io.bitsquare.gui.NavigationItem; import io.bitsquare.gui.NavigationItem;
import io.bitsquare.gui.components.InfoDisplay;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.components.btc.AddressTextField; import io.bitsquare.gui.components.btc.AddressTextField;
@ -50,7 +51,6 @@ import javafx.scene.control.*;
import javafx.scene.image.*; import javafx.scene.image.*;
import javafx.scene.input.*; import javafx.scene.input.*;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import javafx.scene.text.*;
import javafx.stage.Window; import javafx.stage.Window;
import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeDude;
@ -79,9 +79,8 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
private ImageView collapse; private ImageView collapse;
private PopOver totalToPayInfoPopover; private PopOver totalToPayInfoPopover;
@FXML private InfoDisplay advancedInfoDisplay, fundsBoxInfoDisplay;
@FXML private ScrollPane scrollPane; @FXML private ScrollPane scrollPane;
@FXML private ImageView payFundsInfoIcon, showDetailsInfoIcon;
@FXML private TextFlow payFundsInfoTextFlow, showDetailsInfoLabel;
@FXML private Pane priceAmountPane, payFundsPane, showDetailsPane; @FXML private Pane priceAmountPane, payFundsPane, showDetailsPane;
@FXML private Label buyLabel, priceAmountTitleLabel, addressLabel, @FXML private Label buyLabel, priceAmountTitleLabel, addressLabel,
balanceLabel, payFundsTitleLabel, totalToPayLabel, totalToPayInfoIconLabel, balanceLabel, payFundsTitleLabel, totalToPayLabel, totalToPayInfoIconLabel,
@ -175,8 +174,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
addressTextField.setVisible(true); addressTextField.setVisible(true);
balanceLabel.setVisible(true); balanceLabel.setVisible(true);
balanceTextField.setVisible(true); balanceTextField.setVisible(true);
payFundsInfoIcon.setVisible(true); fundsBoxInfoDisplay.setVisible(true);
payFundsInfoTextFlow.setVisible(true);
showAdvancedSettingsButton.setVisible(true); showAdvancedSettingsButton.setVisible(true);
if (expand == null) { if (expand == null) {
@ -297,7 +295,9 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
}); });
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> { presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
if (newValue != null) { if (newValue) {
MainController.GET_INSTANCE().blurContentScreen();
// Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added // Dialogs are a bit limited. There is no callback for the InformationDialog button click, so we added
// our own actions. // our own actions.
List<Action> actions = new ArrayList<>(); List<Action> actions = new ArrayList<>();
@ -319,6 +319,7 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
e.printStackTrace(); e.printStackTrace();
} }
Dialog.Actions.CLOSE.handle(actionEvent); Dialog.Actions.CLOSE.handle(actionEvent);
MainController.GET_INSTANCE().removeContentScreenBlur();
} }
}); });
@ -390,34 +391,25 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
toggleDetailsScreen(true); toggleDetailsScreen(true);
} }
private void initEditIcons() {
advancedScreenInited = true;
acceptedCountriesLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedCountriesLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedCountriesLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedCountriesLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedLanguagesLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedLanguagesLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedLanguagesLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedLanguagesLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedArbitratorsLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedArbitratorsLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedArbitratorsLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedArbitratorsLabelIcon.setOnMouseClicked(e -> openSettings());
}
private void hideDetailsScreen() { private void hideDetailsScreen() {
payFundsPane.setId("form-group-background-active"); payFundsPane.setId("form-group-background-active");
payFundsTitleLabel.setId("form-group-title-active"); payFundsTitleLabel.setId("form-group-title-active");
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.layout(); scrollPane.layout();
toggleDetailsScreen(false); toggleDetailsScreen(false);
} }
private void toggleDetailsScreen(boolean visible) { private void toggleDetailsScreen(boolean visible) {
scrollPane.setOnScroll(scrollEvent -> {
if (!visible)
scrollEvent.consume();
});
// deactivate mouse wheel scrolling if hidden
scrollPane.setVmax(visible ? scrollPane.getHeight() : 0);
scrollPane.setVvalue(visible ? scrollPane.getHeight() : 0);
showDetailsPane.setVisible(visible); showDetailsPane.setVisible(visible);
showDetailsTitleLabel.setVisible(visible); showDetailsTitleLabel.setVisible(visible);
@ -438,8 +430,25 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
bankAccountCountyLabel.setVisible(visible); bankAccountCountyLabel.setVisible(visible);
bankAccountCountyTextField.setVisible(visible); bankAccountCountyTextField.setVisible(visible);
showDetailsInfoIcon.setVisible(visible); advancedInfoDisplay.setVisible(visible);
showDetailsInfoLabel.setVisible(visible); }
private void initEditIcons() {
advancedScreenInited = true;
acceptedCountriesLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedCountriesLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedCountriesLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedCountriesLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedLanguagesLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedLanguagesLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedLanguagesLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedLanguagesLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedArbitratorsLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedArbitratorsLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedArbitratorsLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedArbitratorsLabelIcon.setOnMouseClicked(e -> openSettings());
} }
private void setupTotalToPayInfoIconLabel() { private void setupTotalToPayInfoIconLabel() {

View file

@ -19,6 +19,7 @@
<?import io.bitsquare.gui.components.btc.AddressTextField?> <?import io.bitsquare.gui.components.btc.AddressTextField?>
<?import io.bitsquare.gui.components.btc.BalanceTextField?> <?import io.bitsquare.gui.components.btc.BalanceTextField?>
<?import io.bitsquare.gui.components.InfoDisplay?>
<?import io.bitsquare.gui.components.InputTextField?> <?import io.bitsquare.gui.components.InputTextField?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
@ -34,7 +35,7 @@
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
AnchorPane.bottomAnchor="0.0"> AnchorPane.bottomAnchor="0.0">
<GridPane hgap="5.0" vgap="5.0"> <GridPane fx:id="gridPane" hgap="5.0" vgap="5.0">
<padding> <padding>
<Insets bottom="-10.0" left="25.0" top="30.0" right="25"/> <Insets bottom="-10.0" left="25.0" top="30.0" right="25"/>
</padding> </padding>
@ -154,18 +155,8 @@
</HBox> </HBox>
</VBox> </VBox>
<ImageView GridPane.rowIndex="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" <InfoDisplay gridPane="$gridPane" onAction="#onOpenGeneralHelp" rowIndex="2"
GridPane.valignment="TOP"> text="%createOffer.amountPriceBox.info"/>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
<Image fx:id="infoIcon" url="@/images/info_44.png"/>
</ImageView>
<TextFlow GridPane.columnIndex="1" GridPane.rowIndex="2" prefWidth="740.0">
<Label prefWidth="740.0" wrapText="true" text="%createOffer.amountPriceBox.info"/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenGeneralHelp"/>
</TextFlow>
<Button fx:id="showPaymentInfoScreenButton" text="%createOffer.amountPriceBox.next" id="show-details-button" <Button fx:id="showPaymentInfoScreenButton" text="%createOffer.amountPriceBox.next" id="show-details-button"
GridPane.columnIndex="1" GridPane.rowIndex="3" defaultButton="true" GridPane.columnIndex="1" GridPane.rowIndex="3" defaultButton="true"
@ -200,7 +191,9 @@
<Insets top="10.0"/> <Insets top="10.0"/>
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<TextField fx:id="totalToPayTextField" GridPane.columnIndex="1" GridPane.rowIndex="4" <TextField fx:id="totalToPayTextField" promptText="%createOffer.fundsBox.totalsNeeded.prompt"
GridPane.columnIndex="1"
GridPane.rowIndex="4"
editable="false" focusTraversable="false" visible="false"> editable="false" focusTraversable="false" visible="false">
<GridPane.margin> <GridPane.margin>
<Insets top="10.0"/> <Insets top="10.0"/>
@ -223,23 +216,12 @@
</GridPane.margin> </GridPane.margin>
</BalanceTextField> </BalanceTextField>
<ImageView fx:id="payFundsInfoIcon" GridPane.rowIndex="7" GridPane.valignment="TOP" fitHeight="24.0" <InfoDisplay fx:id="fundsBoxInfoDisplay" gridPane="$gridPane" onAction="#onOpenFundingHelp" rowIndex="7"
fitWidth="24.0" pickOnBounds="true" preserveRatio="true" visible="false"> text="%createOffer.fundsBox.info" visible="false"/>
<GridPane.margin>
<Insets right="2.0" top="4.0"/>
</GridPane.margin>
<fx:reference source="infoIcon"/>
</ImageView>
<TextFlow fx:id="payFundsInfoTextFlow" GridPane.columnIndex="1" GridPane.rowIndex="7" prefWidth="740.0"
visible="false">
<Label prefWidth="740.0" wrapText="true" text="%createOffer.fundsBox.info"/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenFundingHelp"/>
</TextFlow>
<HBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="8"> <HBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="8">
<GridPane.margin> <GridPane.margin>
<Insets bottom="20" top="20.0"/> <Insets bottom="30" top="15.0"/>
</GridPane.margin> </GridPane.margin>
<Button fx:id="showAdvancedSettingsButton" text="%createOffer.fundsBox.showAdvanced" <Button fx:id="showAdvancedSettingsButton" text="%createOffer.fundsBox.showAdvanced"
onAction="#onToggleShowAdvancedSettings" visible="false"/> onAction="#onToggleShowAdvancedSettings" visible="false"/>
@ -274,7 +256,8 @@
<Insets top="0.0"/> <Insets top="0.0"/>
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<TextField fx:id="acceptedCountriesTextField" GridPane.columnIndex="1" GridPane.rowIndex="9" visible="false" <TextField fx:id="acceptedCountriesTextField" GridPane.columnIndex="1" GridPane.rowIndex="9"
visible="false"
editable="false" focusTraversable="false"/> editable="false" focusTraversable="false"/>
<HBox GridPane.rowIndex="10" spacing="4" alignment="CENTER_RIGHT"> <HBox GridPane.rowIndex="10" spacing="4" alignment="CENTER_RIGHT">
@ -314,20 +297,10 @@
</GridPane.margin> </GridPane.margin>
</TextField> </TextField>
<ImageView fx:id="showDetailsInfoIcon" GridPane.rowIndex="15" fitHeight="24.0" fitWidth="24.0" <InfoDisplay fx:id="advancedInfoDisplay" gridPane="$gridPane" onAction="#onOpenAdvancedSettingsHelp"
pickOnBounds="true" preserveRatio="true" visible="false" GridPane.valignment="TOP"> rowIndex="15" visible="false"
<GridPane.margin> text="%createOffer.advancedBox.info">
<Insets right="2.0" top="4.0"/> </InfoDisplay>
</GridPane.margin>
<fx:reference source="infoIcon"/>
</ImageView>
<TextFlow fx:id="showDetailsInfoLabel" GridPane.columnIndex="1" GridPane.rowIndex="15" prefWidth="740.0"
visible="false">
<Label prefWidth="740.0" wrapText="true" text="%createOffer.advancedBox.info"/>
<Hyperlink text="%shared.readMore" id="info-link" onAction="#onOpenAdvancedSettingsHelp"/>
</TextFlow>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="200"/> <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="200"/>
@ -351,13 +324,7 @@
<RowConstraints/> <RowConstraints/>
<RowConstraints/> <RowConstraints/>
<RowConstraints/> <RowConstraints/>
<RowConstraints/> <RowConstraints minHeight="35"/>
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
</rowConstraints> </rowConstraints>
</GridPane> </GridPane>

View file

@ -60,6 +60,7 @@ public class ImageUtil {
public static final String TICK = "/images/tick.png"; public static final String TICK = "/images/tick.png";
public static final String ARROW_BLUE = "/images/arrow_blue.png"; public static final String ARROW_BLUE = "/images/arrow_blue.png";
public static final String ARROW_GREY = "/images/arrow_grey.png"; public static final String ARROW_GREY = "/images/arrow_grey.png";
public static final String INFO = "/images/info.png";
public static Image getIconImage(String iconName) { public static Image getIconImage(String iconName) {
return new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images", "/images" + hiRes))); return new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images", "/images" + hiRes)));

View file

@ -74,12 +74,12 @@ public class Transitions {
return animation; return animation;
} }
public static Timeline blurOutAndRemove(Node node) { public static Timeline blurAndRemove(Node node) {
return blurOutAndRemove(node, UI_ANIMATION_TIME); return blurAndRemove(node, UI_ANIMATION_TIME);
} }
public static Timeline blurOutAndRemove(Node node, int duration) { public static Timeline blurAndRemove(Node node, int duration) {
Timeline timeline = blurOut(node, duration); Timeline timeline = blur(node, duration);
timeline.setOnFinished(actionEvent -> { timeline.setOnFinished(actionEvent -> {
((Pane) (node.getParent())).getChildren().remove(node); ((Pane) (node.getParent())).getChildren().remove(node);
Profiler.printMsgWithTime("blurOutAndRemove"); Profiler.printMsgWithTime("blurOutAndRemove");
@ -87,11 +87,11 @@ public class Transitions {
return timeline; return timeline;
} }
public static void blurOut(Node node) { public static void blur(Node node) {
blurOut(node, UI_ANIMATION_TIME); blur(node, UI_ANIMATION_TIME);
} }
public static Timeline blurOut(Node node, int duration) { public static Timeline blur(Node node, int duration) {
GaussianBlur blur = new GaussianBlur(0.0); GaussianBlur blur = new GaussianBlur(0.0);
node.setEffect(blur); node.setEffect(blur);
Timeline timeline = new Timeline(); Timeline timeline = new Timeline();
@ -102,7 +102,7 @@ public class Transitions {
return timeline; return timeline;
} }
public static void blurIn(Node node) { public static void removeBlur(Node node) {
GaussianBlur blur = (GaussianBlur) node.getEffect(); GaussianBlur blur = (GaussianBlur) node.getEffect();
Timeline durationline = new Timeline(); Timeline durationline = new Timeline();
KeyValue kv = new KeyValue(blur.radiusProperty(), 0.0); KeyValue kv = new KeyValue(blur.radiusProperty(), 0.0);

View file

@ -0,0 +1,62 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.util.validation;
import io.bitsquare.locale.BSResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* NumberValidator for validating basic number values.
* Localisation not supported at the moment
* The decimal mark can be either "." or ",". Thousand separators are not supported yet,
* but might be added alter with Local support.
* <p>
* That class implements just what we need for the moment. It is not intended as a general purpose library class.
*/
// TODO Add validation for primary and secondary IDs according to the selected type
public class BankAccountValidator extends InputValidator {
private static final Logger log = LoggerFactory.getLogger(BankAccountValidator.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public ValidationResult validate(String input) {
ValidationResult result = validateIfNotEmpty(input);
if (result.isValid)
result = validateMinLength(input);
return result;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Protected methods
///////////////////////////////////////////////////////////////////////////////////////////
protected ValidationResult validateMinLength(String input) {
if (input.length() > 3)
return new ValidationResult(true);
else
return new ValidationResult(false, BSResources.get("validation.inputTooShort"));
}
}

View file

@ -30,15 +30,16 @@ import org.slf4j.LoggerFactory;
* <p> * <p>
* That class implements just what we need for the moment. It is not intended as a general purpose library class. * That class implements just what we need for the moment. It is not intended as a general purpose library class.
*/ */
public abstract class InputValidator { public class InputValidator {
private static final Logger log = LoggerFactory.getLogger(InputValidator.class); private static final Logger log = LoggerFactory.getLogger(InputValidator.class);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Abstract methods // Public methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
abstract public ValidationResult validate(String input); public ValidationResult validate(String input) {
return validateIfNotEmpty(input);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Protected methods // Protected methods

View file

@ -85,7 +85,6 @@ public class CountryUtil {
} }
public static List<Country> getAllEuroCountries() { public static List<Country> getAllEuroCountries() {
List<Country> allEuroCountries = new ArrayList<>(); List<Country> allEuroCountries = new ArrayList<>();
String[] code = {"BE", "DE", "EE", "FI", "FR", "GR", "IE", "IT", "LV", "LU", "MT", "NL", "PT", "SK", "SI", String[] code = {"BE", "DE", "EE", "FI", "FR", "GR", "IE", "IT", "LV", "LU", "MT", "NL", "PT", "SK", "SI",
"ES", "AT", "CY"}; "ES", "AT", "CY"};
@ -136,7 +135,6 @@ public class CountryUtil {
// from a static list -or we find something ready made?). // from a static list -or we find something ready made?).
private static List<Locale> getAllCountryLocales() { private static List<Locale> getAllCountryLocales() {
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales()); List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
log.debug(allLocales.toString());
Set<Locale> allLocalesAsSet = allLocales.stream().filter(locale -> !"".equals(locale.getCountry())) Set<Locale> allLocalesAsSet = allLocales.stream().filter(locale -> !"".equals(locale.getCountry()))
.map(locale -> new Locale("", locale.getCountry(), "")) .map(locale -> new Locale("", locale.getCountry(), ""))
.collect(Collectors.toSet()); .collect(Collectors.toSet());

View file

@ -200,7 +200,7 @@ public class TradeManager {
resultHandler.onResult(transactionId); resultHandler.onResult(transactionId);
} catch (Exception e) { } catch (Exception e) {
//TODO retry policy //TODO retry policy
errorMessageHandler.onFault("Could not save offer. Reason: " + e.getMessage()); errorMessageHandler.onFault("Could not save offer. Reason: " + e.getCause().getMessage());
createOfferCoordinatorMap.remove(offer.getId()); createOfferCoordinatorMap.remove(offer.getId());
} }
}, },

View file

@ -54,7 +54,7 @@ public class User implements Serializable {
private KeyPair messageKeyPair; private KeyPair messageKeyPair;
private String accountID; private String accountID;
// TODO make it thread safe // TODO make it thread safe
private List<BankAccount> bankAccounts; private List<BankAccount> bankAccounts = new ArrayList<>();
private BankAccount currentBankAccount; private BankAccount currentBankAccount;
public User() { public User() {
@ -117,17 +117,12 @@ public class User implements Serializable {
public void setCurrentBankAccount(@Nullable BankAccount bankAccount) { public void setCurrentBankAccount(@Nullable BankAccount bankAccount) {
currentBankAccount = bankAccount; currentBankAccount = bankAccount;
if (bankAccount != null) { if (currentBankAccount != null) {
BSFormatter.setFiatCurrencyCode(currentBankAccount.getCurrency().getCurrencyCode()); BSFormatter.setFiatCurrencyCode(currentBankAccount.getCurrency().getCurrencyCode());
FiatValidator.setFiatCurrencyCode(currentBankAccount.getCurrency().getCurrencyCode()); FiatValidator.setFiatCurrencyCode(currentBankAccount.getCurrency().getCurrencyCode());
}
int index; selectedBankAccountIndexProperty.set(bankAccounts.indexOf(currentBankAccount));
for (index = 0; index < bankAccounts.size(); index++) {
if (currentBankAccount != null && currentBankAccount.equals(bankAccounts.get(index)))
break;
} }
selectedBankAccountIndexProperty.set(index);
} }

View file

@ -18,6 +18,7 @@ validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowe
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi). validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed.. validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters. validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
validation.inputTooShort=Your input is too short.
# Create offer # Create offer
createOffer.amount.prompt=Enter amount in BTC createOffer.amount.prompt=Enter amount in BTC
@ -36,12 +37,13 @@ createOffer.amountPriceBox.next=Next step
createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places. createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.
createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places. createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places.
createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it. createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it.
createOffer.amountPriceBox.error.message=An error occurred when placing the offer:\n\n {0}
createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount. createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount.
createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount. createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount.
createOffer.fundsBox.title=Fund your trade wallet createOffer.fundsBox.title=Fund your trade wallet
createOffer.fundsBox.totalsNeeded=Funds needed for that trade: createOffer.fundsBox.totalsNeeded=Funds needed for that trade:
createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amount entered above
createOffer.fundsBox.address=Trade wallet address: createOffer.fundsBox.address=Trade wallet address:
createOffer.fundsBox.balance=Trade wallet balance: createOffer.fundsBox.balance=Trade wallet balance:
createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment. createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment.

View file

@ -18,6 +18,7 @@ validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowe
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi). validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed.. validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters. validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
validation.inputTooShort=Your input is too short.
# Create offer # Create offer
createOffer.amount.prompt=Enter amount in BTC createOffer.amount.prompt=Enter amount in BTC
@ -36,12 +37,13 @@ createOffer.amountPriceBox.next=Next step
createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places. createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.
createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places. createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places.
createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it. createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it.
createOffer.amountPriceBox.error.message=An error occurred when placing the offer:\n\n {0}
createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount. createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount.
createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount. createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount.
createOffer.fundsBox.title=Fund your trade wallet createOffer.fundsBox.title=Fund your trade wallet
createOffer.fundsBox.totalsNeeded=Funds needed for that trade: createOffer.fundsBox.totalsNeeded=Funds needed for that trade:
createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amount entered above
createOffer.fundsBox.address=Trade wallet address: createOffer.fundsBox.address=Trade wallet address:
createOffer.fundsBox.balance=Trade wallet balance: createOffer.fundsBox.balance=Trade wallet balance:
createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment. createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment.

View file

@ -18,6 +18,7 @@ validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowe
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi). validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed.. validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters. validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
validation.inputTooShort=Your input is too short.
# Create offer # Create offer
createOffer.amount.prompt=Enter amount in BTC createOffer.amount.prompt=Enter amount in BTC
@ -36,12 +37,13 @@ createOffer.amountPriceBox.next=Next step
createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places. createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.
createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places. createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places.
createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it. createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it.
createOffer.amountPriceBox.error.message=An error occurred when placing the offer:\n\n {0}
createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount. createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount.
createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount. createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount.
createOffer.fundsBox.title=Fund your trade wallet createOffer.fundsBox.title=Fund your trade wallet
createOffer.fundsBox.totalsNeeded=Funds needed for that trade: createOffer.fundsBox.totalsNeeded=Funds needed for that trade:
createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amount entered above
createOffer.fundsBox.address=Trade wallet address: createOffer.fundsBox.address=Trade wallet address:
createOffer.fundsBox.balance=Trade wallet balance: createOffer.fundsBox.balance=Trade wallet balance:
createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment. createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment.

View file

@ -18,6 +18,7 @@ validation.fiat.toLarge=Input larger as maximum possible {0} value is not allowe
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi). validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).
validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed.. validation.btc.toLarge=Input larger as maximum possible Bitcoin value is not allowed..
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters. validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
validation.inputTooShort=Your input is too short.
# Create offer # Create offer
createOffer.amount.prompt=Enter amount in BTC createOffer.amount.prompt=Enter amount in BTC
@ -36,12 +37,13 @@ createOffer.amountPriceBox.next=Next step
createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places. createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.
createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places. createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places.
createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it. createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it.
createOffer.amountPriceBox.error.message=An error occurred when placing the offer:\n\n {0}
createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount. createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount.
createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount. createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount.
createOffer.fundsBox.title=Fund your trade wallet createOffer.fundsBox.title=Fund your trade wallet
createOffer.fundsBox.totalsNeeded=Funds needed for that trade: createOffer.fundsBox.totalsNeeded=Funds needed for that trade:
createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amount entered above
createOffer.fundsBox.address=Trade wallet address: createOffer.fundsBox.address=Trade wallet address:
createOffer.fundsBox.balance=Trade wallet balance: createOffer.fundsBox.balance=Trade wallet balance:
createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment. createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -72,10 +72,11 @@
</GridPane.margin> </GridPane.margin>
</TextField> </TextField>
<ImageView fx:id="payFundsInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" <ImageView fx:id="payFundsInfoIcon" GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
preserveRatio="true"
visible="true" GridPane.rowIndex="3" GridPane.valignment="TOP"> visible="true" GridPane.rowIndex="3" GridPane.valignment="TOP">
<image> <image>
<Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info_44.png"/> <Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info.png"/>
</image> </image>
<GridPane.margin> <GridPane.margin>
<Insets right="2.0" top="4.0"/> <Insets right="2.0" top="4.0"/>

View file

@ -0,0 +1,101 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.input.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* For testing single isolated UI screens
*/
public class FiatAccountUITestRunner extends Application {
private static final Logger log = LoggerFactory.getLogger(FiatAccountUITestRunner.class);
private Scene scene;
private Pane view;
private Pane pane;
private boolean devTest = true;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
loadMainWindow();
primaryStage.setScene(scene);
primaryStage.show();
}
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
getUrl("/io/bitsquare/gui/account/fiataccount/FiatAccountView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);
refreshStylesheets();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getStackTrace().toString());
}
}
private void refreshStylesheets() {
scene.getStylesheets().clear();
scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
}
private URL getUrl(String subPath) {
if (devTest) {
try {
// load from file system location to make a reload possible. makes dev process easier with hot reload
return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
}
else {
return getClass().getResource(subPath);
}
}
}

View file

@ -0,0 +1,101 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.input.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* For testing single isolated UI screens
*/
public class PasswordUITestRunner extends Application {
private static final Logger log = LoggerFactory.getLogger(PasswordUITestRunner.class);
private Scene scene;
private Pane view;
private Pane pane;
private boolean devTest = true;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
loadMainWindow();
primaryStage.setScene(scene);
primaryStage.show();
}
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
getUrl("/io/bitsquare/gui/account/password/PasswordView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);
refreshStylesheets();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getStackTrace().toString());
}
}
private void refreshStylesheets() {
scene.getStylesheets().clear();
scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
}
private URL getUrl(String subPath) {
if (devTest) {
try {
// load from file system location to make a reload possible. makes dev process easier with hot reload
return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
}
else {
return getClass().getResource(subPath);
}
}
}

View file

@ -0,0 +1,101 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.input.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* For testing single isolated UI screens
*/
public class RestrictionsUITestRunner extends Application {
private static final Logger log = LoggerFactory.getLogger(RestrictionsUITestRunner.class);
private Scene scene;
private Pane view;
private Pane pane;
private boolean devTest = true;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 530);
scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
loadMainWindow();
primaryStage.setScene(scene);
primaryStage.show();
}
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
getUrl("/io/bitsquare/gui/account/restrictions/RestrictionsView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);
refreshStylesheets();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getStackTrace().toString());
}
}
private void refreshStylesheets() {
scene.getStylesheets().clear();
scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
}
private URL getUrl(String subPath) {
if (devTest) {
try {
// load from file system location to make a reload possible. makes dev process easier with hot reload
return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
}
else {
return getClass().getResource(subPath);
}
}
}

View file

@ -0,0 +1,101 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.settings;
import io.bitsquare.di.BitSquareModule;
import io.bitsquare.di.GuiceFXMLLoader;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.input.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* For testing single isolated UI screens
*/
public class SeedWordsUITestRunner extends Application {
private static final Logger log = LoggerFactory.getLogger(SeedWordsUITestRunner.class);
private Scene scene;
private Pane view;
private Pane pane;
private boolean devTest = true;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws IOException {
Injector injector = Guice.createInjector(new BitSquareModule());
GuiceFXMLLoader.setInjector(injector);
pane = new StackPane();
scene = new Scene(pane, 1000, 630);
scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+S"), this::loadMainWindow);
loadMainWindow();
primaryStage.setScene(scene);
primaryStage.show();
}
public void loadMainWindow() {
log.debug("re load");
pane.getChildren().removeAll();
GuiceFXMLLoader loader = new GuiceFXMLLoader(
getUrl("/io/bitsquare/gui/account/seedwords/SeedWordsView.fxml"), false);
try {
view = loader.load();
pane.getChildren().setAll(view);
refreshStylesheets();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getStackTrace().toString());
}
}
private void refreshStylesheets() {
scene.getStylesheets().clear();
scene.getStylesheets().setAll(getUrl("/io/bitsquare/gui/bitsquare.css").toExternalForm());
}
private URL getUrl(String subPath) {
if (devTest) {
try {
// load from file system location to make a reload possible. makes dev process easier with hot reload
return new URL("file:///Users/mk/Documents/_intellij/bitsquare/src/main/java" + subPath);
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
}
else {
return getClass().getResource(subPath);
}
}
}

View file

@ -93,10 +93,11 @@
</HBox> </HBox>
<Separator orientation="HORIZONTAL" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="11"/> <Separator orientation="HORIZONTAL" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="11"/>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="12" <ImageView GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
GridPane.rowIndex="12"
GridPane.valignment="TOP"> GridPane.valignment="TOP">
<image> <image>
<Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info_44.png"/> <Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info.png"/>
</image> </image>
<GridPane.margin> <GridPane.margin>
<Insets right="2.0" top="4.0"/> <Insets right="2.0" top="4.0"/>

View file

@ -55,10 +55,11 @@
</GridPane.margin> </GridPane.margin>
</ComboBox> </ComboBox>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="2" <ImageView GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
GridPane.rowIndex="2"
GridPane.valignment="TOP"> GridPane.valignment="TOP">
<image> <image>
<Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info_44.png"/> <Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info.png"/>
</image> </image>
<GridPane.margin> <GridPane.margin>
<Insets right="2.0" top="4.0"/> <Insets right="2.0" top="4.0"/>
@ -100,7 +101,8 @@
<Insets bottom="10"/> <Insets bottom="10"/>
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="6" <ImageView GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
GridPane.rowIndex="6"
GridPane.valignment="TOP"> GridPane.valignment="TOP">
<image> <image>
<fx:reference source="infoIcon"/> <fx:reference source="infoIcon"/>
@ -138,7 +140,8 @@
<Label text="Accepted arbitrators:" GridPane.rowIndex="8" GridPane.valignment="TOP"/> <Label text="Accepted arbitrators:" GridPane.rowIndex="8" GridPane.valignment="TOP"/>
<ListView fx:id="arbitratorsListView" prefHeight="100.0" GridPane.columnIndex="1" GridPane.rowIndex="8"/> <ListView fx:id="arbitratorsListView" prefHeight="100.0" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
<Button text="Add arbitrator" GridPane.columnIndex="1" GridPane.rowIndex="9"/> <Button text="Add arbitrator" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
<ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="10" <ImageView GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"
GridPane.rowIndex="10"
GridPane.valignment="TOP"> GridPane.valignment="TOP">
<image> <image>
<fx:reference source="infoIcon"/> <fx:reference source="infoIcon"/>

View file

@ -68,10 +68,11 @@
</GridPane.margin> </GridPane.margin>
</Button> </Button>
<ImageView fx:id="payFundsInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" <ImageView fx:id="payFundsInfoIcon" GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
preserveRatio="true"
GridPane.rowIndex="3" GridPane.valignment="TOP"> GridPane.rowIndex="3" GridPane.valignment="TOP">
<image> <image>
<Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info_44.png"/> <Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info.png"/>
</image> </image>
<GridPane.margin> <GridPane.margin>
<Insets right="2.0" top="4.0"/> <Insets right="2.0" top="4.0"/>

View file

@ -70,10 +70,11 @@
</GridPane.margin> </GridPane.margin>
</Button> </Button>
<ImageView fx:id="payFundsInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" <ImageView fx:id="payFundsInfoIcon" GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true"
preserveRatio="true"
visible="true" GridPane.rowIndex="3" GridPane.valignment="TOP"> visible="true" GridPane.rowIndex="3" GridPane.valignment="TOP">
<image> <image>
<Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info_44.png"/> <Image fx:id="infoIcon" url="@../../../../../../../main/resources/images/info.png"/>
</image> </image>
<GridPane.margin> <GridPane.margin>
<Insets right="2.0" top="4.0"/> <Insets right="2.0" top="4.0"/>

View file

@ -156,11 +156,12 @@
</GridPane.margin> </GridPane.margin>
</VBox> </VBox>
<ImageView fx:id="priceAmountInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" <ImageView fx:id="priceAmountInfoIcon" GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0"
pickOnBounds="true"
preserveRatio="true" GridPane.rowIndex="2" GridPane.valignment="TOP"> preserveRatio="true" GridPane.rowIndex="2" GridPane.valignment="TOP">
<image> <image>
<Image fx:id="infoIcon" <Image fx:id="infoIcon"
url="@../../../../../../../../main/resources/images/info_44.png"/> url="@../../../../../../../../main/resources/images/info.png"/>
</image> </image>
<GridPane.margin> <GridPane.margin>
<Insets right="2.0" top="4.0"/> <Insets right="2.0" top="4.0"/>
@ -233,7 +234,8 @@
</GridPane.margin> </GridPane.margin>
</TextField> </TextField>
<ImageView fx:id="payFundsInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" <ImageView fx:id="payFundsInfoIcon" GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0"
pickOnBounds="true"
preserveRatio="true" visible="true" GridPane.rowIndex="14" GridPane.valignment="TOP"> preserveRatio="true" visible="true" GridPane.rowIndex="14" GridPane.valignment="TOP">
<image> <image>
<fx:reference source="infoIcon"/> <fx:reference source="infoIcon"/>
@ -320,7 +322,8 @@
text="Spain" visible="true" GridPane.columnIndex="1" GridPane.columnSpan="2" text="Spain" visible="true" GridPane.columnIndex="1" GridPane.columnSpan="2"
GridPane.rowIndex="21"/> GridPane.rowIndex="21"/>
<ImageView fx:id="showDetailsInfoIcon" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" <ImageView fx:id="showDetailsInfoIcon" GridPane.rowSpan="2" fitHeight="24.0" fitWidth="24.0"
pickOnBounds="true"
preserveRatio="true" visible="true" GridPane.rowIndex="22" GridPane.valignment="TOP"> preserveRatio="true" visible="true" GridPane.rowIndex="22" GridPane.valignment="TOP">
<image> <image>
<fx:reference source="infoIcon"/> <fx:reference source="infoIcon"/>