diff --git a/pom.xml b/pom.xml index 1167a7a106..fcfbbc8866 100644 --- a/pom.xml +++ b/pom.xml @@ -239,12 +239,6 @@ 13.0 - - net.glxn - qrgen - 1.3 - - org.mockito mockito-all diff --git a/src/main/java/io/bitsquare/SeedNode.java b/src/main/java/io/bitsquare/SeedNode.java index 16f2ff4797..2ed67d65a6 100644 --- a/src/main/java/io/bitsquare/SeedNode.java +++ b/src/main/java/io/bitsquare/SeedNode.java @@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory; /** * Well known node which is reachable for all peers for bootstrapping. * There will be several SeedNodes running on several servers. - *

+ *

* TODO: Alternative bootstrap methods will follow later (save locally list of known nodes reported form other peers...) */ public class SeedNode extends Thread { diff --git a/src/main/java/io/bitsquare/bank/BankAccount.java b/src/main/java/io/bitsquare/bank/BankAccount.java index 99a7923d65..65d75f3a31 100644 --- a/src/main/java/io/bitsquare/bank/BankAccount.java +++ b/src/main/java/io/bitsquare/bank/BankAccount.java @@ -35,12 +35,18 @@ public class BankAccount implements Serializable { private final String accountSecondaryID; // like BIC private final String accountHolderName; private final Country country; // where bank is registered + // The main currency if account support multiple currencies. // The user can create multiple bank accounts with same bank account but other currency if his bank account // support that. private final Currency currency; private final String accountTitle; + + /////////////////////////////////////////////////////////////////////////////////////////// + // Constructor + /////////////////////////////////////////////////////////////////////////////////////////// + public BankAccount(BankAccountType bankAccountType, Currency currency, Country country, String accountTitle, String accountHolderName, String accountPrimaryID, String accountSecondaryID) { this.bankAccountType = bankAccountType; @@ -52,18 +58,10 @@ public class BankAccount implements Serializable { this.accountSecondaryID = accountSecondaryID; } - public int hashCode() { - return Objects.hashCode(accountTitle); - } - - public boolean equals(Object obj) { - if (!(obj instanceof BankAccount)) return false; - if (obj == this) return true; - - final BankAccount other = (BankAccount) obj; - return accountTitle.equals(other.getUid()); - } + /////////////////////////////////////////////////////////////////////////////////////////// + // Getters/Setters + /////////////////////////////////////////////////////////////////////////////////////////// public String getAccountPrimaryID() { return accountPrimaryID; @@ -98,6 +96,25 @@ public class BankAccount implements Serializable { return accountTitle; } + + /////////////////////////////////////////////////////////////////////////////////////////// + // Methods + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public int hashCode() { + return Objects.hashCode(accountTitle); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof BankAccount)) return false; + if (obj == this) return true; + + final BankAccount other = (BankAccount) obj; + return accountTitle.equals(other.getUid()); + } + @Override public String toString() { return "BankAccount{" + diff --git a/src/main/java/io/bitsquare/btc/AddressEntry.java b/src/main/java/io/bitsquare/btc/AddressEntry.java index 9a1889b267..077f7653b6 100644 --- a/src/main/java/io/bitsquare/btc/AddressEntry.java +++ b/src/main/java/io/bitsquare/btc/AddressEntry.java @@ -24,6 +24,10 @@ import com.google.bitcoin.crypto.DeterministicKey; import java.io.Serializable; +/** + * Is a minimalistic wallet abstraction used to separate transactions between different activities like: + * Registration, trade and arbiter deposit. + */ public class AddressEntry implements Serializable { private static final long serialVersionUID = 5501603992599920416L; private transient DeterministicKey key; diff --git a/src/main/java/io/bitsquare/btc/BtcValidator.java b/src/main/java/io/bitsquare/btc/BtcValidator.java index a21bf59544..50f8ce552f 100644 --- a/src/main/java/io/bitsquare/btc/BtcValidator.java +++ b/src/main/java/io/bitsquare/btc/BtcValidator.java @@ -23,6 +23,7 @@ import com.google.bitcoin.core.Transaction; import javax.inject.Inject; +// TODO will be probably removed public class BtcValidator { private static NetworkParameters params; diff --git a/src/main/java/io/bitsquare/btc/FeePolicy.java b/src/main/java/io/bitsquare/btc/FeePolicy.java index eee63e6f71..b8607c67b7 100644 --- a/src/main/java/io/bitsquare/btc/FeePolicy.java +++ b/src/main/java/io/bitsquare/btc/FeePolicy.java @@ -34,6 +34,8 @@ public class FeePolicy { public static final Coin CREATE_OFFER_FEE = Coin.MILLICOIN; // 0.001 public static final Coin TAKE_OFFER_FEE = CREATE_OFFER_FEE; private static final Logger log = LoggerFactory.getLogger(FeePolicy.class); + + // those are just dummy yet. trading fees will go probably to arbiters private static final String registrationFeeAddress = "mvkDXt4QmN4Nq9dRUsRigBCaovde9nLkZR"; private static final String createOfferFeeAddress = "n2upbsaKAe4PD3cc4JfS7UCqPC5oNd7Ckg"; private static final String takeOfferFeeAddress = "n2upbsaKAe4PD3cc4JfS7UCqPC5oNd7Ckg"; diff --git a/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java b/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java index 0acef12553..16674b8484 100644 --- a/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java +++ b/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java @@ -32,6 +32,5 @@ public class ConfidenceListener { } public void onTransactionConfidenceChanged(TransactionConfidence confidence) { - } } \ No newline at end of file diff --git a/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java b/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java index ff40d7af19..8344952bb2 100644 --- a/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java +++ b/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java @@ -103,7 +103,7 @@ public class GuiceFXMLLoader { * A JavaFX controller factory for constructing controllers via Guice DI. To * install this in the {@link javafx.fxml.FXMLLoader}, pass it as a parameter to * {@link javafx.fxml.FXMLLoader#setControllerFactory(javafx.util.Callback)}. - *

+ *

* Once set, make sure you do not use the static methods on * {@link javafx.fxml.FXMLLoader} when creating your JavaFX node. */ diff --git a/src/main/java/io/bitsquare/gui/MainController.java b/src/main/java/io/bitsquare/gui/MainController.java index 59213c366d..22262b7d49 100644 --- a/src/main/java/io/bitsquare/gui/MainController.java +++ b/src/main/java/io/bitsquare/gui/MainController.java @@ -400,7 +400,7 @@ public class MainController extends ViewController { }); user.getSelectedBankAccountIndexProperty().addListener(observable -> - accountComboBox.getSelectionModel().select(user.getCurrentBankAccount())); + accountComboBox.getSelectionModel().select(user.getCurrentBankAccount())); user.getBankAccountsSizeProperty().addListener(observable -> { accountComboBox.setItems(FXCollections.observableArrayList(user.getBankAccounts())); // need to delay it a bit otherwise it will not be set diff --git a/src/main/java/io/bitsquare/gui/MainView.fxml b/src/main/java/io/bitsquare/gui/MainView.fxml index 10d444e643..a87b4bc448 100644 --- a/src/main/java/io/bitsquare/gui/MainView.fxml +++ b/src/main/java/io/bitsquare/gui/MainView.fxml @@ -16,8 +16,7 @@ ~ along with Bitsquare. If not, see . --> - - + diff --git a/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml b/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml index 41157323a2..9a1aa17234 100644 --- a/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml +++ b/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml @@ -16,9 +16,8 @@ ~ along with Bitsquare. If not, see . --> - + - - (EnumSet.allOf(Arbitrator.METHOD - .class)))); + .class)))); methodsComboBox.setConverter(new StringConverter() { @Override @@ -355,11 +355,11 @@ public class ArbitratorRegistrationController extends CachedViewController { private void setupPayCollateralScreen() { infoLabel.setText("You need to pay 10 x the max. trading volume as collateral.\n\nThat payment will be " + - "locked into a MultiSig fund and be refunded when you leave the arbitration pool.\nIn case of fraud " + - "(collusion, not fulfilling the min. dispute quality requirements) you will lose your collateral.\n" + - "If you have a negative feedback from your clients you will lose a part of the collateral,\n" + - "depending on the overall relation of negative to positive ratings you received after a dispute " + - "resolution.\n\nPlease pay in " + arbitrator.getMaxTradeVolume() * 10 + " BTC"); + "locked into a MultiSig fund and be refunded when you leave the arbitration pool.\nIn case of fraud " + + "(collusion, not fulfilling the min. dispute quality requirements) you will lose your collateral.\n" + + "If you have a negative feedback from your clients you will lose a part of the collateral,\n" + + "depending on the overall relation of negative to positive ratings you received after a dispute " + + "resolution.\n\nPlease pay in " + arbitrator.getMaxTradeVolume() * 10 + " BTC"); String collateralAddress = walletFacade.getRegistrationAddressEntry() != null ? @@ -476,20 +476,20 @@ public class ArbitratorRegistrationController extends CachedViewController { String description = descriptionTextArea.getText(); return new Arbitrator(pubKeyAsHex, - messagePubKeyAsHex, - name, - idType, - languageList, - new Reputation(), - maxTradeVolume, - passiveServiceFee, - minPassiveServiceFee, - arbitrationFee, - minArbitrationFee, - methodList, - idVerificationList, - webUrl, - description); + messagePubKeyAsHex, + name, + idType, + languageList, + new Reputation(), + maxTradeVolume, + passiveServiceFee, + minPassiveServiceFee, + arbitrationFee, + minArbitrationFee, + methodList, + idVerificationList, + webUrl, + description); } catch (BitSquareValidator.ValidationException e) { return null; } diff --git a/src/main/java/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml b/src/main/java/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml index f329952fad..42f039771e 100644 --- a/src/main/java/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml +++ b/src/main/java/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml @@ -20,7 +20,6 @@ - + *

* That class implements just what we need for the moment. It is not intended as a general purpose library class. */ public class ValidatingTextField extends TextField { diff --git a/src/main/java/io/bitsquare/gui/components/btc/AddressTextField.java b/src/main/java/io/bitsquare/gui/components/btc/AddressTextField.java index 15c8e0ed1e..9ced27f77d 100644 --- a/src/main/java/io/bitsquare/gui/components/btc/AddressTextField.java +++ b/src/main/java/io/bitsquare/gui/components/btc/AddressTextField.java @@ -149,7 +149,7 @@ public class AddressTextField extends AnchorPane { this.paymentLabel = paymentLabel; } - + /////////////////////////////////////////////////////////////////////////////////////////// // Private /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/io/bitsquare/gui/components/confidence/ConfidenceProgressIndicator.java b/src/main/java/io/bitsquare/gui/components/confidence/ConfidenceProgressIndicator.java index 2ee2c3d916..78ff21dfcf 100644 --- a/src/main/java/io/bitsquare/gui/components/confidence/ConfidenceProgressIndicator.java +++ b/src/main/java/io/bitsquare/gui/components/confidence/ConfidenceProgressIndicator.java @@ -43,22 +43,22 @@ import javafx.scene.control.*; *

* ProgressIndicator sets focusTraversable to false. *

- *

- *

+ *

+ *

* This first example creates a ProgressIndicator with an indeterminate value : *


  * import javafx.scene.control.ProgressIndicator;
  * ProgressIndicator p1 = new ProgressIndicator();
  * 
- *

- *

+ *

+ *

* This next example creates a ProgressIndicator which is 25% complete : *


  * import javafx.scene.control.ProgressIndicator;
  * ProgressIndicator p2 = new ProgressIndicator();
  * p2.setProgress(0.25F);
  * 
- *

+ *

* Implementation of ProgressIndicator According to JavaFX UI Control API Specification * * @since JavaFX 2.0 @@ -81,7 +81,7 @@ public class ConfidenceProgressIndicator extends Control { **************************************************************************/ /** * Initialize the style class to 'progress-indicator'. - *

+ *

* This is the selector class from which CSS can be used to style * this control. */ diff --git a/src/main/java/io/bitsquare/gui/funds/FundsView.fxml b/src/main/java/io/bitsquare/gui/funds/FundsView.fxml index 7bed50e485..d9acc082c2 100644 --- a/src/main/java/io/bitsquare/gui/funds/FundsView.fxml +++ b/src/main/java/io/bitsquare/gui/funds/FundsView.fxml @@ -17,9 +17,8 @@ --> - - - + + + - - - + diff --git a/src/main/java/io/bitsquare/gui/funds/transactions/TransactionsView.fxml b/src/main/java/io/bitsquare/gui/funds/transactions/TransactionsView.fxml index 9a375a75dc..9c3e660f73 100644 --- a/src/main/java/io/bitsquare/gui/funds/transactions/TransactionsView.fxml +++ b/src/main/java/io/bitsquare/gui/funds/transactions/TransactionsView.fxml @@ -18,10 +18,9 @@ --> - + - - + diff --git a/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalController.java b/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalController.java index ffbee583a5..9b43cb2998 100644 --- a/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalController.java +++ b/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalController.java @@ -131,7 +131,7 @@ public class WithdrawalController extends CachedViewController { List addressEntryList = walletFacade.getAddressEntryList(); addressList = FXCollections.observableArrayList(); addressList.addAll(addressEntryList.stream().map(anAddressEntryList -> - new WithdrawalListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList())); + new WithdrawalListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList())); tableView.setItems(addressList); } @@ -182,7 +182,7 @@ public class WithdrawalController extends CachedViewController { changeAddressTextField.getText(), amount, callback); } catch (AddressFormatException e) { Popups.openErrorPopup("Address invalid", - "The address is not correct. Please check the address format."); + "The address is not correct. Please check the address format."); } catch (InsufficientMoneyException e) { Popups.openInsufficientMoneyPopup(); @@ -194,7 +194,7 @@ public class WithdrawalController extends CachedViewController { } else { Popups.openErrorPopup("Insufficient amount", - "The amount to transfer is lower the the transaction fee and the min. possible tx value."); + "The amount to transfer is lower the the transaction fee and the min. possible tx value."); } } catch (BitSquareValidator.ValidationException e) { @@ -308,7 +308,7 @@ public class WithdrawalController extends CachedViewController { private void setConfidenceColumnCellFactory() { confidenceColumn.setCellValueFactory((addressListItem) -> - new ReadOnlyObjectWrapper(addressListItem.getValue())); + new ReadOnlyObjectWrapper(addressListItem.getValue())); confidenceColumn.setCellFactory( new Callback, TableCell>() { diff --git a/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml b/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml index cb1ae873f4..8891ab834f 100644 --- a/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml +++ b/src/main/java/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml @@ -19,9 +19,8 @@ - + - diff --git a/src/main/java/io/bitsquare/gui/home/HomeView.fxml b/src/main/java/io/bitsquare/gui/home/HomeView.fxml index 5a9bad530d..b27189272c 100644 --- a/src/main/java/io/bitsquare/gui/home/HomeView.fxml +++ b/src/main/java/io/bitsquare/gui/home/HomeView.fxml @@ -17,10 +17,8 @@ ~ along with Bitsquare. If not, see . --> - - + - . --> - + - diff --git a/src/main/java/io/bitsquare/gui/orders/OrdersView.fxml b/src/main/java/io/bitsquare/gui/orders/OrdersView.fxml index 8e6d10d42f..d592449c44 100644 --- a/src/main/java/io/bitsquare/gui/orders/OrdersView.fxml +++ b/src/main/java/io/bitsquare/gui/orders/OrdersView.fxml @@ -18,9 +18,8 @@ --> - - - + + . --> - + - diff --git a/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml b/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml index a0e75034fc..3e055e9dfa 100644 --- a/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml +++ b/src/main/java/io/bitsquare/gui/orders/offer/OfferView.fxml @@ -20,8 +20,7 @@ - - + diff --git a/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeController.java b/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeController.java index 3f599b3e92..9025abf565 100644 --- a/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeController.java +++ b/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeController.java @@ -157,8 +157,8 @@ public class PendingTradeController extends CachedViewController { // select Optional currentTradeItemOptional = tradeItems.stream().filter((e) -> - tradeManager.getPendingTrade() != null && - e.getTrade().getId().equals(tradeManager.getPendingTrade().getId())).findFirst(); + tradeManager.getPendingTrade() != null && + e.getTrade().getId().equals(tradeManager.getPendingTrade().getId())).findFirst(); if (currentTradeItemOptional.isPresent()) { openTradesTable.getSelectionModel().select(currentTradeItemOptional.get()); } @@ -241,7 +241,7 @@ public class PendingTradeController extends CachedViewController { Transaction transaction = trade.getDepositTransaction(); if (transaction == null) { trade.depositTxChangedProperty().addListener((observableValue, aBoolean, aBoolean2) -> - updateTx(trade.getDepositTransaction())); + updateTx(trade.getDepositTransaction())); } else { updateTx(trade.getDepositTransaction()); @@ -370,8 +370,8 @@ public class PendingTradeController extends CachedViewController { } catch (Exception e) { log.warn("Country icon not found: /images/countries/" + - country.getCode().toLowerCase() + ".png country name: " + - country.getName()); + country.getCode().toLowerCase() + ".png country name: " + + country.getName()); } Tooltip.install(this, new Tooltip(country.getName())); } @@ -395,7 +395,7 @@ public class PendingTradeController extends CachedViewController { if (tradesTableItem != null) { BankAccountType bankAccountType = tradesTableItem.getTrade().getOffer() - .getBankAccountType(); + .getBankAccountType(); setText(Localisation.get(bankAccountType.toString())); } else { diff --git a/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml b/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml index 3df370e865..e35c441c26 100644 --- a/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml +++ b/src/main/java/io/bitsquare/gui/orders/pending/PendingTradeView.fxml @@ -18,11 +18,10 @@ --> - + - + - - . --> - - - + + . --> - - - + + - Platform.runLater(() -> ValidatingTextField.hidePopover())); + Platform.runLater(() -> ValidatingTextField.hidePopover())); } diff --git a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCodeBehind.java b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCodeBehind.java index 3c9169a7aa..bded89622c 100644 --- a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCodeBehind.java +++ b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferCodeBehind.java @@ -39,27 +39,26 @@ import javafx.scene.layout.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -//TODO check DI - /** * Code behind (FXML Controller is part of View, not a classical controller from MVC): *

* Creates Presenter and passes Model from DI to Presenter. Does not hold a reference to Model *

- * - Setup binding from Presenter to View elements (also bidirectional - Inputs). Binding are only to presenters properties, not logical bindings or cross-view element bindings. + * - Setup binding from Presenter to View elements (also bidirectional - Inputs). Binding are only to presenters + * properties, not logical bindings or cross-view element bindings. * - Listen to UI events (Action) from View and call method in Presenter. * - Is entry node for hierarchical view graphs. Passes method calls to Presenter. Calls methods on sub views. * - Handle lifecycle and self removal from scene graph. * - Non declarative (dynamic) view definitions (if it gets larger, then user a ViewBuilder) *

* View: - * - Mostly declared in FXML. Dynamic parts are declared in Controller. If more view elements need to be defined in code then use ViewBuilder. + * - Mostly declared in FXML. Dynamic parts are declared in Controller. If more view elements need to be defined in + * code then use ViewBuilder. *

* Optional ViewBuilder: * - Replacement for FXML view definitions. */ -public class CreateOfferCodeBehind extends CachedViewController -{ +public class CreateOfferCodeBehind extends CachedViewController { private static final Logger log = LoggerFactory.getLogger(CreateOfferCodeBehind.class); private final CreateOfferPresenter presenter; @@ -69,7 +68,9 @@ public class CreateOfferCodeBehind extends CachedViewController @FXML private ValidatingTextField amountTextField, minAmountTextField, priceTextField, volumeTextField; @FXML private Button placeOfferButton, closeButton; - @FXML private TextField totalToPayTextField, collateralTextField, bankAccountTypeTextField, bankAccountCurrencyTextField, bankAccountCountyTextField, acceptedCountriesTextField, acceptedLanguagesTextField, + @FXML private TextField totalToPayTextField, collateralTextField, bankAccountTypeTextField, + bankAccountCurrencyTextField, bankAccountCountyTextField, acceptedCountriesTextField, + acceptedLanguagesTextField, feeLabel, transactionIdTextField; @FXML private ConfidenceProgressIndicator progressIndicator; @FXML private AddressTextField addressTextField; @@ -81,8 +82,7 @@ public class CreateOfferCodeBehind extends CachedViewController /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public CreateOfferCodeBehind(CreateOfferModel model) - { + public CreateOfferCodeBehind(CreateOfferModel model) { presenter = new CreateOfferPresenter(model); } @@ -92,23 +92,20 @@ public class CreateOfferCodeBehind extends CachedViewController /////////////////////////////////////////////////////////////////////////////////////////// @Override - public void initialize(URL url, ResourceBundle rb) - { + public void initialize(URL url, ResourceBundle rb) { super.initialize(url, rb); presenter.onViewInitialized(); } @Override - public void deactivate() - { + public void deactivate() { super.deactivate(); presenter.deactivate(); ((TradeController) parentController).onCreateOfferViewRemoved(); } @Override - public void activate() - { + public void activate() { super.activate(); presenter.activate(); @@ -129,8 +126,7 @@ public class CreateOfferCodeBehind extends CachedViewController // Public methods /////////////////////////////////////////////////////////////////////////////////////////// - public void setOrderBookFilter(OrderBookFilter orderBookFilter) - { + public void setOrderBookFilter(OrderBookFilter orderBookFilter) { presenter.setOrderBookFilter(orderBookFilter); } @@ -139,14 +135,12 @@ public class CreateOfferCodeBehind extends CachedViewController /////////////////////////////////////////////////////////////////////////////////////////// @FXML - public void onPlaceOffer() - { + public void onPlaceOffer() { presenter.placeOffer(); } @FXML - public void onClose() - { + public void onClose() { presenter.close(); TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent())); @@ -158,15 +152,19 @@ public class CreateOfferCodeBehind extends CachedViewController // Private Methods /////////////////////////////////////////////////////////////////////////////////////////// - private void setupListeners() - { - volumeTextField.focusedProperty().addListener((observableValue, oldValue, newValue) -> presenter.checkVolumeOnFocusOut(oldValue, newValue, volumeTextField.getText())); - amountTextField.focusedProperty().addListener((observableValue, oldValue, newValue) -> presenter.onFocusOutAmountTextField(oldValue, newValue)); - priceTextField.focusedProperty().addListener((observableValue, oldValue, newValue) -> presenter.onFocusOutPriceTextField(oldValue, newValue)); + private void setupListeners() { + volumeTextField.focusedProperty().addListener((observableValue, oldValue, + newValue) -> presenter.checkVolumeOnFocusOut(oldValue, + newValue, volumeTextField.getText())); + amountTextField.focusedProperty().addListener((observableValue, oldValue, + newValue) -> presenter.onFocusOutAmountTextField(oldValue, + newValue)); + priceTextField.focusedProperty().addListener((observableValue, oldValue, + newValue) -> presenter.onFocusOutPriceTextField(oldValue, + newValue)); presenter.validateInput.addListener((o, oldValue, newValue) -> { - if (newValue) - { + if (newValue) { amountTextField.reValidate(); minAmountTextField.reValidate(); volumeTextField.reValidate(); @@ -175,16 +173,15 @@ public class CreateOfferCodeBehind extends CachedViewController }); presenter.showVolumeAdjustedWarning.addListener((o, oldValue, newValue) -> { - if (newValue) - { - Popups.openWarningPopup("Warning", "The total volume you have entered leads to invalid fractional Bitcoin amounts.\nThe amount has been adjusted and a new total volume be calculated from it."); + if (newValue) { + Popups.openWarningPopup("Warning", "The total volume you have entered leads to invalid fractional " + + "Bitcoin amounts.\nThe amount has been adjusted and a new total volume be calculated from it."); volumeTextField.setText(presenter.volume.get()); } }); } - private void setupBindings() - { + private void setupBindings() { buyLabel.textProperty().bind(presenter.directionLabel); amountTextField.textProperty().bindBidirectional(presenter.amount); priceTextField.textProperty().bindBidirectional(presenter.price); @@ -221,8 +218,7 @@ public class CreateOfferCodeBehind extends CachedViewController .and(priceTextField.isValidProperty()).not());*/ } - private void setupTextFieldValidators() - { + private void setupTextFieldValidators() { /* BtcValidator amountValidator = new BtcValidator(); amountTextField.setNumberValidator(amountValidator); amountTextField.setErrorPopupLayoutReference((Region) amountTextField.getParent()); diff --git a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferModel.java b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferModel.java index 4e377ee3f5..63b9f2b3d9 100644 --- a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferModel.java +++ b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferModel.java @@ -59,8 +59,7 @@ import static com.google.common.base.Preconditions.checkArgument; * - Holds domain data * - Use Properties for bindable data */ -class CreateOfferModel -{ +class CreateOfferModel { private static final Logger log = LoggerFactory.getLogger(CreateOfferModel.class); private final TradeManager tradeManager; @@ -68,8 +67,7 @@ class CreateOfferModel private final Settings settings; private final User user; - String getOfferId() - { + String getOfferId() { return offerId; } @@ -106,8 +104,7 @@ class CreateOfferModel /////////////////////////////////////////////////////////////////////////////////////////// @Inject - CreateOfferModel(TradeManager tradeManager, WalletFacade walletFacade, Settings settings, User user) - { + CreateOfferModel(TradeManager tradeManager, WalletFacade walletFacade, Settings settings, User user) { this.tradeManager = tradeManager; this.walletFacade = walletFacade; this.settings = settings; @@ -115,7 +112,8 @@ class CreateOfferModel offerId = UUID.randomUUID().toString(); totalFeesAsCoin = FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE); - if (walletFacade != null && walletFacade.getWallet() != null) addressEntry = walletFacade.getAddressInfoByTradeID(offerId); + if (walletFacade != null && walletFacade.getWallet() != null) + addressEntry = walletFacade.getAddressInfoByTradeID(offerId); } @@ -123,13 +121,11 @@ class CreateOfferModel // Methods /////////////////////////////////////////////////////////////////////////////////////////// - void activate() - { + void activate() { collateralAsLong.set(settings.getCollateral()); BankAccount bankAccount = user.getCurrentBankAccount(); - if (bankAccount != null) - { + if (bankAccount != null) { bankAccountType.set(bankAccount.getBankAccountType().toString()); bankAccountCurrency.set(bankAccount.getCurrency().getCurrencyCode()); bankAccountCounty.set(bankAccount.getCountry().getName()); @@ -138,22 +134,21 @@ class CreateOfferModel acceptedLanguages.setAll(settings.getAcceptedLanguageLocales()); } - void placeOffer() - { + void placeOffer() { tradeManager.requestPlaceOffer(offerId, - direction, - priceAsFiat.value, - amountAsCoin, - minAmountAsCoin, - (transaction) -> { - requestPlaceOfferSuccess.set(true); - transactionId.set(transaction.getHashAsString()); - }, - (errorMessage) -> { - requestPlaceOfferFailed.set(true); - requestPlaceOfferErrorMessage.set(errorMessage); - } - ); + direction, + priceAsFiat.value, + amountAsCoin, + minAmountAsCoin, + (transaction) -> { + requestPlaceOfferSuccess.set(true); + transactionId.set(transaction.getHashAsString()); + }, + (errorMessage) -> { + requestPlaceOfferFailed.set(true); + requestPlaceOfferErrorMessage.set(errorMessage); + } + ); } @@ -161,13 +156,11 @@ class CreateOfferModel // Setter/Getter /////////////////////////////////////////////////////////////////////////////////////////// - Direction getDirection() - { + Direction getDirection() { return direction; } - void setDirection(Direction direction) - { + void setDirection(Direction direction) { // direction must not be changed once it is initially set checkArgument(this.direction == null); this.direction = direction; diff --git a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenter.java b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenter.java index 2fcc543fab..3e34ce1265 100644 --- a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenter.java +++ b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenter.java @@ -45,11 +45,12 @@ import static javafx.beans.binding.Bindings.createStringBinding; * Knows Model, does not know the View (CodeBehind) *

* - Holds data and state of the View (formatted) - * - Receive view input from Controller. Validates input, apply business logic, format to Presenter properties and convert input to Model. - * - Listen to updates from Model, apply business logic and format it to Presenter properties. Model update handling can be done via Binding. + * - Receive view input from Controller. Validates input, apply business logic, format to Presenter properties and + * convert input to Model. + * - Listen to updates from Model, apply business logic and format it to Presenter properties. Model update handling + * can be done via Binding. */ -class CreateOfferPresenter -{ +class CreateOfferPresenter { private static final Logger log = LoggerFactory.getLogger(CreateOfferPresenter.class); private CreateOfferModel model; @@ -83,8 +84,7 @@ class CreateOfferPresenter // Constructor /////////////////////////////////////////////////////////////////////////////////////////// - CreateOfferPresenter(CreateOfferModel model) - { + CreateOfferPresenter(CreateOfferModel model) { this.model = model; } @@ -93,35 +93,35 @@ class CreateOfferPresenter // Lifecycle /////////////////////////////////////////////////////////////////////////////////////////// - void onViewInitialized() - { + void onViewInitialized() { totalFeesLabel.set(BSFormatter.formatBtc(model.totalFeesAsCoin)); paymentLabel.set("Bitsquare trade (" + model.getOfferId() + ")"); - // address.set(model.addressEntry.getAddress().toString()); + // address.set(model.addressEntry.getAddress().toString()); setupInputListeners(); - collateralLabel.bind(Bindings.createStringBinding(() -> "Collateral (" + BSFormatter.formatCollateralPercent(model.collateralAsLong.get()) + "):", model.collateralAsLong)); - bankAccountType.bind(Bindings.createStringBinding(() -> Localisation.get(model.bankAccountType.get()), model.bankAccountType)); + collateralLabel.bind(Bindings.createStringBinding(() -> "Collateral (" + BSFormatter.formatCollateralPercent + (model.collateralAsLong.get()) + "):", model.collateralAsLong)); + bankAccountType.bind(Bindings.createStringBinding(() -> Localisation.get(model.bankAccountType.get()), + model.bankAccountType)); bankAccountCurrency.bind(model.bankAccountCurrency); bankAccountCounty.bind(model.bankAccountCounty); totalToPayAsCoin.bind(model.totalToPayAsCoin); - - model.acceptedCountries.addListener((Observable o) -> acceptedCountries.set(BSFormatter.countryLocalesToString(model.acceptedCountries))); - model.acceptedLanguages.addListener((Observable o) -> acceptedLanguages.set(BSFormatter.languageLocalesToString(model.acceptedLanguages))); + + model.acceptedCountries.addListener((Observable o) -> acceptedCountries.set(BSFormatter + .countryLocalesToString(model.acceptedCountries))); + model.acceptedLanguages.addListener((Observable o) -> acceptedLanguages.set(BSFormatter + .languageLocalesToString(model.acceptedLanguages))); } - void deactivate() - { + void deactivate() { } - void activate() - { + void activate() { model.activate(); - // totalToPay.addListener((ov) -> addressTextField.setAmountToPay(model.totalToPayAsCoin)); } @@ -130,8 +130,7 @@ class CreateOfferPresenter /////////////////////////////////////////////////////////////////////////////////////////// - void setOrderBookFilter(OrderBookFilter orderBookFilter) - { + void setOrderBookFilter(OrderBookFilter orderBookFilter) { // model model.setDirection(orderBookFilter.getDirection()); model.amountAsCoin = orderBookFilter.getAmount(); @@ -151,8 +150,7 @@ class CreateOfferPresenter // View Events /////////////////////////////////////////////////////////////////////////////////////////// - void placeOffer() - { + void placeOffer() { model.amountAsCoin = parseToCoin(amount.get()); model.minAmountAsCoin = parseToCoin(minAmount.get()); model.priceAsFiat = parseToFiat(price.get()); @@ -162,8 +160,7 @@ class CreateOfferPresenter //balanceTextField.getBalance() - if (inputValid()) - { + if (inputValid()) { model.placeOffer(); isPlaceOfferButtonDisabled.set(true); placeOfferButtonVisible.set(true); @@ -183,8 +180,7 @@ class CreateOfferPresenter } - void close() - { + void close() { } @@ -192,14 +188,12 @@ class CreateOfferPresenter // /////////////////////////////////////////////////////////////////////////////////////////// - private boolean inputValid() - { + private boolean inputValid() { //TODO return true; } - void setupInputListeners() - { + void setupInputListeners() { // bindBidirectional for amount, price, volume and minAmount amount.addListener(ov -> { @@ -225,25 +219,21 @@ class CreateOfferPresenter } - private void setVolume() - { + private void setVolume() { model.amountAsCoin = parseToCoin(amount.get()); model.priceAsFiat = parseToFiat(price.get()); - if (model.priceAsFiat != null && model.amountAsCoin != null && !model.amountAsCoin.isZero()) - { + if (model.priceAsFiat != null && model.amountAsCoin != null && !model.amountAsCoin.isZero()) { model.tradeVolumeAsFiat = new ExchangeRate(model.priceAsFiat).coinToFiat(model.amountAsCoin); volume.set(formatFiat(model.tradeVolumeAsFiat)); } } - private void setAmount() - { + private void setAmount() { model.tradeVolumeAsFiat = parseToFiat(volume.get()); model.priceAsFiat = parseToFiat(price.get()); - if (model.tradeVolumeAsFiat != null && model.priceAsFiat != null && !model.priceAsFiat.isZero()) - { + if (model.tradeVolumeAsFiat != null && model.priceAsFiat != null && !model.priceAsFiat.isZero()) { model.amountAsCoin = new ExchangeRate(model.priceAsFiat).fiatToCoin(model.tradeVolumeAsFiat); // If we got a btc value with more then 4 decimals we convert it to max 4 decimals @@ -254,31 +244,26 @@ class CreateOfferPresenter } } - private void setTotalToPay() - { + private void setTotalToPay() { setCollateral(); - if (model.collateralAsCoin != null) - { + if (model.collateralAsCoin != null) { model.totalToPayAsCoin.set(model.collateralAsCoin.add(model.totalFeesAsCoin)); - totalToPay.bind(createStringBinding(() -> formatBtcWithCode(model.totalToPayAsCoin.get()), model.totalToPayAsCoin)); + totalToPay.bind(createStringBinding(() -> formatBtcWithCode(model.totalToPayAsCoin.get()), + model.totalToPayAsCoin)); } } - private void setCollateral() - { - if (model.amountAsCoin != null) - { + private void setCollateral() { + if (model.amountAsCoin != null) { model.collateralAsCoin = model.amountAsCoin.multiply(model.collateralAsLong.get()).divide(1000); collateral.set(BSFormatter.formatBtcWithCode(model.collateralAsCoin)); } } // We adjust the volume if fractional coins result from volume/price division on focus out - void checkVolumeOnFocusOut(Boolean oldValue, Boolean newValue, String volumeTextFieldText) - { - if (oldValue && !newValue) - { + void checkVolumeOnFocusOut(Boolean oldValue, Boolean newValue, String volumeTextFieldText) { + if (oldValue && !newValue) { setVolume(); if (!formatFiat(parseToFiat(volumeTextFieldText)).equals(volume.get())) showVolumeAdjustedWarning.set(true); @@ -291,15 +276,13 @@ class CreateOfferPresenter amountTextField.reValidate();*/ } - void onFocusOutAmountTextField(Boolean oldValue, Boolean newValue) - { + void onFocusOutAmountTextField(Boolean oldValue, Boolean newValue) { // only on focus out and ignore focus loss from window /* if (!newValue && amountTextField.getScene() != null && amountTextField.getScene().getWindow().isFocused()) volumeTextField.reValidate();*/ } - void onFocusOutPriceTextField(Boolean oldValue, Boolean newValue) - { + void onFocusOutPriceTextField(Boolean oldValue, Boolean newValue) { // only on focus out and ignore focus loss from window /* if (!newValue && priceTextField.getScene() != null && priceTextField.getScene().getWindow().isFocused()) volumeTextField.reValidate();*/ diff --git a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml index 55f4b13480..32ca4dbed8 100644 --- a/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml +++ b/src/main/java/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml @@ -20,11 +20,11 @@ - - + + + - = 0) { Dialogs.CommandLink settingsCommandLink = new Dialogs.CommandLink("Open settings", - "You need to configure your settings before you can actively trade."); + "You need to configure your settings before you can actively trade."); Dialogs.CommandLink depositFeeCommandLink = new Dialogs.CommandLink("Deposit funds", - "You need to pay the registration fee before you can actively trade. That is needed as prevention" + - " against fraud."); + "You need to pay the registration fee before you can actively trade. That is needed as prevention" + + " against fraud."); Dialogs.CommandLink sendRegistrationCommandLink = new Dialogs.CommandLink("Publish registration", - "When settings are configured and the fee deposit is done your registration transaction will be " + - "published to " - + "the Bitcoin \nnetwork."); + "When settings are configured and the fee deposit is done your registration transaction will be " + + "published to " + + "the Bitcoin \nnetwork."); List commandLinks = Arrays.asList(settingsCommandLink, depositFeeCommandLink, - sendRegistrationCommandLink); + sendRegistrationCommandLink); Action registrationMissingAction = Popups.openRegistrationMissingPopup("Not registered yet", - "Please follow these steps:", - "You need to register before you can place an offer.", - commandLinks, - selectedIndex); + "Please follow these steps:", + "You need to register before you can place an offer.", + commandLinks, + selectedIndex); if (registrationMissingAction == settingsCommandLink) { MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.SETTINGS); } @@ -371,7 +371,7 @@ public class OrderBookController extends CachedViewController { orderBook.applyFilter(orderBookFilter); priceColumn.setSortType((orderBookFilter.getDirection() == Direction.BUY) ? - TableColumn.SortType.ASCENDING : TableColumn.SortType.DESCENDING); + TableColumn.SortType.ASCENDING : TableColumn.SortType.DESCENDING); orderBookTable.sort(); if (orderBookTable.getItems() != null) { @@ -487,8 +487,8 @@ public class OrderBookController extends CachedViewController { } catch (Exception e) { log.warn("Country icon not found: /images/countries/" + - country.getCode().toLowerCase() + ".png country name: " + - country.getName()); + country.getCode().toLowerCase() + ".png country name: " + + country.getName()); } Tooltip.install(this, new Tooltip(country.getName())); } diff --git a/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml b/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml index 7312c23897..85ce0d8c9f 100644 --- a/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml +++ b/src/main/java/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml @@ -17,11 +17,10 @@ ~ along with Bitsquare. If not, see . --> - + - + - - 0); input = input.replace(",", ".").trim(); return Double.parseDouble(input); - } catch (Exception e) - { + } catch (Exception e) { return 0; } } - public static String formatDirection(Direction direction, boolean allUpperCase) - { + public static String formatDirection(Direction direction, boolean allUpperCase) { String result = (direction == Direction.BUY) ? "Buy" : "Sell"; - if (allUpperCase) - { + if (allUpperCase) { result = result.toUpperCase(); } return result; } - public static String formatDouble(double value) - { + public static String formatDouble(double value) { return formatDouble(value, 4); } - public static String formatDouble(double value, int fractionDigits) - { + public static String formatDouble(double value, int fractionDigits) { DecimalFormat decimalFormat = getDecimalFormat(fractionDigits); return decimalFormat.format(value); } - public static DecimalFormat getDecimalFormat(int fractionDigits) - { + public static DecimalFormat getDecimalFormat(int fractionDigits) { DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(locale); decimalFormat.setMinimumFractionDigits(fractionDigits); decimalFormat.setMaximumFractionDigits(fractionDigits); @@ -222,32 +192,26 @@ public class BSFormatter return decimalFormat; } - public static String countryLocalesToString(List countries) - { + public static String countryLocalesToString(List countries) { String result = ""; int i = 0; - for (Country country : countries) - { + for (Country country : countries) { result += country.getName(); i++; - if (i < countries.size()) - { + if (i < countries.size()) { result += ", "; } } return result; } - public static String languageLocalesToString(List languageLocales) - { + public static String languageLocalesToString(List languageLocales) { String result = ""; int i = 0; - for (Locale locale : languageLocales) - { + for (Locale locale : languageLocales) { result += locale.getDisplayLanguage(); i++; - if (i < languageLocales.size()) - { + if (i < languageLocales.size()) { result += ", "; } } @@ -255,16 +219,13 @@ public class BSFormatter } - public static String arbitrationMethodsToString(List items) - { + public static String arbitrationMethodsToString(List items) { String result = ""; int i = 0; - for (Arbitrator.METHOD item : items) - { + for (Arbitrator.METHOD item : items) { result += Localisation.get(item.toString()); i++; - if (i < items.size()) - { + if (i < items.size()) { result += ", "; } } @@ -272,62 +233,52 @@ public class BSFormatter } - public static String arbitrationIDVerificationsToString(List items) - { + public static String arbitrationIDVerificationsToString(List items) { String result = ""; int i = 0; - for (Arbitrator.ID_VERIFICATION item : items) - { + for (Arbitrator.ID_VERIFICATION item : items) { result += Localisation.get(item.toString()); i++; - if (i < items.size()) - { + if (i < items.size()) { result += ", "; } } return result; } - public static String formatDateTime(Date date) - { + public static String formatDateTime(Date date) { DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, locale); DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, locale); return dateFormatter.format(date) + " " + timeFormatter.format(date); } - public static String formatCollateralPercent(long collateral) - { + public static String formatCollateralPercent(long collateral) { return getDecimalFormat(1).format(collateral / 10) + " %"; } @Deprecated - public static String formatPrice(double volume) - { + public static String formatPrice(double volume) { return formatDouble(volume); } @Deprecated - public static String formatVolume(double volume) - { + public static String formatVolume(double volume) { return formatDouble(volume); } @Deprecated - public static String formatVolumeWithMinVolume(double volume, double minVolume) - { + public static String formatVolumeWithMinVolume(double volume, double minVolume) { return formatDouble(volume) + " (" + formatDouble(minVolume) + ")"; } @Deprecated - public static String formatCoin(Coin coin) - { + public static String formatCoin(Coin coin) { return coin != null ? coin.toPlainString() : ""; } @Deprecated - public static String formatCoinWithCode(Coin coin) - { + public static String formatCoinWithCode(Coin coin) { return coin != null ? coin.toFriendlyString() : ""; } } diff --git a/src/main/java/io/bitsquare/gui/util/BtcValidator.java b/src/main/java/io/bitsquare/gui/util/BtcValidator.java index 75dc8bebbb..2d836cb871 100644 --- a/src/main/java/io/bitsquare/gui/util/BtcValidator.java +++ b/src/main/java/io/bitsquare/gui/util/BtcValidator.java @@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory; /** * BtcValidator for validating BTC values. - *

+ *

* That class implements just what we need for the moment. It is not intended as a general purpose library class. */ public class BtcValidator extends NumberValidator { diff --git a/src/main/java/io/bitsquare/gui/util/FiatValidator.java b/src/main/java/io/bitsquare/gui/util/FiatValidator.java index 8e44838c14..cd0c1a01de 100644 --- a/src/main/java/io/bitsquare/gui/util/FiatValidator.java +++ b/src/main/java/io/bitsquare/gui/util/FiatValidator.java @@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory; /** * FiatNumberValidator for validating fiat values. - *

+ *

* That class implements just what we need for the moment. It is not intended as a general purpose library class. */ public class FiatValidator extends NumberValidator { diff --git a/src/main/java/io/bitsquare/gui/util/NumberValidator.java b/src/main/java/io/bitsquare/gui/util/NumberValidator.java index d8f671c1dd..e5597ddd1b 100644 --- a/src/main/java/io/bitsquare/gui/util/NumberValidator.java +++ b/src/main/java/io/bitsquare/gui/util/NumberValidator.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; * 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. - *

+ *

* That class implements just what we need for the moment. It is not intended as a general purpose library class. */ public abstract class NumberValidator { diff --git a/src/main/java/io/bitsquare/locale/Localisation.java b/src/main/java/io/bitsquare/locale/Localisation.java index 6f8f794465..0a88d8038a 100644 --- a/src/main/java/io/bitsquare/locale/Localisation.java +++ b/src/main/java/io/bitsquare/locale/Localisation.java @@ -46,7 +46,7 @@ public class Localisation { public static String get(String key) { if (key == null) return ""; - + try { return Localisation.getResourceBundle().getString(key); } catch (MissingResourceException e) { diff --git a/src/main/java/io/bitsquare/msg/MessageFacade.java b/src/main/java/io/bitsquare/msg/MessageFacade.java index 28e23a5653..4d0de8f905 100644 --- a/src/main/java/io/bitsquare/msg/MessageFacade.java +++ b/src/main/java/io/bitsquare/msg/MessageFacade.java @@ -67,7 +67,7 @@ import org.slf4j.LoggerFactory; * It is the translating domain specific functionality to the messaging layer. * The TomP2P library codebase shall not be used outside that facade. * That way we limit the dependency of the TomP2P library only to that class (and it's sub components). - *

+ *

* TODO: improve callbacks that Platform.runLater is not necessary. We call usually that methods form teh UI thread. */ public class MessageFacade implements MessageBroker { diff --git a/src/main/java/io/bitsquare/trade/protocol/offerer/ProtocolForOffererAsBuyer.java b/src/main/java/io/bitsquare/trade/protocol/offerer/ProtocolForOffererAsBuyer.java index e1ea294982..4a97445417 100644 --- a/src/main/java/io/bitsquare/trade/protocol/offerer/ProtocolForOffererAsBuyer.java +++ b/src/main/java/io/bitsquare/trade/protocol/offerer/ProtocolForOffererAsBuyer.java @@ -50,9 +50,9 @@ import static io.bitsquare.util.Validator.*; /** * Responsible for the correct execution of the sequence of tasks, message passing to the peer and message processing * from the peer. - *

+ *

* This class handles the role of the offerer as the Bitcoin buyer. - *

+ *

* It uses sub tasks to not pollute the main class too much with all the async result/fault handling. * Any data from incoming messages need to be validated before further processing. */ diff --git a/src/test/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenterTest.java b/src/test/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenterTest.java index 3cc189ecd6..717b499d20 100644 --- a/src/test/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenterTest.java +++ b/src/test/java/io/bitsquare/gui/trade/createoffer/CreateOfferPresenterTest.java @@ -33,13 +33,11 @@ import org.slf4j.LoggerFactory; import static org.junit.Assert.*; -public class CreateOfferPresenterTest -{ +public class CreateOfferPresenterTest { private static final Logger log = LoggerFactory.getLogger(CreateOfferPresenterTest.class); @Test - public void testBindings() - { + public void testBindings() { CreateOfferModel model = new CreateOfferModel(null, null, null, null); BSFormatter.setLocale(Locale.US); @@ -54,7 +52,7 @@ public class CreateOfferPresenterTest assertEquals(Coin.COIN, model.amountAsCoin); assertEquals(Fiat.valueOf("EUR", 500 * 10000), model.priceAsFiat); assertEquals(Fiat.valueOf("EUR", 500 * 10000), model.tradeVolumeAsFiat); - assertEquals(Coin.parseCoin("0.1011"), model.totalToPayAsCoin); + assertEquals(Coin.parseCoin("0.1011"), model.totalToPayAsCoin.get()); presenter.price.set("500"); presenter.volume.set("500");