mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-03-15 10:26:37 -04:00
Adjust line wrapping by hand
This commit is contained in:
parent
1ad1d318e8
commit
a3c4df8dc3
@ -82,8 +82,8 @@ public class BitSquare extends Application {
|
||||
Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> Popups.handleUncaughtExceptions
|
||||
(Throwables.getRootCause(throwable)));
|
||||
|
||||
StorageDirectory.setStorageDirectory(new File(StorageDirectory.getApplicationDirectory().getCanonicalPath() +
|
||||
"/data"));
|
||||
StorageDirectory.setStorageDirectory(
|
||||
new File(StorageDirectory.getApplicationDirectory().getCanonicalPath() + "/data"));
|
||||
|
||||
// currently there is not SystemTray support for java fx (planned for version 3) so we use the old AWT
|
||||
AWTSystemTray.createSystemTray(primaryStage);
|
||||
@ -110,8 +110,8 @@ public class BitSquare extends Application {
|
||||
|
||||
GuiceFXMLLoader.setInjector(injector);
|
||||
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.MAIN.getFxmlUrl()),
|
||||
false);
|
||||
final GuiceFXMLLoader loader =
|
||||
new GuiceFXMLLoader(getClass().getResource(NavigationItem.MAIN.getFxmlUrl()), false);
|
||||
final Parent view = loader.load();
|
||||
final Scene scene = new Scene(view, 1000, 750);
|
||||
scene.getStylesheets().setAll(getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm());
|
||||
|
@ -42,8 +42,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.
|
||||
* <p/>
|
||||
* TODO: Alternative bootstrap methods will follow later (save locally list of known nodes reported form other peers,
|
||||
* ...)
|
||||
* TODO: Alternative bootstrap methods will follow later (save locally list of known nodes reported form other peers...)
|
||||
*/
|
||||
public class SeedNode extends Thread {
|
||||
private static final Logger log = LoggerFactory.getLogger(SeedNode.class);
|
||||
@ -109,8 +108,8 @@ public class SeedNode extends Thread {
|
||||
public Peer startupPeer() {
|
||||
Peer peer = null;
|
||||
try {
|
||||
peer = new PeerBuilder(Number160.createHash(seedNodeAddress.getId())).ports(seedNodeAddress.getPort())
|
||||
.start();
|
||||
peer = new PeerBuilder(
|
||||
Number160.createHash(seedNodeAddress.getId())).ports(seedNodeAddress.getPort()).start();
|
||||
|
||||
// Need to add all features the clients will use (otherwise msg type is UNKNOWN_ID)
|
||||
new PeerBuilderDHT(peer).start();
|
||||
|
@ -171,7 +171,7 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
|
||||
confidence.getSource().equals(TransactionConfidence.Source.SELF) &&
|
||||
// In regtest mode we expect to have only one peer, so we won't see transactions propagate.
|
||||
// TODO: The value 1 below dates from a time when transactions we broadcast *to* were
|
||||
counted, set to 0
|
||||
// counted, set to 0
|
||||
(confidence.numBroadcastPeers() > 1 || tx.getParams() == RegTestParams.get());
|
||||
}
|
||||
*/
|
||||
|
@ -41,8 +41,8 @@ public class FeePolicy {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
//TODO other users or dev address? use donation option list? (dev, other users, wikileaks, tor,
|
||||
// sub projects (bitcoinj, tomp2p,...)...)
|
||||
//TODO other users or dev address? use donation option list?
|
||||
// (dev, other users, wikileaks, tor, sub projects (bitcoinj, tomp2p,...)...)
|
||||
|
||||
public Address getAddressForRegistrationFee() {
|
||||
try {
|
||||
|
@ -200,8 +200,8 @@ public class WalletFacade {
|
||||
List<AddressEntry> persistedAddressEntryList = (List<AddressEntry>) serializable;
|
||||
if (serializable instanceof List) {
|
||||
for (AddressEntry persistedAddressEntry : persistedAddressEntryList) {
|
||||
persistedAddressEntry.setDeterministicKey((DeterministicKey) wallet.findKeyFromPubHash
|
||||
(persistedAddressEntry.getPubKeyHash()));
|
||||
persistedAddressEntry.setDeterministicKey(
|
||||
(DeterministicKey) wallet.findKeyFromPubHash(persistedAddressEntry.getPubKeyHash()));
|
||||
}
|
||||
addressEntryList = persistedAddressEntryList;
|
||||
registrationAddressEntry = addressEntryList.get(0);
|
||||
@ -279,8 +279,8 @@ public class WalletFacade {
|
||||
}
|
||||
|
||||
public AddressEntry getAddressInfoByTradeID(String offerId) {
|
||||
Optional<AddressEntry> addressEntry = getAddressEntryList().stream().filter(e -> offerId.equals(e.getOfferId
|
||||
())).findFirst();
|
||||
Optional<AddressEntry> addressEntry = getAddressEntryList().stream().filter(e ->
|
||||
offerId.equals(e.getOfferId())).findFirst();
|
||||
|
||||
if (addressEntry.isPresent())
|
||||
return addressEntry.get();
|
||||
@ -318,8 +318,8 @@ public class WalletFacade {
|
||||
List<TransactionConfidence> transactionConfidenceList = new ArrayList<>();
|
||||
Set<Transaction> transactions = wallet.getTransactions(true);
|
||||
if (transactions != null) {
|
||||
transactionConfidenceList.addAll(transactions.stream().map(tx -> getTransactionConfidence(tx,
|
||||
address)).collect(Collectors.toList()));
|
||||
transactionConfidenceList.addAll(transactions.stream().map(tx ->
|
||||
getTransactionConfidence(tx, address)).collect(Collectors.toList()));
|
||||
/* same as:
|
||||
for (Transaction tx : transactions)
|
||||
{
|
||||
@ -345,8 +345,8 @@ public class WalletFacade {
|
||||
List<TransactionOutput> mergedOutputs = getOutputsWithConnectedOutputs(tx);
|
||||
List<TransactionConfidence> transactionConfidenceList = new ArrayList<>();
|
||||
|
||||
mergedOutputs.stream().filter(e -> e.getScriptPubKey().isSentToAddress() || e.getScriptPubKey().isSentToP2SH
|
||||
()).forEach(transactionOutput -> {
|
||||
mergedOutputs.stream().filter(e -> e.getScriptPubKey().isSentToAddress() ||
|
||||
e.getScriptPubKey().isSentToP2SH()).forEach(transactionOutput -> {
|
||||
Address outputAddress = transactionOutput.getScriptPubKey().getToAddress(params);
|
||||
if (address.equals(outputAddress)) {
|
||||
transactionConfidenceList.add(tx.getConfidence());
|
||||
@ -356,8 +356,8 @@ public class WalletFacade {
|
||||
same as:
|
||||
for (TransactionOutput transactionOutput : mergedOutputs)
|
||||
{
|
||||
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey()
|
||||
.isSentToP2SH())
|
||||
if (transactionOutput.getScriptPubKey().isSentToAddress() ||
|
||||
transactionOutput.getScriptPubKey().isSentToP2SH())
|
||||
{
|
||||
Address outputAddress = transactionOutput.getScriptPubKey().getToAddress(params);
|
||||
if (address.equals(outputAddress))
|
||||
@ -398,8 +398,8 @@ public class WalletFacade {
|
||||
if (transactionConfidence == null ||
|
||||
confidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType.PENDING) ||
|
||||
(confidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType.BUILDING) &&
|
||||
transactionConfidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType
|
||||
.BUILDING) &&
|
||||
transactionConfidence.getConfidenceType().equals(
|
||||
TransactionConfidence.ConfidenceType.BUILDING) &&
|
||||
confidence.getDepthInBlocks() < transactionConfidence.getDepthInBlocks())) {
|
||||
transactionConfidence = confidence;
|
||||
}
|
||||
@ -415,8 +415,8 @@ public class WalletFacade {
|
||||
if (getRegistrationAddressEntry() != null) {
|
||||
transactionConfidence = getConfidenceForAddress(getRegistrationAddressEntry().getAddress());
|
||||
}
|
||||
return transactionConfidence != null && transactionConfidence.getConfidenceType().equals
|
||||
(TransactionConfidence.ConfidenceType.BUILDING);
|
||||
return transactionConfidence != null &&
|
||||
transactionConfidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType.BUILDING);
|
||||
}
|
||||
|
||||
|
||||
@ -507,12 +507,13 @@ public class WalletFacade {
|
||||
|
||||
Transaction tx = new Transaction(params);
|
||||
|
||||
byte[] data = cryptoFacade.getEmbeddedAccountRegistrationData(getRegistrationAddressEntry().getKey(),
|
||||
stringifiedBankAccounts);
|
||||
byte[] data = cryptoFacade.getEmbeddedAccountRegistrationData(
|
||||
getRegistrationAddressEntry().getKey(), stringifiedBankAccounts);
|
||||
tx.addOutput(Transaction.MIN_NONDUST_OUTPUT, new ScriptBuilder().op(OP_RETURN).data(data).build());
|
||||
|
||||
Coin fee = FeePolicy.ACCOUNT_REGISTRATION_FEE.subtract(Transaction.MIN_NONDUST_OUTPUT).subtract(FeePolicy
|
||||
.TX_FEE);
|
||||
Coin fee = FeePolicy.ACCOUNT_REGISTRATION_FEE
|
||||
.subtract(Transaction.MIN_NONDUST_OUTPUT)
|
||||
.subtract(FeePolicy.TX_FEE);
|
||||
log.trace("fee: " + fee.toFriendlyString());
|
||||
tx.addOutput(fee, feePolicy.getAddressForRegistrationFee());
|
||||
|
||||
@ -842,16 +843,14 @@ public class WalletFacade {
|
||||
log.trace("offerersFirstTx = " + offerersFirstTx);
|
||||
|
||||
// add input
|
||||
Transaction offerersFirstTxConnOut = wallet.getTransaction(offerersFirstTx.getInput(0).getOutpoint().getHash
|
||||
()); // pass that around!
|
||||
TransactionOutPoint offerersFirstTxOutPoint = new TransactionOutPoint(params, offererTxOutIndex,
|
||||
offerersFirstTxConnOut);
|
||||
Transaction offerersFirstTxConnOut = wallet.getTransaction(offerersFirstTx.getInput(0).getOutpoint().getHash());
|
||||
TransactionOutPoint offerersFirstTxOutPoint =
|
||||
new TransactionOutPoint(params, offererTxOutIndex, offerersFirstTxConnOut);
|
||||
//TransactionInput offerersFirstTxInput = new TransactionInput(params, tx,
|
||||
// offerersFirstTx.getInput(0).getScriptBytes(), offerersFirstTxOutPoint); // pass that around!
|
||||
// getScriptBytes =
|
||||
// empty bytes array
|
||||
TransactionInput offerersFirstTxInput = new TransactionInput(params, tx, new byte[]{},
|
||||
offerersFirstTxOutPoint); // pass that around! getScriptBytes = empty bytes array
|
||||
TransactionInput offerersFirstTxInput = new TransactionInput(params, tx, new byte[]{}, offerersFirstTxOutPoint);
|
||||
offerersFirstTxInput.setParent(tx);
|
||||
tx.addInput(offerersFirstTxInput);
|
||||
|
||||
@ -863,10 +862,10 @@ public class WalletFacade {
|
||||
|
||||
// add input
|
||||
Transaction takersSignedTxConnOut = new Transaction(params, Utils.parseAsHexOrBase58(takersSignedConnOutAsHex));
|
||||
TransactionOutPoint takersSignedTxOutPoint = new TransactionOutPoint(params, takerTxOutIndex,
|
||||
takersSignedTxConnOut);
|
||||
TransactionInput takersSignedTxInput = new TransactionInput(params, tx,
|
||||
Utils.parseAsHexOrBase58(takersSignedScriptSigAsHex), takersSignedTxOutPoint);
|
||||
TransactionOutPoint takersSignedTxOutPoint =
|
||||
new TransactionOutPoint(params, takerTxOutIndex, takersSignedTxConnOut);
|
||||
TransactionInput takersSignedTxInput = new TransactionInput(
|
||||
params, tx, Utils.parseAsHexOrBase58(takersSignedScriptSigAsHex), takersSignedTxOutPoint);
|
||||
takersSignedTxInput.setParent(tx);
|
||||
tx.addInput(takersSignedTxInput);
|
||||
|
||||
@ -965,8 +964,8 @@ public class WalletFacade {
|
||||
Coin offererPaybackAmount,
|
||||
Coin takerPaybackAmount,
|
||||
String takerAddress,
|
||||
String tradeID) throws
|
||||
AddressFormatException {
|
||||
String tradeID)
|
||||
throws AddressFormatException {
|
||||
log.debug("offererCreatesAndSignsPayoutTx");
|
||||
log.trace("inputs: ");
|
||||
log.trace("depositTxID=" + depositTxID);
|
||||
@ -1028,8 +1027,8 @@ public class WalletFacade {
|
||||
ECKey.ECDSASignature takerSignature = getAddressInfoByTradeID(tradeID).getKey().sign(sigHash);
|
||||
TransactionSignature takerTxSig = new TransactionSignature(takerSignature, Transaction.SigHash.ALL, false);
|
||||
|
||||
ECKey.ECDSASignature offererSignature = new ECKey.ECDSASignature(new BigInteger(offererSignatureR),
|
||||
new BigInteger(offererSignatureS));
|
||||
ECKey.ECDSASignature offererSignature =
|
||||
new ECKey.ECDSASignature(new BigInteger(offererSignatureR), new BigInteger(offererSignatureS));
|
||||
TransactionSignature offererTxSig = new TransactionSignature(offererSignature, Transaction.SigHash.ALL, false);
|
||||
|
||||
Script inputScript = ScriptBuilder.createMultiSigInputScript(ImmutableList.of(offererTxSig, takerTxSig));
|
||||
|
@ -70,8 +70,8 @@ public class CryptoFacade {
|
||||
|
||||
public byte[] getEmbeddedAccountRegistrationData(ECKey registrationKey, String stringifiedBankAccounts) {
|
||||
String signedBankAccountIDs = signMessage(registrationKey, stringifiedBankAccounts, null);
|
||||
return Utils.sha256hash160(concatenateChunks(stringifiedBankAccounts, signedBankAccountIDs).getBytes(Charsets
|
||||
.UTF_8));
|
||||
return Utils.sha256hash160(
|
||||
concatenateChunks(stringifiedBankAccounts, signedBankAccountIDs).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
||||
public String signContract(ECKey key, String contractAsJson) {
|
||||
|
@ -74,8 +74,8 @@ public class BitSquareModule extends AbstractModule {
|
||||
|
||||
// bind(Boolean.class).annotatedWith(Names.named("useDiskStorage")).toInstance(new Boolean(true));
|
||||
bind(Boolean.class).annotatedWith(Names.named("useDiskStorage")).toInstance(new Boolean(false));
|
||||
bind(SeedNodeAddress.StaticSeedNodeAddresses.class).annotatedWith(Names.named("defaultSeedNode")).toInstance
|
||||
(SeedNodeAddress.StaticSeedNodeAddresses.LOCALHOST);
|
||||
bind(SeedNodeAddress.StaticSeedNodeAddresses.class).annotatedWith(
|
||||
Names.named("defaultSeedNode")).toInstance(SeedNodeAddress.StaticSeedNodeAddresses.LOCALHOST);
|
||||
// bind(SeedNodeAddress.StaticSeedNodeAddresses.class).annotatedWith(Names.named("defaultSeedNode"))
|
||||
// .toInstance(SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN);
|
||||
}
|
||||
|
@ -57,12 +57,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Holds the splash screen and the application views.
|
||||
* It builds up all the views and initializes the facades.
|
||||
* We use a sequence of Platform.runLater cascaded calls to make the startup more smooth,
|
||||
* otherwise the rendering is frozen for too long.
|
||||
* Pre-loading of views is not implemented yet, and after a quick test it seemed that it does not give much
|
||||
* improvements.
|
||||
* Holds the splash screen and the application views. It builds up all the views and initializes the facades.
|
||||
* We use a sequence of Platform.runLater cascaded calls to make the startup more smooth, otherwise the rendering is
|
||||
* frozen for too long. Pre-loading of views is not implemented yet, and after a quick test it seemed that it does not
|
||||
* give much improvements.
|
||||
*/
|
||||
public class MainController extends ViewController {
|
||||
private static final Logger log = LoggerFactory.getLogger(MainController.class);
|
||||
@ -282,11 +280,9 @@ public class MainController extends ViewController {
|
||||
|
||||
user.getBankAccountsSizeProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
if ((int) newValue == 2)
|
||||
viewBuilder.rightNavPane.getChildren().add(1, accountComboBoxHolder);// accountComboBoxHolder
|
||||
// .setVisible(true);
|
||||
viewBuilder.rightNavPane.getChildren().add(1, accountComboBoxHolder);
|
||||
else if ((int) newValue < 2)
|
||||
viewBuilder.rightNavPane.getChildren().remove(accountComboBoxHolder);//accountComboBoxHolder
|
||||
// .setVisible(false);
|
||||
viewBuilder.rightNavPane.getChildren().remove(accountComboBoxHolder);
|
||||
});
|
||||
|
||||
settingsButton = addNavButton(viewBuilder.rightNavPane, "Settings", NavigationItem.SETTINGS);
|
||||
@ -387,8 +383,8 @@ public class MainController extends ViewController {
|
||||
}
|
||||
|
||||
private void addAccountComboBox(Pane parent) {
|
||||
final ComboBox<BankAccount> accountComboBox = new ComboBox<>(FXCollections.observableArrayList(user
|
||||
.getBankAccounts()));
|
||||
final ComboBox<BankAccount> accountComboBox =
|
||||
new ComboBox<>(FXCollections.observableArrayList(user.getBankAccounts()));
|
||||
accountComboBox.setId("nav-account-combo-box");
|
||||
accountComboBox.setLayoutY(12);
|
||||
if (user.getCurrentBankAccount() != null)
|
||||
@ -406,8 +402,8 @@ public class MainController extends ViewController {
|
||||
}
|
||||
});
|
||||
|
||||
user.getSelectedBankAccountIndexProperty().addListener(observable -> accountComboBox.getSelectionModel()
|
||||
.select(user.getCurrentBankAccount()));
|
||||
user.getSelectedBankAccountIndexProperty().addListener(observable ->
|
||||
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
|
||||
|
@ -133,8 +133,8 @@ public class ArbitratorProfileController extends CachedViewController {
|
||||
arbitrationFeeTextField.setText(String.valueOf(arbitrator.getArbitrationFee()) + " % (Min. " + String
|
||||
.valueOf(arbitrator.getMinArbitrationFee()) + " BTC)");
|
||||
methodsTextField.setText(BitSquareFormatter.arbitrationMethodsToString(arbitrator.getArbitrationMethods()));
|
||||
idVerificationsTextField.setText(BitSquareFormatter.arbitrationIDVerificationsToString(arbitrator
|
||||
.getIdVerifications()));
|
||||
idVerificationsTextField.setText(
|
||||
BitSquareFormatter.arbitrationIDVerificationsToString(arbitrator.getIdVerifications()));
|
||||
webPageTextField.setText(arbitrator.getWebUrl());
|
||||
descriptionTextArea.setText(arbitrator.getDescription());
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
}
|
||||
});
|
||||
|
||||
idTypeComboBox.setItems(FXCollections.observableArrayList(new ArrayList<>(EnumSet.allOf(Arbitrator.ID_TYPE
|
||||
.class))));
|
||||
idTypeComboBox.setItems(FXCollections.observableArrayList(
|
||||
new ArrayList<>(EnumSet.allOf(Arbitrator.ID_TYPE.class))));
|
||||
idTypeComboBox.setConverter(new StringConverter<Arbitrator.ID_TYPE>() {
|
||||
|
||||
@Override
|
||||
@ -170,8 +170,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
}
|
||||
});
|
||||
|
||||
idVerificationsComboBox.setItems(FXCollections.observableArrayList(new ArrayList<>(EnumSet.allOf(Arbitrator
|
||||
.ID_VERIFICATION.class))));
|
||||
idVerificationsComboBox.setItems(
|
||||
FXCollections.observableArrayList(new ArrayList<>(EnumSet.allOf(Arbitrator.ID_VERIFICATION.class))));
|
||||
idVerificationsComboBox.setConverter(new StringConverter<Arbitrator.ID_VERIFICATION>() {
|
||||
|
||||
@Override
|
||||
@ -300,8 +300,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
if (idVerification != null) {
|
||||
if (!idVerificationList.contains(idVerification)) {
|
||||
idVerificationList.add(idVerification);
|
||||
idVerificationsTextField.setText(BitSquareFormatter.arbitrationIDVerificationsToString
|
||||
(idVerificationList));
|
||||
idVerificationsTextField.setText(
|
||||
BitSquareFormatter.arbitrationIDVerificationsToString(idVerificationList));
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,19 +342,16 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void setupPayCollateralScreen() {
|
||||
infoLabel.setText("You need to pay 10 x the max. trading volume as collateral.\n\n" +
|
||||
"That payment will be locked into a MultiSig fund and be refunded when you leave the arbitration pool" +
|
||||
".\n" +
|
||||
"In case of fraud (collusion, not fulfilling the min. dispute quality requirements) you will lose " +
|
||||
"your collateral.\n" +
|
||||
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\n" +
|
||||
"Please pay in " + arbitrator.getMaxTradeVolume() * 10 + " BTC");
|
||||
"resolution.\n\nPlease pay in " + arbitrator.getMaxTradeVolume() * 10 + " BTC");
|
||||
|
||||
|
||||
String collateralAddress = walletFacade.getRegistrationAddressEntry() != null ? walletFacade
|
||||
.getRegistrationAddressEntry().toString() : "";
|
||||
String collateralAddress = walletFacade.getRegistrationAddressEntry() != null ?
|
||||
walletFacade.getRegistrationAddressEntry().toString() : "";
|
||||
collateralAddressTextField.setText(collateralAddress);
|
||||
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
@ -365,8 +362,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
clipboard.setContent(content);
|
||||
});
|
||||
|
||||
confidenceDisplay = new ConfidenceDisplay(walletFacade.getWallet(), confirmationLabel, balanceTextField,
|
||||
progressIndicator);
|
||||
confidenceDisplay = new ConfidenceDisplay(
|
||||
walletFacade.getWallet(), confirmationLabel, balanceTextField, progressIndicator);
|
||||
paymentDoneButton.setDisable(walletFacade.getArbitratorDepositBalance().isZero());
|
||||
log.debug("getArbitratorDepositBalance " + walletFacade.getArbitratorDepositBalance());
|
||||
walletFacade.getWallet().addEventListener(new WalletEventListener() {
|
||||
@ -432,8 +429,8 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
arbitrationFeeTextField.setText(String.valueOf(arbitrator.getArbitrationFee()));
|
||||
minArbitrationFeeTextField.setText(String.valueOf(arbitrator.getMinArbitrationFee()));
|
||||
methodsTextField.setText(BitSquareFormatter.arbitrationMethodsToString(arbitrator.getArbitrationMethods()));
|
||||
idVerificationsTextField.setText(BitSquareFormatter.arbitrationIDVerificationsToString(arbitrator
|
||||
.getIdVerifications()));
|
||||
idVerificationsTextField.setText(
|
||||
BitSquareFormatter.arbitrationIDVerificationsToString(arbitrator.getIdVerifications()));
|
||||
webPageTextField.setText(arbitrator.getWebUrl());
|
||||
descriptionTextArea.setText(arbitrator.getDescription());
|
||||
|
||||
@ -447,13 +444,11 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
|
||||
private Arbitrator getEditedArbitrator() {
|
||||
try {
|
||||
BitSquareValidator.textFieldsNotEmptyWithReset(nameTextField, idTypeTextField, languagesTextField,
|
||||
methodsTextField, idVerificationsTextField);
|
||||
BitSquareValidator.textFieldsHasDoubleValueWithReset(maxTradeVolumeTextField,
|
||||
passiveServiceFeeTextField,
|
||||
minPassiveServiceFeeTextField,
|
||||
arbitrationFeeTextField,
|
||||
minArbitrationFeeTextField);
|
||||
BitSquareValidator.textFieldsNotEmptyWithReset(
|
||||
nameTextField, idTypeTextField, languagesTextField, methodsTextField, idVerificationsTextField);
|
||||
BitSquareValidator.textFieldsHasDoubleValueWithReset(
|
||||
maxTradeVolumeTextField, passiveServiceFeeTextField, minPassiveServiceFeeTextField,
|
||||
arbitrationFeeTextField, minArbitrationFeeTextField);
|
||||
|
||||
String pubKeyAsHex = walletFacade.getArbitratorDepositAddressEntry().getPubKeyAsHexString();
|
||||
String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey());
|
||||
|
@ -38,7 +38,11 @@ public class Popups {
|
||||
}
|
||||
|
||||
public static void openInformationPopup(String title, String message, String masthead) {
|
||||
Dialogs.create().owner(BitSquare.getPrimaryStage()).title(title).message(message).masthead(masthead)
|
||||
Dialogs.create()
|
||||
.owner(BitSquare.getPrimaryStage())
|
||||
.title(title)
|
||||
.message(message)
|
||||
.masthead(masthead)
|
||||
.showInformation();
|
||||
}
|
||||
|
||||
@ -55,8 +59,13 @@ public class Popups {
|
||||
}
|
||||
|
||||
public static Action openConfirmPopup(String title, String message, String masthead, List<Action> actions) {
|
||||
return Dialogs.create().owner(BitSquare.getPrimaryStage()).title(title).message(message).masthead(masthead)
|
||||
.actions(actions).showConfirm();
|
||||
return Dialogs.create()
|
||||
.owner(BitSquare.getPrimaryStage())
|
||||
.title(title)
|
||||
.message(message)
|
||||
.masthead(masthead)
|
||||
.actions(actions)
|
||||
.showConfirm();
|
||||
}
|
||||
|
||||
// Warning
|
||||
@ -69,7 +78,11 @@ public class Popups {
|
||||
}
|
||||
|
||||
public static void openWarningPopup(String title, String message, String masthead) {
|
||||
Dialogs.create().owner(BitSquare.getPrimaryStage()).title(title).message(message).masthead(masthead)
|
||||
Dialogs.create()
|
||||
.owner(BitSquare.getPrimaryStage())
|
||||
.title(title)
|
||||
.message(message)
|
||||
.masthead(masthead)
|
||||
.showWarning();
|
||||
}
|
||||
|
||||
@ -83,7 +96,11 @@ public class Popups {
|
||||
}
|
||||
|
||||
public static Action openErrorPopup(String title, String message, String masthead) {
|
||||
return Dialogs.create().owner(BitSquare.getPrimaryStage()).title(title).message(message).masthead(masthead)
|
||||
return Dialogs.create()
|
||||
.owner(BitSquare.getPrimaryStage())
|
||||
.title(title)
|
||||
.message(message)
|
||||
.masthead(masthead)
|
||||
.showError();
|
||||
}
|
||||
|
||||
@ -97,7 +114,11 @@ public class Popups {
|
||||
}
|
||||
|
||||
public static Action openExceptionPopup(Throwable throwable, String title, String message, String masthead) {
|
||||
return Dialogs.create().owner(BitSquare.getPrimaryStage()).title(title).message(message).masthead(masthead)
|
||||
return Dialogs.create()
|
||||
.owner(BitSquare.getPrimaryStage())
|
||||
.title(title)
|
||||
.message(message)
|
||||
.masthead(masthead)
|
||||
.showException(throwable);
|
||||
}
|
||||
|
||||
@ -132,7 +153,11 @@ public class Popups {
|
||||
|
||||
public static Action openRegistrationMissingPopup(String title, String message, String masthead,
|
||||
List<Dialogs.CommandLink> commandLinks, int selectedIndex) {
|
||||
return Dialogs.create().owner(BitSquare.getPrimaryStage()).title(title).message(message).masthead(masthead)
|
||||
return Dialogs.create()
|
||||
.owner(BitSquare.getPrimaryStage())
|
||||
.title(title)
|
||||
.message(message)
|
||||
.masthead(masthead)
|
||||
.showCommandLinks(commandLinks.get(selectedIndex), commandLinks);
|
||||
}
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ public class ValidatingTextField extends TextField {
|
||||
});
|
||||
|
||||
focusedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
if (validateOnFocusOut && needsValidationOnFocusOut && !newValue && getScene() != null && getScene()
|
||||
.getWindow().isFocused())
|
||||
if (validateOnFocusOut && needsValidationOnFocusOut &&
|
||||
!newValue && getScene() != null && getScene().getWindow().isFocused())
|
||||
validate(getText());
|
||||
});
|
||||
|
||||
|
@ -147,8 +147,8 @@ public class AddressTextField extends AnchorPane {
|
||||
|
||||
private String getBitcoinURI() {
|
||||
Coin d = BitSquareFormatter.parseToCoin(amountToPay);
|
||||
return BitcoinURI.convertToBitcoinURI(address, BitSquareFormatter.parseToCoin(amountToPay),
|
||||
BitSquare.getAppName(), null);
|
||||
return BitcoinURI.convertToBitcoinURI(
|
||||
address, BitSquareFormatter.parseToCoin(amountToPay), BitSquare.getAppName(), null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,8 +127,8 @@ public class BalanceTextField extends AnchorPane {
|
||||
progressIndicator.setProgress(0);
|
||||
break;
|
||||
case PENDING:
|
||||
progressIndicatorTooltip.setText("Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 " +
|
||||
"confirmations");
|
||||
progressIndicatorTooltip.setText(
|
||||
"Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 " + "confirmations");
|
||||
progressIndicator.setProgress(-1.0);
|
||||
break;
|
||||
case BUILDING:
|
||||
|
@ -227,7 +227,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
|
||||
public void invalidated(Observable valueModel) {
|
||||
if (getSkinnable().isIndeterminate() && timelineNulled && spinner == null) {
|
||||
timelineNulled = false;
|
||||
spinner = new IndeterminateSpinner(getSkinnable(), ConfidenceProgressIndicatorSkin.this,
|
||||
spinner = new IndeterminateSpinner(
|
||||
getSkinnable(), ConfidenceProgressIndicatorSkin.this,
|
||||
spinEnabled.get(), progressColor.get());
|
||||
getChildren().add(spinner);
|
||||
}
|
||||
@ -260,7 +261,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
|
||||
} else {
|
||||
if (getSkinnable().getScene() != null && getSkinnable().isIndeterminate()) {
|
||||
timelineNulled = false;
|
||||
spinner = new IndeterminateSpinner(getSkinnable(), ConfidenceProgressIndicatorSkin.this,
|
||||
spinner = new IndeterminateSpinner(
|
||||
getSkinnable(), ConfidenceProgressIndicatorSkin.this,
|
||||
spinEnabled.get(), progressColor.get());
|
||||
getChildren().add(spinner);
|
||||
if (getSkinnable().impl_isTreeVisible()) {
|
||||
@ -306,8 +308,8 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
|
||||
spinner = null;
|
||||
}
|
||||
// create determinateIndicator
|
||||
determinateIndicator = new ConfidenceProgressIndicatorSkin.DeterminateIndicator(control, this,
|
||||
progressColor.get());
|
||||
determinateIndicator =
|
||||
new ConfidenceProgressIndicatorSkin.DeterminateIndicator(control, this, progressColor.get());
|
||||
getChildren().clear();
|
||||
getChildren().add(determinateIndicator);
|
||||
}
|
||||
@ -781,72 +783,70 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
|
||||
private static class StyleableProperties {
|
||||
public static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
|
||||
|
||||
private static final CssMetaData<ConfidenceProgressIndicator, Paint> PROGRESS_COLOR = new
|
||||
CssMetaData<ConfidenceProgressIndicator, Paint>("-fx-progress-color",
|
||||
PaintConverter.getInstance(),
|
||||
null) {
|
||||
private static final CssMetaData<ConfidenceProgressIndicator, Paint> PROGRESS_COLOR =
|
||||
new CssMetaData<ConfidenceProgressIndicator, Paint>(
|
||||
"-fx-progress-color", PaintConverter.getInstance(), null) {
|
||||
|
||||
@Override
|
||||
public boolean isSettable(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return skin.progressColor == null || !skin.progressColor.isBound();
|
||||
}
|
||||
@Override
|
||||
public boolean isSettable(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return skin.progressColor == null || !skin.progressColor.isBound();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public StyleableProperty<Paint> getStyleableProperty(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return (StyleableProperty<Paint>) skin.progressColor;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public StyleableProperty<Paint> getStyleableProperty(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return (StyleableProperty<Paint>) skin.progressColor;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private static final CssMetaData<ConfidenceProgressIndicator, Number> INDETERMINATE_SEGMENT_COUNT = new
|
||||
CssMetaData<ConfidenceProgressIndicator, Number>("-fx-indeterminate-segment-count",
|
||||
SizeConverter.getInstance(),
|
||||
8) {
|
||||
private static final CssMetaData<ConfidenceProgressIndicator, Number> INDETERMINATE_SEGMENT_COUNT =
|
||||
new CssMetaData<ConfidenceProgressIndicator, Number>(
|
||||
"-fx-indeterminate-segment-count", SizeConverter.getInstance(), 8) {
|
||||
|
||||
@Override
|
||||
public void set(ConfidenceProgressIndicator node, Number value, StyleOrigin origin) {
|
||||
super.set(node, value.intValue(), origin);
|
||||
}
|
||||
@Override
|
||||
public void set(ConfidenceProgressIndicator node, Number value, StyleOrigin origin) {
|
||||
super.set(node, value.intValue(), origin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSettable(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return skin.indeterminateSegmentCount == null || !skin.indeterminateSegmentCount.isBound();
|
||||
}
|
||||
@Override
|
||||
public boolean isSettable(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return skin.indeterminateSegmentCount == null || !skin.indeterminateSegmentCount.isBound();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public StyleableProperty<Number> getStyleableProperty(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return (StyleableProperty<Number>) skin.indeterminateSegmentCount;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public StyleableProperty<Number> getStyleableProperty(ConfidenceProgressIndicator n) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) n.getSkin();
|
||||
return (StyleableProperty<Number>) skin.indeterminateSegmentCount;
|
||||
}
|
||||
};
|
||||
|
||||
private static final CssMetaData<ConfidenceProgressIndicator, Boolean> SPIN_ENABLED = new
|
||||
CssMetaData<ConfidenceProgressIndicator, Boolean>("-fx-spin-enabled",
|
||||
BooleanConverter.getInstance(),
|
||||
Boolean.FALSE) {
|
||||
BooleanConverter.getInstance(),
|
||||
Boolean.FALSE) {
|
||||
|
||||
@Override
|
||||
public boolean isSettable(ConfidenceProgressIndicator node) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) node.getSkin();
|
||||
return skin.spinEnabled == null || !skin.spinEnabled.isBound();
|
||||
}
|
||||
@Override
|
||||
public boolean isSettable(ConfidenceProgressIndicator node) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) node.getSkin();
|
||||
return skin.spinEnabled == null || !skin.spinEnabled.isBound();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public StyleableProperty<Boolean> getStyleableProperty(ConfidenceProgressIndicator node) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) node.getSkin();
|
||||
return (StyleableProperty<Boolean>) skin.spinEnabled;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public StyleableProperty<Boolean> getStyleableProperty(ConfidenceProgressIndicator node) {
|
||||
final ConfidenceProgressIndicatorSkin skin = (ConfidenceProgressIndicatorSkin) node.getSkin();
|
||||
return (StyleableProperty<Boolean>) skin.spinEnabled;
|
||||
}
|
||||
};
|
||||
|
||||
static {
|
||||
final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(SkinBase.getClassCssMetaData
|
||||
());
|
||||
final List<CssMetaData<? extends Styleable, ?>> styleables =
|
||||
new ArrayList<>(SkinBase.getClassCssMetaData());
|
||||
styleables.add(PROGRESS_COLOR);
|
||||
styleables.add(INDETERMINATE_SEGMENT_COUNT);
|
||||
styleables.add(SPIN_ENABLED);
|
||||
|
@ -33,8 +33,8 @@ public class ProcessStepItem {
|
||||
this(label, color, false);
|
||||
}
|
||||
|
||||
private ProcessStepItem(String label, Paint color, @SuppressWarnings("SameParameterValue") boolean
|
||||
hasProgressIndicator) {
|
||||
private ProcessStepItem(String label, Paint color,
|
||||
@SuppressWarnings("SameParameterValue") boolean hasProgressIndicator) {
|
||||
this.label = label;
|
||||
this.color = color;
|
||||
this.progressIndicator = hasProgressIndicator;
|
||||
|
@ -54,8 +54,9 @@ public class FundsController extends CachedViewController {
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
super.initialize(url, rb);
|
||||
|
||||
((CachingTabPane) root).initialize(this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(),
|
||||
NavigationItem.WITHDRAWAL.getFxmlUrl(), NavigationItem.TRANSACTIONS.getFxmlUrl());
|
||||
((CachingTabPane) root).initialize(
|
||||
this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(), NavigationItem.WITHDRAWAL.getFxmlUrl(),
|
||||
NavigationItem.TRANSACTIONS.getFxmlUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,8 +93,8 @@ public class DepositController extends CachedViewController {
|
||||
|
||||
List<AddressEntry> addressEntryList = walletFacade.getAddressEntryList();
|
||||
addressList = FXCollections.observableArrayList();
|
||||
addressList.addAll(addressEntryList.stream().map(anAddressEntryList -> new DepositListItem
|
||||
(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
|
||||
addressList.addAll(addressEntryList.stream().map(anAddressEntryList ->
|
||||
new DepositListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
|
||||
|
||||
tableView.setItems(addressList);
|
||||
}
|
||||
@ -136,8 +136,8 @@ public class DepositController extends CachedViewController {
|
||||
Tooltip tooltip = new Tooltip(item.getAddressEntry().getOfferId());
|
||||
Tooltip.install(hyperlink, tooltip);
|
||||
|
||||
hyperlink.setOnAction(event -> log.info("Show trade details " + item.getAddressEntry
|
||||
().getOfferId()));
|
||||
hyperlink.setOnAction(event ->
|
||||
log.info("Show trade details " + item.getAddressEntry().getOfferId()));
|
||||
}
|
||||
setGraphic(hyperlink);
|
||||
} else {
|
||||
@ -152,63 +152,63 @@ public class DepositController extends CachedViewController {
|
||||
|
||||
private void setBalanceColumnCellFactory() {
|
||||
balanceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
balanceColumn.setCellFactory(new Callback<TableColumn<String, DepositListItem>, TableCell<String,
|
||||
DepositListItem>>() {
|
||||
balanceColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, DepositListItem>, TableCell<String, DepositListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
|
||||
return new TableCell<String, DepositListItem>() {
|
||||
@Override
|
||||
public void updateItem(final DepositListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
|
||||
return new TableCell<String, DepositListItem>() {
|
||||
@Override
|
||||
public void updateItem(final DepositListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(item.getBalanceLabel());
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
if (item != null && !empty) {
|
||||
setGraphic(item.getBalanceLabel());
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setCopyColumnCellFactory() {
|
||||
copyColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
copyColumn.setCellFactory(new Callback<TableColumn<String, DepositListItem>, TableCell<String,
|
||||
DepositListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
|
||||
return new TableCell<String, DepositListItem>() {
|
||||
final Label copyIcon = new Label();
|
||||
|
||||
{
|
||||
copyIcon.getStyleClass().add("copy-icon");
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
Tooltip.install(copyIcon, new Tooltip("Copy address to clipboard"));
|
||||
}
|
||||
copyColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, DepositListItem>, TableCell<String, DepositListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final DepositListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
|
||||
return new TableCell<String, DepositListItem>() {
|
||||
final Label copyIcon = new Label();
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(copyIcon);
|
||||
copyIcon.setOnMouseClicked(e -> {
|
||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(item.addressStringProperty().get());
|
||||
clipboard.setContent(content);
|
||||
});
|
||||
{
|
||||
copyIcon.getStyleClass().add("copy-icon");
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
Tooltip.install(copyIcon, new Tooltip("Copy address to clipboard"));
|
||||
}
|
||||
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final DepositListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(copyIcon);
|
||||
copyIcon.setOnMouseClicked(e -> {
|
||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(item.addressStringProperty().get());
|
||||
clipboard.setContent(content);
|
||||
});
|
||||
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setConfidenceColumnCellFactory() {
|
||||
|
@ -88,8 +88,8 @@ public class TransactionsController extends CachedViewController {
|
||||
|
||||
List<Transaction> transactions = walletFacade.getWallet().getRecentTransactions(10000, true);
|
||||
transactionsListItems = FXCollections.observableArrayList();
|
||||
transactionsListItems.addAll(transactions.stream().map(transaction -> new TransactionsListItem(transaction,
|
||||
walletFacade)).collect(Collectors.toList()));
|
||||
transactionsListItems.addAll(transactions.stream().map(transaction ->
|
||||
new TransactionsListItem(transaction, walletFacade)).collect(Collectors.toList()));
|
||||
|
||||
tableView.setItems(transactionsListItems);
|
||||
}
|
||||
@ -111,56 +111,59 @@ public class TransactionsController extends CachedViewController {
|
||||
|
||||
private void setAddressColumnCellFactory() {
|
||||
addressColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
addressColumn.setCellFactory(new Callback<TableColumn<String, TransactionsListItem>, TableCell<String,
|
||||
TransactionsListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, TransactionsListItem> call(TableColumn<String, TransactionsListItem> column) {
|
||||
return new TableCell<String, TransactionsListItem>() {
|
||||
Hyperlink hyperlink;
|
||||
addressColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, TransactionsListItem>, TableCell<String, TransactionsListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final TransactionsListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, TransactionsListItem> call(TableColumn<String,
|
||||
TransactionsListItem> column) {
|
||||
return new TableCell<String, TransactionsListItem>() {
|
||||
Hyperlink hyperlink;
|
||||
|
||||
if (item != null && !empty) {
|
||||
hyperlink = new Hyperlink(item.getAddressString());
|
||||
hyperlink.setId("id-link");
|
||||
hyperlink.setOnAction(event -> log.info("Show trade details " + item.getAddressString()));
|
||||
setGraphic(hyperlink);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
setId(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final TransactionsListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
hyperlink = new Hyperlink(item.getAddressString());
|
||||
hyperlink.setId("id-link");
|
||||
hyperlink.setOnAction(event -> log.info("Show trade details " + item
|
||||
.getAddressString()));
|
||||
setGraphic(hyperlink);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
setId(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setConfidenceColumnCellFactory() {
|
||||
confidenceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue
|
||||
()));
|
||||
confidenceColumn.setCellFactory(new Callback<TableColumn<String, TransactionsListItem>, TableCell<String,
|
||||
TransactionsListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, TransactionsListItem> call(TableColumn<String, TransactionsListItem> column) {
|
||||
return new TableCell<String, TransactionsListItem>() {
|
||||
confidenceColumn.setCellValueFactory((addressListItem) ->
|
||||
new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
confidenceColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, TransactionsListItem>, TableCell<String, TransactionsListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final TransactionsListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, TransactionsListItem> call(TableColumn<String,
|
||||
TransactionsListItem> column) {
|
||||
return new TableCell<String, TransactionsListItem>() {
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(item.getProgressIndicator());
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final TransactionsListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(item.getProgressIndicator());
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,10 +56,10 @@ public class TransactionsListItem {
|
||||
if (!transactionOutput.isMine(walletFacade.getWallet())) {
|
||||
type.set("Sent to");
|
||||
|
||||
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey()
|
||||
.isPayToScriptHash()) {
|
||||
address = transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams
|
||||
());
|
||||
if (transactionOutput.getScriptPubKey().isSentToAddress() ||
|
||||
transactionOutput.getScriptPubKey().isPayToScriptHash()) {
|
||||
address =
|
||||
transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
|
||||
addressString = address.toString();
|
||||
} else {
|
||||
addressString = "No sent to address script used.";
|
||||
@ -73,10 +73,10 @@ public class TransactionsListItem {
|
||||
|
||||
for (TransactionOutput transactionOutput : transaction.getOutputs()) {
|
||||
if (transactionOutput.isMine(walletFacade.getWallet())) {
|
||||
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey()
|
||||
.isPayToScriptHash()) {
|
||||
address = transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams
|
||||
());
|
||||
if (transactionOutput.getScriptPubKey().isSentToAddress() ||
|
||||
transactionOutput.getScriptPubKey().isPayToScriptHash()) {
|
||||
address =
|
||||
transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
|
||||
addressString = address.toString();
|
||||
} else {
|
||||
addressString = "No sent to address script used.";
|
||||
|
@ -107,8 +107,8 @@ public class WithdrawalController extends CachedViewController {
|
||||
|
||||
tableView.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
BitSquareValidator.resetTextFields(withdrawFromTextField, withdrawToTextField, amountTextField,
|
||||
changeAddressTextField);
|
||||
BitSquareValidator.resetTextFields(
|
||||
withdrawFromTextField, withdrawToTextField, amountTextField, changeAddressTextField);
|
||||
|
||||
if (Coin.ZERO.compareTo(newValue.getBalance()) <= 0) {
|
||||
amountTextField.setText(newValue.getBalance().toPlainString());
|
||||
@ -125,8 +125,8 @@ public class WithdrawalController extends CachedViewController {
|
||||
|
||||
List<AddressEntry> addressEntryList = walletFacade.getAddressEntryList();
|
||||
addressList = FXCollections.observableArrayList();
|
||||
addressList.addAll(addressEntryList.stream().map(anAddressEntryList -> new WithdrawalListItem
|
||||
(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
|
||||
addressList.addAll(addressEntryList.stream().map(anAddressEntryList ->
|
||||
new WithdrawalListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
|
||||
|
||||
tableView.setItems(addressList);
|
||||
}
|
||||
@ -139,8 +139,8 @@ public class WithdrawalController extends CachedViewController {
|
||||
@FXML
|
||||
public void onWithdraw() {
|
||||
try {
|
||||
BitSquareValidator.textFieldsNotEmpty(amountTextField, withdrawFromTextField, withdrawToTextField,
|
||||
changeAddressTextField);
|
||||
BitSquareValidator.textFieldsNotEmpty(
|
||||
amountTextField, withdrawFromTextField, withdrawToTextField, changeAddressTextField);
|
||||
BitSquareValidator.textFieldsHasDoubleValueWithReset(amountTextField);
|
||||
|
||||
Coin amount = BitSquareFormatter.parseToCoin(amountTextField.getText());
|
||||
@ -148,8 +148,8 @@ public class WithdrawalController extends CachedViewController {
|
||||
FutureCallback<Transaction> callback = new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(@javax.annotation.Nullable Transaction transaction) {
|
||||
BitSquareValidator.resetTextFields(withdrawFromTextField, withdrawToTextField,
|
||||
amountTextField, changeAddressTextField);
|
||||
BitSquareValidator.resetTextFields(
|
||||
withdrawFromTextField, withdrawToTextField, amountTextField, changeAddressTextField);
|
||||
if (transaction != null) {
|
||||
log.info("onWithdraw onSuccess txid:" + transaction.getHashAsString());
|
||||
}
|
||||
@ -161,22 +161,23 @@ public class WithdrawalController extends CachedViewController {
|
||||
}
|
||||
};
|
||||
|
||||
Action response = Popups.openConfirmPopup("Withdrawal request", "Confirm your request",
|
||||
"Your withdrawal request:\n\n" +
|
||||
"Amount: " + amountTextField.getText() + " BTC\n" +
|
||||
"Sending address: " + withdrawFromTextField.getText() + "\n" +
|
||||
"Receiving address: " + withdrawToTextField.getText() + "\n" +
|
||||
"Transaction fee: " + BitSquareFormatter.formatCoinWithCode(FeePolicy.TX_FEE) + "\n" +
|
||||
"You receive in total: " + BitSquareFormatter.formatCoinWithCode(amount.subtract(FeePolicy
|
||||
.TX_FEE)) + " BTC\n\n" +
|
||||
"Are you sure you withdraw that amount?");
|
||||
Action response = Popups.openConfirmPopup(
|
||||
"Withdrawal request", "Confirm your request",
|
||||
"Your withdrawal request:\n\n" + "Amount: " + amountTextField.getText() + " BTC\n" + "Sending" +
|
||||
" address: " + withdrawFromTextField.getText() + "\n" + "Receiving address: " +
|
||||
withdrawToTextField.getText() + "\n" + "Transaction fee: " +
|
||||
BitSquareFormatter.formatCoinWithCode(FeePolicy.TX_FEE) + "\n" +
|
||||
"You receive in total: " +
|
||||
BitSquareFormatter.formatCoinWithCode(amount.subtract(FeePolicy.TX_FEE)) + " BTC\n\n" +
|
||||
"Are you sure you withdraw that amount?");
|
||||
if (response == Dialog.Actions.OK) {
|
||||
try {
|
||||
walletFacade.sendFunds(withdrawFromTextField.getText(), withdrawToTextField.getText(),
|
||||
walletFacade.sendFunds(
|
||||
withdrawFromTextField.getText(), withdrawToTextField.getText(),
|
||||
changeAddressTextField.getText(), amount, callback);
|
||||
} catch (AddressFormatException e) {
|
||||
Popups.openErrorPopup("Address invalid", "The address is not correct. Please check the " +
|
||||
"address format.");
|
||||
Popups.openErrorPopup("Address invalid",
|
||||
"The address is not correct. Please check the address format.");
|
||||
|
||||
} catch (InsufficientMoneyException e) {
|
||||
Popups.openInsufficientMoneyPopup();
|
||||
@ -186,8 +187,8 @@ 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.");
|
||||
Popups.openErrorPopup("Insufficient amount",
|
||||
"The amount to transfer is lower the the transaction fee and the min. possible tx value.");
|
||||
}
|
||||
|
||||
} catch (BitSquareValidator.ValidationException e) {
|
||||
@ -243,83 +244,83 @@ public class WithdrawalController extends CachedViewController {
|
||||
|
||||
private void setBalanceColumnCellFactory() {
|
||||
balanceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
balanceColumn.setCellFactory(new Callback<TableColumn<String, WithdrawalListItem>, TableCell<String,
|
||||
WithdrawalListItem>>() {
|
||||
balanceColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, WithdrawalListItem>, TableCell<String, WithdrawalListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, WithdrawalListItem> call(TableColumn<String, WithdrawalListItem> column) {
|
||||
return new TableCell<String, WithdrawalListItem>() {
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
setGraphic((item != null && !empty) ? item.getBalanceLabel() : null);
|
||||
public TableCell<String, WithdrawalListItem> call(TableColumn<String, WithdrawalListItem> column) {
|
||||
return new TableCell<String, WithdrawalListItem>() {
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
setGraphic((item != null && !empty) ? item.getBalanceLabel() : null);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setCopyColumnCellFactory() {
|
||||
copyColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
copyColumn.setCellFactory(new Callback<TableColumn<String, WithdrawalListItem>, TableCell<String,
|
||||
WithdrawalListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, WithdrawalListItem> call(TableColumn<String, WithdrawalListItem> column) {
|
||||
return new TableCell<String, WithdrawalListItem>() {
|
||||
final Label copyIcon = new Label();
|
||||
|
||||
{
|
||||
copyIcon.getStyleClass().add("copy-icon");
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
Tooltip.install(copyIcon, new Tooltip("Copy address to clipboard"));
|
||||
}
|
||||
copyColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, WithdrawalListItem>, TableCell<String, WithdrawalListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, WithdrawalListItem> call(TableColumn<String, WithdrawalListItem> column) {
|
||||
return new TableCell<String, WithdrawalListItem>() {
|
||||
final Label copyIcon = new Label();
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(copyIcon);
|
||||
copyIcon.setOnMouseClicked(e -> {
|
||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(item.addressStringProperty().get());
|
||||
clipboard.setContent(content);
|
||||
});
|
||||
{
|
||||
copyIcon.getStyleClass().add("copy-icon");
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
Tooltip.install(copyIcon, new Tooltip("Copy address to clipboard"));
|
||||
}
|
||||
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(copyIcon);
|
||||
copyIcon.setOnMouseClicked(e -> {
|
||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(item.addressStringProperty().get());
|
||||
clipboard.setContent(content);
|
||||
});
|
||||
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setConfidenceColumnCellFactory() {
|
||||
confidenceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue
|
||||
()));
|
||||
confidenceColumn.setCellFactory(new Callback<TableColumn<String, WithdrawalListItem>, TableCell<String,
|
||||
WithdrawalListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, WithdrawalListItem> call(TableColumn<String, WithdrawalListItem> column) {
|
||||
return new TableCell<String, WithdrawalListItem>() {
|
||||
confidenceColumn.setCellValueFactory((addressListItem) ->
|
||||
new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||
confidenceColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, WithdrawalListItem>, TableCell<String, WithdrawalListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, WithdrawalListItem> call(TableColumn<String, WithdrawalListItem> column) {
|
||||
return new TableCell<String, WithdrawalListItem>() {
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(item.getProgressIndicator());
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
setGraphic(item.getProgressIndicator());
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -117,66 +117,66 @@ public class OfferController extends CachedViewController {
|
||||
|
||||
private void setOfferIdColumnColumnCellFactory() {
|
||||
offerIdColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper(offerListItem.getValue()));
|
||||
offerIdColumn.setCellFactory(new Callback<TableColumn<String, OfferListItem>, TableCell<String,
|
||||
OfferListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, OfferListItem> call(TableColumn<String, OfferListItem> column) {
|
||||
return new TableCell<String, OfferListItem>() {
|
||||
Hyperlink hyperlink;
|
||||
offerIdColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, OfferListItem>, TableCell<String, OfferListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final OfferListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
public TableCell<String, OfferListItem> call(TableColumn<String, OfferListItem> column) {
|
||||
return new TableCell<String, OfferListItem>() {
|
||||
Hyperlink hyperlink;
|
||||
|
||||
if (item != null && !empty) {
|
||||
hyperlink = new Hyperlink(item.getOfferId());
|
||||
//hyperlink.getStyleClass().setAll("aaa");
|
||||
Tooltip tooltip = new Tooltip(item.getOfferId());
|
||||
Tooltip.install(hyperlink, tooltip);
|
||||
hyperlink.setOnAction(event -> openOfferDetails(item));
|
||||
setGraphic(hyperlink);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
setId(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final OfferListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
hyperlink = new Hyperlink(item.getOfferId());
|
||||
//hyperlink.getStyleClass().setAll("aaa");
|
||||
Tooltip tooltip = new Tooltip(item.getOfferId());
|
||||
Tooltip.install(hyperlink, tooltip);
|
||||
hyperlink.setOnAction(event -> openOfferDetails(item));
|
||||
setGraphic(hyperlink);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
setId(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setRemoveColumnCellFactory() {
|
||||
removeColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper(offerListItem.getValue()));
|
||||
removeColumn.setCellFactory(new Callback<TableColumn<String, OfferListItem>, TableCell<String,
|
||||
OfferListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, OfferListItem> call(TableColumn<String, OfferListItem> directionColumn) {
|
||||
return new TableCell<String, OfferListItem>() {
|
||||
final ImageView iconView = ImageUtil.getIconImageView(ImageUtil.REMOVE);
|
||||
final Button button = new Button();
|
||||
|
||||
{
|
||||
button.setText("Remove");
|
||||
button.setGraphic(iconView);
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
removeColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, OfferListItem>, TableCell<String, OfferListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final OfferListItem offerListItem, boolean empty) {
|
||||
super.updateItem(offerListItem, empty);
|
||||
public TableCell<String, OfferListItem> call(TableColumn<String, OfferListItem> directionColumn) {
|
||||
return new TableCell<String, OfferListItem>() {
|
||||
final ImageView iconView = ImageUtil.getIconImageView(ImageUtil.REMOVE);
|
||||
final Button button = new Button();
|
||||
|
||||
if (offerListItem != null) {
|
||||
button.setOnAction(event -> removeOffer(offerListItem));
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
{
|
||||
button.setText("Remove");
|
||||
button.setGraphic(iconView);
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final OfferListItem offerListItem, boolean empty) {
|
||||
super.updateItem(offerListItem, empty);
|
||||
|
||||
if (offerListItem != null) {
|
||||
button.setOnAction(event -> removeOffer(offerListItem));
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,10 @@ public class OfferListItem {
|
||||
this.date.set(BitSquareFormatter.formatDateTime(offer.getCreationDate()));
|
||||
this.price.set(BitSquareFormatter.formatPrice(offer.getPrice()));
|
||||
|
||||
this.amount.set(BitSquareFormatter.formatCoin(offer.getAmount()) + " (" + BitSquareFormatter.formatCoin(offer
|
||||
.getMinAmount()) + ")");
|
||||
this.volume.set(BitSquareFormatter.formatVolumeWithMinVolume(offer.getOfferVolume(),
|
||||
offer.getMinOfferVolume()));
|
||||
this.amount.set(BitSquareFormatter.formatCoin(
|
||||
offer.getAmount()) + " (" + BitSquareFormatter.formatCoin(offer.getMinAmount()) + ")");
|
||||
this.volume.set(BitSquareFormatter.formatVolumeWithMinVolume(
|
||||
offer.getOfferVolume(), offer.getMinOfferVolume()));
|
||||
this.offerId = offer.getId();
|
||||
}
|
||||
|
||||
|
@ -72,23 +72,17 @@ public class PendingTradeController extends CachedViewController {
|
||||
private Image sellIcon = ImageUtil.getIconImage(ImageUtil.SELL);
|
||||
private ConfidenceDisplay confidenceDisplay;
|
||||
|
||||
@FXML
|
||||
private TableView openTradesTable;
|
||||
@FXML
|
||||
private TableColumn<String, PendingTradesListItem> directionColumn, countryColumn, bankAccountTypeColumn,
|
||||
@FXML private TableView openTradesTable;
|
||||
@FXML private TableColumn<String, PendingTradesListItem> directionColumn, countryColumn, bankAccountTypeColumn,
|
||||
priceColumn, amountColumn, volumeColumn, statusColumn, selectColumn;
|
||||
@FXML
|
||||
private ConfidenceProgressIndicator progressIndicator;
|
||||
@FXML
|
||||
private Label txTitleLabel, txHeaderLabel, confirmationLabel, txIDCopyIcon, holderNameCopyIcon,
|
||||
@FXML private ConfidenceProgressIndicator progressIndicator;
|
||||
@FXML private Label txTitleLabel, txHeaderLabel, confirmationLabel, txIDCopyIcon, holderNameCopyIcon,
|
||||
primaryBankAccountIDCopyIcon, secondaryBankAccountIDCopyIcon, bankAccountDetailsHeaderLabel,
|
||||
bankAccountTypeTitleLabel, holderNameTitleLabel, primaryBankAccountIDTitleLabel,
|
||||
secondaryBankAccountIDTitleLabel;
|
||||
@FXML
|
||||
private TextField txTextField, bankAccountTypeTextField, holderNameTextField, primaryBankAccountIDTextField,
|
||||
@FXML private TextField txTextField, bankAccountTypeTextField, holderNameTextField, primaryBankAccountIDTextField,
|
||||
secondaryBankAccountIDTextField;
|
||||
@FXML
|
||||
private Button bankTransferInitedButton;
|
||||
@FXML private Button bankTransferInitedButton;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -136,8 +130,7 @@ public class PendingTradeController extends CachedViewController {
|
||||
openTradesTable.setItems(tradeItems);
|
||||
openTradesTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
|
||||
openTradesTable.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue,
|
||||
newValue) -> {
|
||||
openTradesTable.getSelectionModel().selectedItemProperty().addListener((obsValue, oldValue, newValue) -> {
|
||||
if (newValue instanceof PendingTradesListItem) {
|
||||
showTradeDetails((PendingTradesListItem) newValue);
|
||||
}
|
||||
@ -153,10 +146,9 @@ public class PendingTradeController extends CachedViewController {
|
||||
initCopyIcons();
|
||||
|
||||
// select
|
||||
Optional<PendingTradesListItem> currentTradeItemOptional = tradeItems.stream()
|
||||
.filter((e) -> tradeManager.getPendingTrade() != null && e.getTrade().getId().equals(tradeManager
|
||||
.getPendingTrade().getId()))
|
||||
.findFirst();
|
||||
Optional<PendingTradesListItem> currentTradeItemOptional = tradeItems.stream().filter((e) ->
|
||||
tradeManager.getPendingTrade() != null &&
|
||||
e.getTrade().getId().equals(tradeManager.getPendingTrade().getId())).findFirst();
|
||||
if (currentTradeItemOptional.isPresent()) {
|
||||
openTradesTable.getSelectionModel().select(currentTradeItemOptional.get());
|
||||
}
|
||||
@ -193,8 +185,8 @@ public class PendingTradeController extends CachedViewController {
|
||||
private void updateTx(Transaction transaction) {
|
||||
txTextField.setText(transaction.getHashAsString());
|
||||
|
||||
confidenceDisplay = new ConfidenceDisplay(walletFacade.getWallet(), confirmationLabel, transaction,
|
||||
progressIndicator);
|
||||
confidenceDisplay =
|
||||
new ConfidenceDisplay(walletFacade.getWallet(), confirmationLabel, transaction, progressIndicator);
|
||||
|
||||
int depthInBlocks = transaction.getConfidence().getDepthInBlocks();
|
||||
bankTransferInitedButton.setDisable(depthInBlocks == 0);
|
||||
@ -238,8 +230,8 @@ public class PendingTradeController extends CachedViewController {
|
||||
currentTrade = trade;
|
||||
Transaction transaction = trade.getDepositTransaction();
|
||||
if (transaction == null) {
|
||||
trade.depositTxChangedProperty().addListener((observableValue, aBoolean,
|
||||
aBoolean2) -> updateTx(trade.getDepositTransaction()));
|
||||
trade.depositTxChangedProperty().addListener((observableValue, aBoolean, aBoolean2) ->
|
||||
updateTx(trade.getDepositTransaction()));
|
||||
} else {
|
||||
updateTx(trade.getDepositTransaction());
|
||||
}
|
||||
@ -260,8 +252,8 @@ public class PendingTradeController extends CachedViewController {
|
||||
Transaction transaction = trade.getPayoutTransaction();
|
||||
|
||||
confidenceDisplay.destroy();
|
||||
confidenceDisplay = new ConfidenceDisplay(walletFacade.getWallet(), confirmationLabel, transaction,
|
||||
progressIndicator);
|
||||
confidenceDisplay =
|
||||
new ConfidenceDisplay(walletFacade.getWallet(), confirmationLabel, transaction, progressIndicator);
|
||||
|
||||
txTextField.setText(transaction.getHashAsString());
|
||||
|
||||
@ -276,8 +268,8 @@ public class PendingTradeController extends CachedViewController {
|
||||
|
||||
bankAccountTypeTextField.setText(BitSquareFormatter.formatCoinWithCode(trade.getTradeAmount()));
|
||||
holderNameTextField.setText(BitSquareFormatter.formatVolume(trade.getTradeVolume()));
|
||||
primaryBankAccountIDTextField.setText(BitSquareFormatter.formatCoinWithCode(FeePolicy.CREATE_OFFER_FEE
|
||||
.add(FeePolicy.TX_FEE)));
|
||||
primaryBankAccountIDTextField.setText(
|
||||
BitSquareFormatter.formatCoinWithCode(FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
secondaryBankAccountIDTextField.setText(BitSquareFormatter.formatCoinWithCode(trade.getCollateralAmount()));
|
||||
|
||||
holderNameCopyIcon.setVisible(false);
|
||||
@ -339,137 +331,138 @@ public class PendingTradeController extends CachedViewController {
|
||||
|
||||
private void setCountryColumnCellFactory() {
|
||||
countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
countryColumn.setCellFactory(new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String,
|
||||
PendingTradesListItem>>() {
|
||||
@Override
|
||||
public TableCell<String, PendingTradesListItem> call(TableColumn<String,
|
||||
PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
final HBox hBox = new HBox();
|
||||
|
||||
{
|
||||
hBox.setSpacing(3);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
setGraphic(hBox);
|
||||
}
|
||||
|
||||
countryColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String, PendingTradesListItem>>() {
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
public TableCell<String, PendingTradesListItem> call(
|
||||
TableColumn<String, PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
final HBox hBox = new HBox();
|
||||
|
||||
hBox.getChildren().clear();
|
||||
if (tradesTableItem != null) {
|
||||
Country country = tradesTableItem.getTrade().getOffer().getBankAccountCountry();
|
||||
try {
|
||||
hBox.getChildren().add(ImageUtil.getIconImageView("/images/countries/" + country
|
||||
.getCode().toLowerCase() + ".png"));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("Country icon not found: " + "/images/countries/" + country.getCode()
|
||||
.toLowerCase() + ".png country name: " + country.getName());
|
||||
{
|
||||
hBox.setSpacing(3);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
setGraphic(hBox);
|
||||
}
|
||||
Tooltip.install(this, new Tooltip(country.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
|
||||
hBox.getChildren().clear();
|
||||
if (tradesTableItem != null) {
|
||||
Country country = tradesTableItem.getTrade().getOffer().getBankAccountCountry();
|
||||
try {
|
||||
hBox.getChildren().add(ImageUtil.getIconImageView(
|
||||
"/images/countries/" + country.getCode().toLowerCase() + ".png"));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("Country icon not found: /images/countries/" +
|
||||
country.getCode().toLowerCase() + ".png country name: " +
|
||||
country.getName());
|
||||
}
|
||||
Tooltip.install(this, new Tooltip(country.getName()));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setBankAccountTypeColumnCellFactory() {
|
||||
bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
bankAccountTypeColumn.setCellFactory(new Callback<TableColumn<String, PendingTradesListItem>,
|
||||
TableCell<String, PendingTradesListItem>>() {
|
||||
@Override
|
||||
public TableCell<String, PendingTradesListItem> call(TableColumn<String,
|
||||
PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
bankAccountTypeColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String, PendingTradesListItem>>() {
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
public TableCell<String, PendingTradesListItem> call(
|
||||
TableColumn<String, PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
|
||||
if (tradesTableItem != null) {
|
||||
BankAccountType bankAccountType = tradesTableItem.getTrade().getOffer()
|
||||
.getBankAccountType();
|
||||
setText(Localisation.get(bankAccountType.toString()));
|
||||
} else {
|
||||
setText("");
|
||||
}
|
||||
if (tradesTableItem != null) {
|
||||
BankAccountType bankAccountType = tradesTableItem.getTrade().getOffer()
|
||||
.getBankAccountType();
|
||||
setText(Localisation.get(bankAccountType.toString()));
|
||||
} else {
|
||||
setText("");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setDirectionColumnCellFactory() {
|
||||
directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
directionColumn.setCellFactory(new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String,
|
||||
PendingTradesListItem>>() {
|
||||
@Override
|
||||
public TableCell<String, PendingTradesListItem> call(TableColumn<String,
|
||||
PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
final ImageView iconView = new ImageView();
|
||||
final Button button = new Button();
|
||||
|
||||
{
|
||||
button.setGraphic(iconView);
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
|
||||
directionColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String, PendingTradesListItem>>() {
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
public TableCell<String, PendingTradesListItem> call(
|
||||
TableColumn<String, PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
final ImageView iconView = new ImageView();
|
||||
final Button button = new Button();
|
||||
|
||||
if (tradesTableItem != null) {
|
||||
String title;
|
||||
Image icon;
|
||||
Offer offer = tradesTableItem.getTrade().getOffer();
|
||||
|
||||
if (offer.getDirection() == Direction.SELL) {
|
||||
icon = buyIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.BUY, true);
|
||||
} else {
|
||||
icon = sellIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.SELL, true);
|
||||
{
|
||||
button.setGraphic(iconView);
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
button.setDisable(true);
|
||||
iconView.setImage(icon);
|
||||
button.setText(title);
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
|
||||
if (tradesTableItem != null) {
|
||||
String title;
|
||||
Image icon;
|
||||
Offer offer = tradesTableItem.getTrade().getOffer();
|
||||
|
||||
if (offer.getDirection() == Direction.SELL) {
|
||||
icon = buyIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.BUY, true);
|
||||
} else {
|
||||
icon = sellIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.SELL, true);
|
||||
}
|
||||
button.setDisable(true);
|
||||
iconView.setImage(icon);
|
||||
button.setText(title);
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setSelectColumnCellFactory() {
|
||||
selectColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
selectColumn.setCellFactory(new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String,
|
||||
PendingTradesListItem>>() {
|
||||
@Override
|
||||
public TableCell<String, PendingTradesListItem> call(TableColumn<String,
|
||||
PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
final Button button = new Button("Select");
|
||||
|
||||
selectColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, PendingTradesListItem>, TableCell<String, PendingTradesListItem>>() {
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
public TableCell<String, PendingTradesListItem> call(
|
||||
TableColumn<String, PendingTradesListItem> directionColumn) {
|
||||
return new TableCell<String, PendingTradesListItem>() {
|
||||
final Button button = new Button("Select");
|
||||
|
||||
if (tradesTableItem != null) {
|
||||
button.setOnAction(event -> showTradeDetails(tradesTableItem));
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
@Override
|
||||
public void updateItem(final PendingTradesListItem tradesTableItem, boolean empty) {
|
||||
super.updateItem(tradesTableItem, empty);
|
||||
|
||||
if (tradesTableItem != null) {
|
||||
button.setOnAction(event -> showTradeDetails(tradesTableItem));
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ public class SettingsController extends CachedViewController {
|
||||
public void onSelectBankAccountRegion() {
|
||||
bankAccountCountryComboBox.setVisible(true);
|
||||
Region selectedBankAccountRegion = bankAccountRegionComboBox.getSelectionModel().getSelectedItem();
|
||||
bankAccountCountryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesFor
|
||||
(selectedBankAccountRegion)));
|
||||
bankAccountCountryComboBox.setItems(
|
||||
FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedBankAccountRegion)));
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -522,8 +522,8 @@ public class SettingsController extends CachedViewController {
|
||||
bankAccountCurrencyComboBox.getSelectionModel().selectFirst();
|
||||
bankAccountRegionComboBox.getSelectionModel().select(3);
|
||||
|
||||
Optional<Country> country = bankAccountCountryComboBox.getItems().stream().filter(e -> e.getCode().equals
|
||||
(CountryUtil.getDefaultCountry().getCode())).findFirst();
|
||||
Optional<Country> country = bankAccountCountryComboBox.getItems().stream().filter(e ->
|
||||
e.getCode().equals(CountryUtil.getDefaultCountry().getCode())).findFirst();
|
||||
if (country.isPresent())
|
||||
bankAccountCountryComboBox.getSelectionModel().select(country.get());
|
||||
|
||||
@ -703,7 +703,8 @@ public class SettingsController extends CachedViewController {
|
||||
|
||||
private boolean verifyBankAccountData() {
|
||||
try {
|
||||
BitSquareValidator.textFieldsNotEmptyWithReset(bankAccountTitleTextField, bankAccountHolderNameTextField,
|
||||
BitSquareValidator.textFieldsNotEmptyWithReset(
|
||||
bankAccountTitleTextField, bankAccountHolderNameTextField,
|
||||
bankAccountPrimaryIDTextField, bankAccountSecondaryIDTextField);
|
||||
|
||||
BankAccountType bankAccountTypeInfo = bankAccountTypesComboBox.getSelectionModel().getSelectedItem();
|
||||
@ -712,10 +713,8 @@ public class SettingsController extends CachedViewController {
|
||||
bankAccountTypeInfo);
|
||||
|
||||
return bankAccountTypesComboBox.getSelectionModel().getSelectedItem() != null &&
|
||||
bankAccountCountryComboBox.getSelectionModel()
|
||||
.getSelectedItem() != null && bankAccountCurrencyComboBox.getSelectionModel()
|
||||
.getSelectedItem() !=
|
||||
null;
|
||||
bankAccountCountryComboBox.getSelectionModel().getSelectedItem() != null &&
|
||||
bankAccountCurrencyComboBox.getSelectionModel().getSelectedItem() != null;
|
||||
} catch (BitSquareValidator.ValidationException e) {
|
||||
return false;
|
||||
}
|
||||
@ -762,6 +761,5 @@ public class SettingsController extends CachedViewController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,8 @@ public class TradeController extends CachedViewController {
|
||||
|
||||
// TODO find better solution
|
||||
// Textfield focus out triggers validation, use runLater as quick fix...
|
||||
((TabPane) root).getSelectionModel().selectedIndexProperty().addListener((observableValue) -> Platform
|
||||
.runLater(() -> ValidatingTextField.hidePopover()));
|
||||
((TabPane) root).getSelectionModel().selectedIndexProperty().addListener((observableValue) ->
|
||||
Platform.runLater(() -> ValidatingTextField.hidePopover()));
|
||||
}
|
||||
|
||||
|
||||
@ -88,8 +88,8 @@ public class TradeController extends CachedViewController {
|
||||
if (navigationItem == NavigationItem.ORDER_BOOK) {
|
||||
checkArgument(orderBookLoader == null);
|
||||
// Orderbook must not be cached by GuiceFXMLLoader as we use 2 instances for sell and buy screens.
|
||||
orderBookLoader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.ORDER_BOOK.getFxmlUrl()),
|
||||
false);
|
||||
orderBookLoader =
|
||||
new GuiceFXMLLoader(getClass().getResource(NavigationItem.ORDER_BOOK.getFxmlUrl()), false);
|
||||
try {
|
||||
final Parent view = orderBookLoader.load();
|
||||
final Tab tab = new Tab("Orderbook");
|
||||
|
@ -107,8 +107,8 @@ public class CreateOfferController extends CachedViewController {
|
||||
viewModel.bankAccountCounty.set(bankAccount.getCountry().getName());
|
||||
}
|
||||
viewModel.acceptedCountries.set(BitSquareFormatter.countryLocalesToString(settings.getAcceptedCountries()));
|
||||
viewModel.acceptedLanguages.set(BitSquareFormatter.languageLocalesToString(settings
|
||||
.getAcceptedLanguageLocales()));
|
||||
viewModel.acceptedLanguages.set(
|
||||
BitSquareFormatter.languageLocalesToString(settings.getAcceptedLanguageLocales()));
|
||||
viewModel.feeLabel.set(BitSquareFormatter.formatCoinWithCode(FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
|
||||
offerId = UUID.randomUUID().toString();
|
||||
@ -221,8 +221,8 @@ public class CreateOfferController extends CachedViewController {
|
||||
double price = BitSquareFormatter.parseToDouble(viewModel.price.get());
|
||||
double volume = amount * price;
|
||||
viewModel.volume.set(BitSquareFormatter.formatVolume(volume));
|
||||
viewModel.totals.set(BitSquareFormatter.formatTotalsAsBtc(viewModel.amount.get(), collateral,
|
||||
FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
viewModel.totals.set(BitSquareFormatter.formatTotalsAsBtc(
|
||||
viewModel.amount.get(), collateral, FeePolicy.CREATE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
viewModel.collateral.set(BitSquareFormatter.formatCollateralAsBtc(viewModel.amount.get(), collateral));
|
||||
});
|
||||
|
||||
|
@ -332,8 +332,8 @@ public class OrderBookController extends CachedViewController {
|
||||
|
||||
private void takeOffer(Offer offer) {
|
||||
if (isRegistered()) {
|
||||
TakerOfferController takerOfferController = (TakerOfferController) parentController
|
||||
.loadViewAndGetChildController(NavigationItem.TAKE_OFFER);
|
||||
TakerOfferController takerOfferController =
|
||||
(TakerOfferController) parentController.loadViewAndGetChildController(NavigationItem.TAKE_OFFER);
|
||||
|
||||
Coin requestedAmount;
|
||||
if (!"".equals(amount.getText())) {
|
||||
@ -357,8 +357,8 @@ public class OrderBookController extends CachedViewController {
|
||||
private void applyOffers() {
|
||||
orderBook.applyFilter(orderBookFilter);
|
||||
|
||||
priceColumn.setSortType((orderBookFilter.getDirection() == Direction.BUY) ? TableColumn.SortType.ASCENDING :
|
||||
TableColumn.SortType.DESCENDING);
|
||||
priceColumn.setSortType((orderBookFilter.getDirection() == Direction.BUY) ?
|
||||
TableColumn.SortType.ASCENDING : TableColumn.SortType.DESCENDING);
|
||||
orderBookTable.sort();
|
||||
|
||||
if (orderBookTable.getItems() != null) {
|
||||
@ -386,120 +386,124 @@ public class OrderBookController extends CachedViewController {
|
||||
|
||||
private void setDirectionColumnCellFactory() {
|
||||
directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
directionColumn.setCellFactory(new Callback<TableColumn<String, OrderBookListItem>, TableCell<String,
|
||||
OrderBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, OrderBookListItem> call(TableColumn<String, OrderBookListItem> directionColumn) {
|
||||
return new TableCell<String, OrderBookListItem>() {
|
||||
final ImageView iconView = new ImageView();
|
||||
final Button button = new Button();
|
||||
|
||||
{
|
||||
button.setGraphic(iconView);
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
directionColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, OrderBookListItem>, TableCell<String, OrderBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
public TableCell<String, OrderBookListItem> call(
|
||||
TableColumn<String, OrderBookListItem> directionColumn) {
|
||||
return new TableCell<String, OrderBookListItem>() {
|
||||
final ImageView iconView = new ImageView();
|
||||
final Button button = new Button();
|
||||
|
||||
if (orderBookListItem != null) {
|
||||
String title;
|
||||
Image icon;
|
||||
Offer offer = orderBookListItem.getOffer();
|
||||
|
||||
if (offer.getMessagePublicKey().equals(user.getMessagePublicKey())) {
|
||||
icon = ImageUtil.getIconImage(ImageUtil.REMOVE);
|
||||
title = "Remove";
|
||||
button.setOnAction(event -> removeOffer(orderBookListItem.getOffer()));
|
||||
} else {
|
||||
if (offer.getDirection() == Direction.SELL) {
|
||||
icon = buyIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.BUY, true);
|
||||
} else {
|
||||
icon = sellIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.SELL, true);
|
||||
}
|
||||
|
||||
button.setDefaultButton(getIndex() == 0);
|
||||
button.setOnAction(event -> takeOffer(orderBookListItem.getOffer()));
|
||||
{
|
||||
button.setGraphic(iconView);
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
|
||||
iconView.setImage(icon);
|
||||
button.setText(title);
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
if (orderBookListItem != null) {
|
||||
String title;
|
||||
Image icon;
|
||||
Offer offer = orderBookListItem.getOffer();
|
||||
|
||||
if (offer.getMessagePublicKey().equals(user.getMessagePublicKey())) {
|
||||
icon = ImageUtil.getIconImage(ImageUtil.REMOVE);
|
||||
title = "Remove";
|
||||
button.setOnAction(event -> removeOffer(orderBookListItem.getOffer()));
|
||||
} else {
|
||||
if (offer.getDirection() == Direction.SELL) {
|
||||
icon = buyIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.BUY, true);
|
||||
} else {
|
||||
icon = sellIcon;
|
||||
title = BitSquareFormatter.formatDirection(Direction.SELL, true);
|
||||
}
|
||||
|
||||
button.setDefaultButton(getIndex() == 0);
|
||||
button.setOnAction(event -> takeOffer(orderBookListItem.getOffer()));
|
||||
}
|
||||
|
||||
|
||||
iconView.setImage(icon);
|
||||
button.setText(title);
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setCountryColumnCellFactory() {
|
||||
countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
countryColumn.setCellFactory(new Callback<TableColumn<String, OrderBookListItem>, TableCell<String,
|
||||
OrderBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, OrderBookListItem> call(TableColumn<String, OrderBookListItem> directionColumn) {
|
||||
return new TableCell<String, OrderBookListItem>() {
|
||||
final HBox hBox = new HBox();
|
||||
|
||||
{
|
||||
hBox.setSpacing(3);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
setGraphic(hBox);
|
||||
}
|
||||
countryColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, OrderBookListItem>, TableCell<String, OrderBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
public TableCell<String, OrderBookListItem> call(
|
||||
TableColumn<String, OrderBookListItem> directionColumn) {
|
||||
return new TableCell<String, OrderBookListItem>() {
|
||||
final HBox hBox = new HBox();
|
||||
|
||||
hBox.getChildren().clear();
|
||||
if (orderBookListItem != null) {
|
||||
Country country = orderBookListItem.getOffer().getBankAccountCountry();
|
||||
try {
|
||||
hBox.getChildren().add(ImageUtil.getIconImageView("/images/countries/" + country
|
||||
.getCode().toLowerCase() + ".png"));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("Country icon not found: " + "/images/countries/" + country.getCode()
|
||||
.toLowerCase() + ".png country name: " + country.getName());
|
||||
{
|
||||
hBox.setSpacing(3);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
setGraphic(hBox);
|
||||
}
|
||||
Tooltip.install(this, new Tooltip(country.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
|
||||
hBox.getChildren().clear();
|
||||
if (orderBookListItem != null) {
|
||||
Country country = orderBookListItem.getOffer().getBankAccountCountry();
|
||||
try {
|
||||
hBox.getChildren().add(ImageUtil.getIconImageView(
|
||||
"/images/countries/" + country.getCode().toLowerCase() + ".png"));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("Country icon not found: /images/countries/" +
|
||||
country.getCode().toLowerCase() + ".png country name: " +
|
||||
country.getName());
|
||||
}
|
||||
Tooltip.install(this, new Tooltip(country.getName()));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void setBankAccountTypeColumnCellFactory() {
|
||||
bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
|
||||
bankAccountTypeColumn.setCellFactory(new Callback<TableColumn<String, OrderBookListItem>, TableCell<String,
|
||||
OrderBookListItem>>() {
|
||||
bankAccountTypeColumn.setCellFactory(
|
||||
new Callback<TableColumn<String, OrderBookListItem>, TableCell<String, OrderBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<String, OrderBookListItem> call(TableColumn<String, OrderBookListItem> directionColumn) {
|
||||
return new TableCell<String, OrderBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
public TableCell<String, OrderBookListItem> call(
|
||||
TableColumn<String, OrderBookListItem> directionColumn) {
|
||||
return new TableCell<String, OrderBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
|
||||
if (orderBookListItem != null) {
|
||||
BankAccountType bankAccountType = orderBookListItem.getOffer().getBankAccountType();
|
||||
setText(Localisation.get(bankAccountType.toString()));
|
||||
} else {
|
||||
setText("");
|
||||
}
|
||||
if (orderBookListItem != null) {
|
||||
BankAccountType bankAccountType = orderBookListItem.getOffer().getBankAccountType();
|
||||
setText(Localisation.get(bankAccountType.toString()));
|
||||
} else {
|
||||
setText("");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,10 +34,10 @@ public class OrderBookListItem {
|
||||
public OrderBookListItem(Offer offer) {
|
||||
this.offer = offer;
|
||||
this.price.set(BitSquareFormatter.formatPrice(offer.getPrice()));
|
||||
this.amount.set(BitSquareFormatter.formatCoin(offer.getAmount()) + " (" + BitSquareFormatter.formatCoin(offer
|
||||
.getMinAmount()) + ")");
|
||||
this.volume.set(BitSquareFormatter.formatVolumeWithMinVolume(offer.getOfferVolume(),
|
||||
offer.getMinOfferVolume()));
|
||||
this.amount.set(BitSquareFormatter.formatCoin(
|
||||
offer.getAmount()) + " (" + BitSquareFormatter.formatCoin(offer.getMinAmount()) + ")");
|
||||
this.volume.set(BitSquareFormatter.formatVolumeWithMinVolume(
|
||||
offer.getOfferVolume(), offer.getMinOfferVolume()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,22 +56,16 @@ public class TakerOfferController extends CachedViewController {
|
||||
private String tradeId;
|
||||
private String depositTxId;
|
||||
|
||||
@FXML
|
||||
private Accordion accordion;
|
||||
@FXML
|
||||
private TitledPane takeOfferTitledPane, waitBankTxTitledPane, summaryTitledPane;
|
||||
@FXML
|
||||
private ValidatedTextField amountTextField;
|
||||
@FXML
|
||||
private TextField priceTextField, volumeTextField, collateralTextField, feeTextField, totalTextField,
|
||||
@FXML private Accordion accordion;
|
||||
@FXML private TitledPane takeOfferTitledPane, waitBankTxTitledPane, summaryTitledPane;
|
||||
@FXML private ValidatedTextField amountTextField;
|
||||
@FXML private TextField priceTextField, volumeTextField, collateralTextField, feeTextField, totalTextField,
|
||||
bankAccountTypeTextField, countryTextField, arbitratorsTextField,
|
||||
supportedLanguagesTextField, supportedCountriesTextField, depositTxIdTextField, summaryPaidTextField,
|
||||
summaryReceivedTextField, summaryFeesTextField, summaryCollateralTextField,
|
||||
summaryDepositTxIdTextField, summaryPayoutTxIdTextField;
|
||||
@FXML
|
||||
private Label infoLabel, headLineLabel, collateralLabel;
|
||||
@FXML
|
||||
private Button takeOfferButton, receivedFiatButton;
|
||||
@FXML private Label infoLabel, headLineLabel, collateralLabel;
|
||||
@FXML private Button takeOfferButton, receivedFiatButton;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -122,8 +116,8 @@ public class TakerOfferController extends CachedViewController {
|
||||
|
||||
public void applyData() {
|
||||
amountTextField.setText(requestedAmount.toPlainString());
|
||||
amountTextField.setPromptText(BitSquareFormatter.formatCoinWithCode(offer.getMinAmount()) + " - " +
|
||||
BitSquareFormatter.formatCoinWithCode(offer.getAmount()));
|
||||
amountTextField.setPromptText(BitSquareFormatter.formatCoinWithCode(
|
||||
offer.getMinAmount()) + " - " + BitSquareFormatter.formatCoinWithCode(offer.getAmount()));
|
||||
priceTextField.setText(BitSquareFormatter.formatPrice(offer.getPrice()));
|
||||
applyVolume();
|
||||
collateralLabel.setText("Collateral (" + getCollateralAsPercent() + "):");
|
||||
@ -138,8 +132,8 @@ public class TakerOfferController extends CachedViewController {
|
||||
//todo list
|
||||
// arbitratorsTextField.setText(offer.getArbitrator().getName());
|
||||
|
||||
supportedLanguagesTextField.setText(BitSquareFormatter.languageLocalesToString(offer
|
||||
.getAcceptedLanguageLocales()));
|
||||
supportedLanguagesTextField.setText(BitSquareFormatter.languageLocalesToString(
|
||||
offer.getAcceptedLanguageLocales()));
|
||||
supportedCountriesTextField.setText(BitSquareFormatter.countryLocalesToString(offer.getAcceptedCountries()));
|
||||
|
||||
amountTextField.textProperty().addListener(e -> {
|
||||
@ -162,14 +156,14 @@ public class TakerOfferController extends CachedViewController {
|
||||
if (amountTextField.isInvalid()) {
|
||||
Popups.openErrorPopup("Invalid input", "The requested amount you entered is not a valid amount.");
|
||||
} else if (BitSquareValidator.tradeAmountOutOfRange(amount, offer)) {
|
||||
Popups.openErrorPopup("Invalid input", "The requested amount you entered is outside of the range of the " +
|
||||
"offered amount.");
|
||||
} else if (addressEntry == null || getTotal().compareTo(walletFacade.getBalanceForAddress(addressEntry
|
||||
.getAddress())) > 0) {
|
||||
Popups.openErrorPopup(
|
||||
"Invalid input", "The requested amount you entered is outside of the range of the offered amount.");
|
||||
} else if (addressEntry == null ||
|
||||
getTotal().compareTo(walletFacade.getBalanceForAddress(addressEntry.getAddress())) > 0) {
|
||||
Popups.openErrorPopup("Insufficient money", "You don't have enough funds for that trade.");
|
||||
} else if (tradeManager.isOfferAlreadyInTrades(offer)) {
|
||||
Popups.openErrorPopup("Offer previously accepted", "You have that offer already taken. Open the offer " +
|
||||
"section to find that trade.");
|
||||
Popups.openErrorPopup("Offer previously accepted",
|
||||
"You have that offer already taken. Open the offer section to find that trade.");
|
||||
} else {
|
||||
takeOfferButton.setDisable(true);
|
||||
amountTextField.setEditable(false);
|
||||
@ -198,10 +192,10 @@ public class TakerOfferController extends CachedViewController {
|
||||
|
||||
summaryPaidTextField.setText(BitSquareFormatter.formatCoinWithCode(trade.getTradeAmount()));
|
||||
summaryReceivedTextField.setText(BitSquareFormatter.formatVolume(trade.getTradeVolume()));
|
||||
summaryFeesTextField.setText(BitSquareFormatter.formatCoinWithCode(FeePolicy.TAKE_OFFER_FEE.add
|
||||
(FeePolicy.TX_FEE)));
|
||||
summaryCollateralTextField.setText(BitSquareFormatter.formatCoinWithCode(trade
|
||||
.getCollateralAmount()));
|
||||
summaryFeesTextField.setText(BitSquareFormatter.formatCoinWithCode(
|
||||
FeePolicy.TAKE_OFFER_FEE.add(FeePolicy.TX_FEE)));
|
||||
summaryCollateralTextField.setText(BitSquareFormatter.formatCoinWithCode(
|
||||
trade.getCollateralAmount()));
|
||||
summaryDepositTxIdTextField.setText(depositTxId);
|
||||
summaryPayoutTxIdTextField.setText(payoutTxId);
|
||||
}
|
||||
@ -209,8 +203,8 @@ public class TakerOfferController extends CachedViewController {
|
||||
@Override
|
||||
public void onFault(Throwable throwable, ProtocolForTakerAsSeller.State state) {
|
||||
log.error("Error while executing trade process at state: " + state + " / " + throwable);
|
||||
Popups.openErrorPopup("Error while executing trade process", "Error while executing trade process" +
|
||||
" at state: " + state + " / " + throwable);
|
||||
Popups.openErrorPopup("Error while executing trade process",
|
||||
"Error while executing trade process at state: " + state + " / " + throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,8 +78,10 @@ public class BtcValidator extends NumberValidator {
|
||||
BigDecimal bd = new BigDecimal(input);
|
||||
final BigDecimal satoshis = bd.movePointRight(8);
|
||||
if (satoshis.scale() > 0)
|
||||
return new ValidationResult(false, "Input results in a Bitcoin value with a fraction of the smallest unit" +
|
||||
" (Satoshi).", ErrorType.FRACTIONAL_SATOSHI);
|
||||
return new ValidationResult(
|
||||
false,
|
||||
"Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi).",
|
||||
ErrorType.FRACTIONAL_SATOSHI);
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
@ -88,7 +90,9 @@ public class BtcValidator extends NumberValidator {
|
||||
BigDecimal bd = new BigDecimal(input);
|
||||
final BigDecimal satoshis = bd.movePointRight(8);
|
||||
if (satoshis.longValue() > NetworkParameters.MAX_MONEY.longValue())
|
||||
return new ValidationResult(false, "Input larger as maximum possible Bitcoin value is not allowed.",
|
||||
return new ValidationResult(
|
||||
false,
|
||||
"Input larger as maximum possible Bitcoin value is not allowed.",
|
||||
ErrorType.EXCEEDS_MAX_BTC_VALUE);
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
|
@ -186,8 +186,8 @@ public class ConfidenceDisplay {
|
||||
latestTransaction = transaction;
|
||||
}
|
||||
}
|
||||
if (latestTransaction != null && (transaction == null || latestTransaction.getHashAsString().equals
|
||||
(transaction.getHashAsString()))) {
|
||||
if (latestTransaction != null && (transaction == null ||
|
||||
latestTransaction.getHashAsString().equals(transaction.getHashAsString()))) {
|
||||
updateConfidence(latestTransaction);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,9 @@ public class FiatValidator extends NumberValidator {
|
||||
protected ValidationResult validateIfNotExceedsMinFiatValue(String input) {
|
||||
double d = Double.parseDouble(input);
|
||||
if (d < MIN_FIAT_VALUE)
|
||||
return new ValidationResult(false, "Input smaller as minimum possible Fiat value is not allowed..",
|
||||
return new ValidationResult(
|
||||
false,
|
||||
"Input smaller as minimum possible Fiat value is not allowed..",
|
||||
ErrorType.UNDERCUT_MIN_FIAT_VALUE);
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
@ -72,7 +74,9 @@ public class FiatValidator extends NumberValidator {
|
||||
protected ValidationResult validateIfNotExceedsMaxFiatValue(String input) {
|
||||
double d = Double.parseDouble(input);
|
||||
if (d > MAX_FIAT_VALUE)
|
||||
return new ValidationResult(false, "Input larger as maximum possible Fiat value is not allowed.",
|
||||
return new ValidationResult(
|
||||
false,
|
||||
"Input larger as maximum possible Fiat value is not allowed.",
|
||||
ErrorType.EXCEEDS_MAX_FIAT_VALUE);
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
|
@ -55,8 +55,8 @@ public class ValidationHelper {
|
||||
|
||||
minAmountTextField.focusedProperty().addListener((ov, oldValue, newValue) -> {
|
||||
// only on focus out and ignore focus loss from window
|
||||
if (!newValue && minAmountTextField.getScene() != null && minAmountTextField.getScene().getWindow()
|
||||
.isFocused())
|
||||
if (!newValue && minAmountTextField.getScene() != null &&
|
||||
minAmountTextField.getScene().getWindow().isFocused())
|
||||
validateMinAmount(amountTextField,
|
||||
minAmountTextField,
|
||||
amount,
|
||||
|
@ -25,23 +25,24 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class CountryUtil {
|
||||
private static final String[] countryCodes = new String[]{"AE", "AL", "AR", "AT", "AU", "BA", "BE", "BG", "BH",
|
||||
"BO", "BR", "BY", "CA", "CH", "CL", "CN", "CO", "CR", "CS", "CU", "CY", "CZ",
|
||||
"DE", "DK", "DO", "DZ", "EC", "EE", "EG", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HR", "HU",
|
||||
"ID", "IE", "IL", "IN", "IQ", "IS", "IT", "JO", "JP", "KR", "KW", "LB", "LT", "LU",
|
||||
"LV", "LY", "MA", "ME", "MK", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "OM", "PA", "PE", "PH", "PL",
|
||||
"PR", "PT", "PY", "QA", "RO", "RS", "RU", "SA", "SD", "SE", "SG", "SI", "SK", "SV",
|
||||
"SY", "TH", "TN", "TR", "TW", "UA", "US", "UY", "VE", "VN", "YE", "ZA"};
|
||||
"BO", "BR", "BY", "CA", "CH", "CL", "CN", "CO", "CR", "CS", "CU", "CY", "CZ", "DE", "DK", "DO", "DZ",
|
||||
"EC", "EE", "EG", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HR", "HU", "ID", "IE", "IL", "IN",
|
||||
"IQ", "IS", "IT", "JO", "JP", "KR", "KW", "LB", "LT", "LU", "LV", "LY", "MA", "ME", "MK", "MT", "MX",
|
||||
"MY", "NI", "NL", "NO", "NZ", "OM", "PA", "PE", "PH", "PL", "PR", "PT", "PY", "QA", "RO", "RS", "RU",
|
||||
"SA", "SD", "SE", "SG", "SI", "SK", "SV", "SY", "TH", "TN", "TR", "TW", "UA", "US", "UY", "VE", "VN",
|
||||
"YE", "ZA"};
|
||||
private static final List<String> countryCodeList = Arrays.asList(countryCodes);
|
||||
private static final String[] regionCodes = new String[]{"AS", "EU", "SA", "EU", "OC", "EU", "EU", "EU", "AS",
|
||||
"SA", "SA", "EU", "NA", "EU", "SA", "AS", "SA", "NA", "EU", "NA", "AS", "EU",
|
||||
"EU", "EU", "NA", "AF", "SA", "EU", "AF", "EU", "EU", "EU", "EU", "EU", "NA", "AS", "NA", "EU", "EU",
|
||||
"AS", "EU", "AS", "AS", "AS", "EU", "EU", "AS", "AS", "AS", "AS", "AS", "EU", "EU",
|
||||
"EU", "AF", "AF", "EU", "EU", "EU", "NA", "AS", "NA", "EU", "EU", "OC", "AS", "NA", "SA", "AS", "EU",
|
||||
"NA", "EU", "SA", "AS", "EU", "EU", "EU", "AS", "AF", "EU", "AS", "EU", "EU", "NA",
|
||||
"AS", "AS", "AF", "AS", "AS", "EU", "NA", "SA", "SA", "AS", "AS", "AF"};
|
||||
"SA", "SA", "EU", "NA", "EU", "SA", "AS", "SA", "NA", "EU", "NA", "AS", "EU", "EU", "EU", "NA", "AF",
|
||||
"SA", "EU", "AF", "EU", "EU", "EU", "EU", "EU", "NA", "AS", "NA", "EU", "EU", "AS", "EU", "AS", "AS",
|
||||
"AS", "EU", "EU", "AS", "AS", "AS", "AS", "AS", "EU", "EU", "EU", "AF", "AF", "EU", "EU", "EU", "NA",
|
||||
"AS", "NA", "EU", "EU", "OC", "AS", "NA", "SA", "AS", "EU", "NA", "EU", "SA", "AS", "EU", "EU", "EU",
|
||||
"AS", "AF", "EU", "AS", "EU", "EU", "NA", "AS", "AS", "AF", "AS", "AS", "EU", "NA", "SA", "SA", "AS",
|
||||
"AS", "AF"};
|
||||
private static final List<String> regionCodeList = Arrays.asList(regionCodes);
|
||||
private static final String[][] regionCodeToName = new String[][]{{"NA", "North America"}, {"SA",
|
||||
"South America"}, {"AF", "Africa"}, {"EU", "Europe"}, {"AS", "Asia"}, {"OC", "Oceania"}};
|
||||
private static final String[][] regionCodeToName = new String[][]{
|
||||
{"NA", "North America"}, {"SA", "South America"}, {"AF", "Africa"}, {"EU", "Europe"}, {"AS", "Asia"},
|
||||
{"OC", "Oceania"}};
|
||||
|
||||
|
||||
public static List<Region> getAllRegions() {
|
||||
@ -75,8 +76,8 @@ public class CountryUtil {
|
||||
}
|
||||
|
||||
public static List<Country> getAllCountriesFor(Region selectedRegion) {
|
||||
return Lists.newArrayList(Collections2.filter(getAllCountries(), country -> selectedRegion != null && country
|
||||
!= null && selectedRegion.equals(country.getRegion())));
|
||||
return Lists.newArrayList(Collections2.filter(getAllCountries(), country ->
|
||||
selectedRegion != null && country != null && selectedRegion.equals(country.getRegion())));
|
||||
}
|
||||
|
||||
|
||||
@ -112,8 +113,9 @@ public class CountryUtil {
|
||||
|
||||
private static List<Locale> getAllCountryLocales() {
|
||||
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
|
||||
Set<Locale> allLocalesAsSet = allLocales.stream().filter(locale -> !"".equals(locale.getCountry())).map
|
||||
(locale -> new Locale("", locale.getCountry(), "")).collect(Collectors.toSet());
|
||||
Set<Locale> allLocalesAsSet =
|
||||
allLocales.stream().filter(locale -> !"".equals(locale.getCountry())).map(locale ->
|
||||
new Locale("", locale.getCountry(), "")).collect(Collectors.toSet());
|
||||
/*
|
||||
same as:
|
||||
Set<Locale> allLocalesAsSet = new HashSet<>();
|
||||
|
@ -41,8 +41,9 @@ public class LanguageUtil {
|
||||
|
||||
public static List<Locale> getAllLanguageLocales() {
|
||||
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
|
||||
final Set<Locale> allLocalesAsSet = allLocales.stream().filter(locale -> !"".equals(locale.getLanguage()))
|
||||
.map(locale -> new Locale(locale.getLanguage(), "")).collect(Collectors.toSet());
|
||||
final Set<Locale> allLocalesAsSet =
|
||||
allLocales.stream().filter(locale -> !"".equals(locale.getLanguage())).map(locale ->
|
||||
new Locale(locale.getLanguage(), "")).collect(Collectors.toSet());
|
||||
allLocales = new ArrayList<>();
|
||||
allLocales.addAll(allLocalesAsSet);
|
||||
allLocales.sort((locale1, locale2) -> locale1.getDisplayLanguage().compareTo(locale2.getDisplayLanguage()));
|
||||
|
@ -57,8 +57,8 @@ public class Localisation {
|
||||
|
||||
class UTF8Control extends ResourceBundle.Control {
|
||||
|
||||
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader,
|
||||
boolean reload) throws IllegalAccessException, InstantiationException, IOException {
|
||||
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)
|
||||
throws IllegalAccessException, InstantiationException, IOException {
|
||||
// The below is a copy of the default implementation.
|
||||
final String bundleName = toBundleName(baseName, locale);
|
||||
final String resourceName = toResourceName(bundleName, "properties");
|
||||
|
@ -53,6 +53,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static io.bitsquare.msg.SeedNodeAddress.StaticSeedNodeAddresses;
|
||||
|
||||
/**
|
||||
* Creates a DHT peer and bootstrap to a seed node
|
||||
*/
|
||||
@ -73,8 +75,8 @@ public class BootstrappedPeerFactory {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public BootstrappedPeerFactory(Persistence persistence, @Named("defaultSeedNode") SeedNodeAddress
|
||||
.StaticSeedNodeAddresses defaultStaticSeedNodeAddresses) {
|
||||
public BootstrappedPeerFactory(Persistence persistence,
|
||||
@Named("defaultSeedNode") StaticSeedNodeAddresses defaultStaticSeedNodeAddresses) {
|
||||
this.persistence = persistence;
|
||||
this.seedNodeAddress = new SeedNodeAddress(defaultStaticSeedNodeAddresses);
|
||||
}
|
||||
@ -154,8 +156,8 @@ public class BootstrappedPeerFactory {
|
||||
bootstrapWithRelay(peerDHT, nodeBehindNat);
|
||||
break;
|
||||
case "startPortForwarding":
|
||||
FutureDiscover futureDiscover = peerDHT.peer().discover().peerAddress(getBootstrapAddress())
|
||||
.start();
|
||||
FutureDiscover futureDiscover =
|
||||
peerDHT.peer().discover().peerAddress(getBootstrapAddress()).start();
|
||||
bootstrapWithPortForwarding(peerDHT, futureDiscover);
|
||||
break;
|
||||
case "default":
|
||||
@ -227,8 +229,8 @@ public class BootstrappedPeerFactory {
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
// Port forwarding has succeed
|
||||
log.debug("Port forwarding was successful. My address visible to the outside is " + futureNAT
|
||||
.peerAddress());
|
||||
log.debug("Port forwarding was successful. My address visible to the outside is " +
|
||||
futureNAT.peerAddress());
|
||||
requestBootstrapPeerMap();
|
||||
settableFuture.set(peerDHT);
|
||||
|
||||
|
@ -172,8 +172,8 @@ public class MessageFacade implements MessageBroker {
|
||||
if (future.isSuccess()) {
|
||||
Platform.runLater(() -> {
|
||||
addOfferListener.onComplete();
|
||||
orderBookListeners.stream().forEach(listener -> listener.onOfferAdded(data,
|
||||
future.isSuccess()));
|
||||
orderBookListeners.stream().forEach(listener ->
|
||||
listener.onOfferAdded(data, future.isSuccess()));
|
||||
|
||||
// TODO will be removed when we don't use polling anymore
|
||||
setDirty(locationKey);
|
||||
@ -214,8 +214,8 @@ public class MessageFacade implements MessageBroker {
|
||||
@Override
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
Platform.runLater(() -> {
|
||||
orderBookListeners.stream().forEach(orderBookListener -> orderBookListener.onOfferRemoved
|
||||
(data, future.isSuccess()));
|
||||
orderBookListeners.stream().forEach(orderBookListener ->
|
||||
orderBookListener.onOfferRemoved(data, future.isSuccess()));
|
||||
setDirty(locationKey);
|
||||
});
|
||||
if (future.isSuccess()) {
|
||||
@ -293,8 +293,8 @@ public class MessageFacade implements MessageBroker {
|
||||
addFuture.addListener(new BaseFutureAdapter<BaseFuture>() {
|
||||
@Override
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
Platform.runLater(() -> arbitratorListeners.stream().forEach(listener -> listener
|
||||
.onArbitratorAdded(arbitratorData, addFuture.isSuccess())));
|
||||
Platform.runLater(() -> arbitratorListeners.stream().forEach(listener ->
|
||||
listener.onArbitratorAdded(arbitratorData, addFuture.isSuccess())));
|
||||
if (addFuture.isSuccess()) {
|
||||
log.trace("Add arbitrator to DHT was successful. Stored data: [key: " + locationKey + ", " +
|
||||
"values: " + arbitratorData + "]");
|
||||
@ -317,8 +317,8 @@ public class MessageFacade implements MessageBroker {
|
||||
removeFuture.addListener(new BaseFutureAdapter<BaseFuture>() {
|
||||
@Override
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
Platform.runLater(() -> arbitratorListeners.stream().forEach(listener -> listener.onArbitratorRemoved
|
||||
(arbitratorData, removeFuture.isSuccess())));
|
||||
Platform.runLater(() -> arbitratorListeners.stream().forEach(listener ->
|
||||
listener.onArbitratorRemoved(arbitratorData, removeFuture.isSuccess())));
|
||||
if (removeFuture.isSuccess()) {
|
||||
log.trace("Remove arbitrator from DHT was successful. Stored data: [key: " + locationKey + ", " +
|
||||
"values: " + arbitratorData + "]");
|
||||
@ -472,8 +472,8 @@ public class MessageFacade implements MessageBroker {
|
||||
public void handleMessage(Object message, PeerAddress peerAddress) {
|
||||
if (message instanceof TradeMessage) {
|
||||
log.error("####################");
|
||||
Platform.runLater(() -> incomingTradeMessageListeners.stream().forEach(e -> e.onMessage((TradeMessage)
|
||||
message, peerAddress)));
|
||||
Platform.runLater(() -> incomingTradeMessageListeners.stream().forEach(e ->
|
||||
e.onMessage((TradeMessage) message, peerAddress)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ public class P2PNode {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// The data and the domain are protected by that key pair.
|
||||
public FuturePut putDomainProtectedData(Number160 locationKey, Data data) throws IOException,
|
||||
ClassNotFoundException {
|
||||
public FuturePut putDomainProtectedData(Number160 locationKey, Data data)
|
||||
throws IOException, ClassNotFoundException {
|
||||
data.protectEntry(keyPair);
|
||||
final Number160 ownerKeyHash = Utils.makeSHAHash(keyPair.getPublic().getEncoded());
|
||||
return peerDHT.put(locationKey).data(data).keyPair(keyPair).domainKey(ownerKeyHash).protectDomain().start();
|
||||
@ -174,8 +174,8 @@ public class P2PNode {
|
||||
}
|
||||
|
||||
// Not public readable. Only users with the public key of the peer who stored the data can read that data
|
||||
public FutureGet getDomainProtectedData(Number160 locationKey, PublicKey publicKey) throws IOException,
|
||||
ClassNotFoundException {
|
||||
public FutureGet getDomainProtectedData(Number160 locationKey, PublicKey publicKey)
|
||||
throws IOException, ClassNotFoundException {
|
||||
final Number160 ownerKeyHash = Utils.makeSHAHash(publicKey.getEncoded());
|
||||
return peerDHT.get(locationKey).domainKey(ownerKeyHash).start();
|
||||
}
|
||||
|
@ -214,8 +214,8 @@ public class TradeManager {
|
||||
Trade trade = createTrade(offer);
|
||||
trade.setTradeAmount(amount);
|
||||
|
||||
ProtocolForTakerAsSeller protocolForTakerAsSeller = new ProtocolForTakerAsSeller(trade, listener,
|
||||
messageFacade, walletFacade, blockChainFacade, cryptoFacade, user);
|
||||
ProtocolForTakerAsSeller protocolForTakerAsSeller = new ProtocolForTakerAsSeller(
|
||||
trade, listener, messageFacade, walletFacade, blockChainFacade, cryptoFacade, user);
|
||||
takerAsSellerProtocolMap.put(trade.getId(), protocolForTakerAsSeller);
|
||||
protocolForTakerAsSeller.start();
|
||||
|
||||
|
@ -118,8 +118,8 @@ public class OrderBook implements OrderBookListener {
|
||||
boolean countryResult = countryInList(offer.getBankAccountCountry(), settings.getAcceptedCountries());
|
||||
|
||||
// One of the supported languages from the settings must match one of the offer languages (n to n)
|
||||
boolean languageResult = languagesInList(settings.getAcceptedLanguageLocales(),
|
||||
offer.getAcceptedLanguageLocales());
|
||||
boolean languageResult =
|
||||
languagesInList(settings.getAcceptedLanguageLocales(), offer.getAcceptedLanguageLocales());
|
||||
|
||||
// Apply applyFilter only if there is a valid value set
|
||||
// The requested amount must be lower or equal then the offer amount
|
||||
|
@ -44,8 +44,8 @@ public class BroadCastOfferFeeTx {
|
||||
faultHandler.onFault("Offer fee payment failed.", e);
|
||||
}
|
||||
} else {
|
||||
faultHandler.onFault("Offer fee payment failed.", new Exception("Offer fee payment failed. " +
|
||||
"Transaction = null."));
|
||||
faultHandler.onFault("Offer fee payment failed.",
|
||||
new Exception("Offer fee payment failed. Transaction = null."));
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,10 +55,10 @@ public class BroadCastOfferFeeTx {
|
||||
}
|
||||
});
|
||||
} catch (InsufficientMoneyException e) {
|
||||
faultHandler.onFault("Offer fee payment failed because there is insufficient money in the trade pocket. " +
|
||||
"", e);
|
||||
faultHandler.onFault(
|
||||
"Offer fee payment failed because there is insufficient money in the trade pocket.", e);
|
||||
} catch (Throwable t) {
|
||||
faultHandler.onFault("Offer fee payment failed because of an exception occurred. ", t);
|
||||
faultHandler.onFault("Offer fee payment failed because an exception occurred.", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class CreateDepositTx {
|
||||
log.trace("Run task");
|
||||
try {
|
||||
String offererPubKey = walletFacade.getAddressInfoByTradeID(tradeId).getPubKeyAsHexString();
|
||||
Transaction transaction = walletFacade.offererCreatesMSTxAndAddPayment(offererInputAmount, offererPubKey,
|
||||
takerMultiSigPubKey, arbitratorPubKeyAsHex, tradeId);
|
||||
Transaction transaction = walletFacade.offererCreatesMSTxAndAddPayment(
|
||||
offererInputAmount, offererPubKey, takerMultiSigPubKey, arbitratorPubKeyAsHex, tradeId);
|
||||
|
||||
String preparedOffererDepositTxAsHex = Utils.HEX.encode(transaction.bitcoinSerialize());
|
||||
long offererTxOutIndex = transaction.getInput(0).getOutpoint().getIndex();
|
||||
@ -48,8 +48,8 @@ public class CreateDepositTx {
|
||||
resultHandler.onResult(offererPubKey, preparedOffererDepositTxAsHex, offererTxOutIndex);
|
||||
} catch (InsufficientMoneyException e) {
|
||||
log.error("Create deposit tx faultHandler.onFault due InsufficientMoneyException " + e);
|
||||
exceptionHandler.onError(new Exception("Create deposit tx faultHandler.onFault due " +
|
||||
"InsufficientMoneyException " + e));
|
||||
exceptionHandler.onError(
|
||||
new Exception("Create deposit tx faultHandler.onFault due InsufficientMoneyException " + e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,9 @@ public class HandleTakeOfferRequest {
|
||||
if (!takeOfferRequestAccepted) {
|
||||
log.info("Received take offer request but the offer not marked as open anymore.");
|
||||
}
|
||||
messageFacade.sendTradeMessage(peerAddress, new RespondToTakeOfferRequestMessage(tradeId,
|
||||
takeOfferRequestAccepted), new OutgoingTradeMessageListener() {
|
||||
RespondToTakeOfferRequestMessage tradeMessage =
|
||||
new RespondToTakeOfferRequestMessage(tradeId, takeOfferRequestAccepted);
|
||||
messageFacade.sendTradeMessage(peerAddress, tradeMessage, new OutgoingTradeMessageListener() {
|
||||
@Override
|
||||
public void onResult() {
|
||||
log.trace("RespondToTakeOfferRequestMessage successfully arrived at peer");
|
||||
|
@ -354,8 +354,8 @@ public class ProtocolForOffererAsBuyer {
|
||||
log.debug("state " + state);
|
||||
|
||||
// validation
|
||||
checkState(state.ordinal() >= State.SignAndPublishDepositTx.ordinal() && state.ordinal() <= State
|
||||
.onResultSetupListenerForBlockChainConfirmation.ordinal());
|
||||
checkState(state.ordinal() >= State.SignAndPublishDepositTx.ordinal() &&
|
||||
state.ordinal() <= State.onResultSetupListenerForBlockChainConfirmation.ordinal());
|
||||
|
||||
state = State.onUIEventBankTransferInited;
|
||||
|
||||
@ -423,5 +423,4 @@ public class ProtocolForOffererAsBuyer {
|
||||
listener.onFault(throwable, state);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ public class RequestTakerDepositPayment {
|
||||
String preparedOffererDepositTxAsHex,
|
||||
long offererTxOutIndex) {
|
||||
log.trace("Run task");
|
||||
RequestTakerDepositPaymentMessage tradeMessage = new RequestTakerDepositPaymentMessage(tradeId, bankAccount,
|
||||
accountId, offererPubKey, preparedOffererDepositTxAsHex, offererTxOutIndex);
|
||||
RequestTakerDepositPaymentMessage tradeMessage = new RequestTakerDepositPaymentMessage(
|
||||
tradeId, bankAccount, accountId, offererPubKey, preparedOffererDepositTxAsHex, offererTxOutIndex);
|
||||
messageFacade.sendTradeMessage(peerAddress, tradeMessage, new OutgoingTradeMessageListener() {
|
||||
@Override
|
||||
public void onResult() {
|
||||
|
@ -33,8 +33,9 @@ public class SendDepositTxIdToTaker {
|
||||
public static void run(ResultHandler resultHandler, ExceptionHandler exceptionHandler, PeerAddress peerAddress,
|
||||
MessageFacade messageFacade, String tradeId, Transaction depositTransaction) {
|
||||
log.trace("Run task");
|
||||
DepositTxPublishedMessage tradeMessage = new DepositTxPublishedMessage(tradeId,
|
||||
Utils.HEX.encode(depositTransaction.bitcoinSerialize()));
|
||||
DepositTxPublishedMessage tradeMessage =
|
||||
new DepositTxPublishedMessage(tradeId, Utils.HEX.encode(depositTransaction.bitcoinSerialize()));
|
||||
|
||||
messageFacade.sendTradeMessage(peerAddress, tradeMessage, new OutgoingTradeMessageListener() {
|
||||
@Override
|
||||
public void onResult() {
|
||||
|
@ -48,8 +48,8 @@ public class SendSignedPayoutTx {
|
||||
Coin offererPaybackAmount = tradeAmount.add(collateral);
|
||||
Coin takerPaybackAmount = collateral;
|
||||
|
||||
Pair<ECKey.ECDSASignature, String> result = walletFacade.offererCreatesAndSignsPayoutTx
|
||||
(depositTransactionId, offererPaybackAmount, takerPaybackAmount, takerPayoutAddress, tradeId);
|
||||
Pair<ECKey.ECDSASignature, String> result = walletFacade.offererCreatesAndSignsPayoutTx(
|
||||
depositTransactionId, offererPaybackAmount, takerPaybackAmount, takerPayoutAddress, tradeId);
|
||||
|
||||
ECKey.ECDSASignature offererSignature = result.getKey();
|
||||
String offererSignatureR = offererSignature.r.toString();
|
||||
|
@ -40,8 +40,8 @@ public class SetupListenerForBlockChainConfirmation {
|
||||
if (reason == ChangeReason.SEEN_PEERS) {
|
||||
listener.onDepositTxConfirmedUpdate(tx.getConfidence());
|
||||
}
|
||||
if (reason == ChangeReason.TYPE && tx.getConfidence().getConfidenceType() == TransactionConfidence
|
||||
.ConfidenceType.BUILDING) {
|
||||
if (reason == ChangeReason.TYPE &&
|
||||
tx.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) {
|
||||
listener.onDepositTxConfirmedInBlockchain();
|
||||
depositTransaction.getConfidence().removeEventListener(this);
|
||||
log.trace("Tx is in blockchain");
|
||||
|
@ -55,8 +55,8 @@ public class PayDeposit {
|
||||
resultHandler.onResult(signedTakerDepositTx);
|
||||
} catch (InsufficientMoneyException e) {
|
||||
log.error("Pay deposit faultHandler.onFault due InsufficientMoneyException " + e);
|
||||
exceptionHandler.onError(new Exception("Pay deposit faultHandler.onFault due InsufficientMoneyException "
|
||||
+ e));
|
||||
exceptionHandler.onError(
|
||||
new Exception("Pay deposit faultHandler.onFault due InsufficientMoneyException " + e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,14 +42,14 @@ public class PayTakeOfferFee {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
log.error("Take offer fee paid faultHandler.onFault with exception: " + t);
|
||||
exceptionHandler.onError(new Exception("Take offer fee paid faultHandler.onFault with exception: " +
|
||||
"" + t));
|
||||
exceptionHandler.onError(
|
||||
new Exception("Take offer fee paid faultHandler.onFault with exception: " + t));
|
||||
}
|
||||
});
|
||||
} catch (InsufficientMoneyException e) {
|
||||
log.error("Take offer fee paid faultHandler.onFault due InsufficientMoneyException " + e);
|
||||
exceptionHandler.onError(new Exception("Take offer fee paid faultHandler.onFault due " +
|
||||
"InsufficientMoneyException " + e));
|
||||
exceptionHandler.onError(
|
||||
new Exception("Take offer fee paid faultHandler.onFault due to InsufficientMoneyException " + e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,8 +318,8 @@ public class ProtocolForTakerAsSeller {
|
||||
log.debug("onBankTransferInitedMessage called " + step++);
|
||||
log.debug("state " + state);
|
||||
// validate
|
||||
checkState(state.ordinal() >= State.SendSignedTakerDepositTxAsHex.ordinal() && state.ordinal() < State
|
||||
.SignAndPublishPayoutTx.ordinal());
|
||||
checkState(state.ordinal() >= State.SendSignedTakerDepositTxAsHex.ordinal() &&
|
||||
state.ordinal() < State.SignAndPublishPayoutTx.ordinal());
|
||||
checkArgument(tradeId.equals(message.getTradeId()));
|
||||
String depositTxAsHex = nonEmptyStringOf(message.getDepositTxAsHex());
|
||||
String offererSignatureR = nonEmptyStringOf(message.getOffererSignatureR());
|
||||
|
@ -33,17 +33,17 @@ public class RequestTakeOffer {
|
||||
log.trace("Run task");
|
||||
messageFacade.sendTradeMessage(peerAddress, new RequestTakeOfferMessage(tradeId),
|
||||
new OutgoingTradeMessageListener() {
|
||||
@Override
|
||||
public void onResult() {
|
||||
log.trace("RequestTakeOfferMessage successfully arrived at peer");
|
||||
resultHandler.onResult();
|
||||
}
|
||||
@Override
|
||||
public void onResult() {
|
||||
log.trace("RequestTakeOfferMessage successfully arrived at peer");
|
||||
resultHandler.onResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
log.error("RequestTakeOfferMessage did not arrive at peer");
|
||||
exceptionHandler.onError(new Exception("RequestTakeOfferMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onFailed() {
|
||||
log.error("RequestTakeOfferMessage did not arrive at peer");
|
||||
exceptionHandler.onError(new Exception("RequestTakeOfferMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ public class SendSignedTakerDepositTxAsHex {
|
||||
@Override
|
||||
public void onFailed() {
|
||||
log.error("RequestOffererDepositPublicationMessage did not arrive at peer");
|
||||
exceptionHandler.onError(new Exception("RequestOffererDepositPublicationMessage did not arrive at " +
|
||||
"peer"));
|
||||
exceptionHandler.onError(
|
||||
new Exception("RequestOffererDepositPublicationMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -52,22 +52,21 @@ public class StorageDirectory {
|
||||
}
|
||||
|
||||
public static File getApplicationDirectory() {
|
||||
File executionRoot = new File(StorageDirectory.class.getProtectionDomain().getCodeSource().getLocation()
|
||||
.getFile());
|
||||
File executionRoot =
|
||||
new File(StorageDirectory.class.getProtectionDomain().getCodeSource().getLocation().getFile());
|
||||
try {
|
||||
log.trace("executionRoot " + executionRoot.getCanonicalPath());
|
||||
|
||||
// check if it is packed into a mac app (e.g.: "/Users/mk/Desktop/bitsquare.app/Contents/Java/bitsquare
|
||||
// .jar")
|
||||
if (executionRoot.getCanonicalPath().endsWith(".app/Contents/Java/bitsquare.jar") && System.getProperty
|
||||
("os.name").startsWith("Mac"))
|
||||
// check if it is packed into a mac app (e.g.: "$HOME/Desktop/bitsquare.app/Contents/Java/bitsquare.jar")
|
||||
if (executionRoot.getCanonicalPath().endsWith(".app/Contents/Java/bitsquare.jar") &&
|
||||
System.getProperty("os.name").startsWith("Mac"))
|
||||
return executionRoot.getParentFile().getParentFile().getParentFile().getParentFile();
|
||||
else if (executionRoot.getCanonicalPath().endsWith(File.separator + "target" + File.separator + "classes"))
|
||||
return executionRoot.getParentFile(); // dev e.g.:
|
||||
// /Users/mk/Documents/_intellij/bitsquare/target/classes -> use target as root
|
||||
// $HOME/Documents/_intellij/bitsquare/target/classes -> use target as root
|
||||
else if (executionRoot.getCanonicalPath().endsWith(File.separator + "bitsquare.jar"))
|
||||
return executionRoot.getParentFile(); // dev with jar e.g.:
|
||||
// Users/mk/Documents/_intellij/bitsquare/out/artifacts/bitsquare2/bitsquare.jar -> use target as root
|
||||
// $HOME/Documents/_intellij/bitsquare/out/artifacts/bitsquare2/bitsquare.jar -> use target as root
|
||||
else
|
||||
return executionRoot;
|
||||
} catch (IOException e) {
|
||||
@ -91,8 +90,8 @@ public class StorageDirectory {
|
||||
if (!storageDirectory.exists()) {
|
||||
boolean created = storageDirectory.mkdir();
|
||||
if (!created)
|
||||
throw new RuntimeException("Could not create the application data directory of '" + storageDirectory
|
||||
+ "'");
|
||||
throw new RuntimeException(
|
||||
"Could not create the application data directory of '" + storageDirectory + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ public class Utilities {
|
||||
private static long lastTimeStamp = System.currentTimeMillis();
|
||||
|
||||
public static String objectToJson(Object object) {
|
||||
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).setPrettyPrinting()
|
||||
.create();
|
||||
Gson gson =
|
||||
new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).setPrettyPrinting().create();
|
||||
return gson.toJson(object);
|
||||
}
|
||||
|
||||
public static <T> T jsonToObject(String jsonString, Class<T> classOfT) {
|
||||
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).setPrettyPrinting()
|
||||
.create();
|
||||
Gson gson =
|
||||
new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).setPrettyPrinting().create();
|
||||
return gson.fromJson(jsonString, classOfT);
|
||||
}
|
||||
|
||||
|
@ -146,8 +146,8 @@ public class P2PNodeTest {
|
||||
data.protectEntry(keyPairOtherPeer);
|
||||
// he use the pub key from the client
|
||||
final Number160 keyHash = Utils.makeSHAHash(keyPairClient.getPublic().getEncoded());
|
||||
futurePut = otherPeer.put(locationKey).data(data).keyPair(keyPairOtherPeer).domainKey(keyHash).protectDomain
|
||||
().start();
|
||||
futurePut = otherPeer.put(locationKey).data(data).keyPair(keyPairOtherPeer).domainKey(keyHash)
|
||||
.protectDomain().start();
|
||||
|
||||
futurePut.awaitUninterruptibly();
|
||||
assertFalse(futurePut.isSuccess());
|
||||
@ -169,8 +169,7 @@ public class P2PNodeTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangeEntryProtectionKey() throws IOException, ClassNotFoundException, NoSuchAlgorithmException,
|
||||
InterruptedException, InvalidKeyException, SignatureException {
|
||||
public void testChangeEntryProtectionKey() throws Exception {
|
||||
KeyPairGenerator gen = KeyPairGenerator.getInstance("DSA");
|
||||
|
||||
KeyPair keyPair1 = gen.generateKeyPair();
|
||||
@ -191,8 +190,8 @@ public class P2PNodeTest {
|
||||
|
||||
Data data2 = new Data().protectEntry(keyPair2);
|
||||
data2.publicKey(keyPair2.getPublic());
|
||||
FuturePut fp3 = p1.put(Number160.createHash("key1")).sign().putMeta().data(data2).start()
|
||||
.awaitUninterruptibly();
|
||||
FuturePut fp3 =
|
||||
p1.put(Number160.createHash("key1")).sign().putMeta().data(data2).start().awaitUninterruptibly();
|
||||
Assert.assertTrue(fp3.isSuccess());
|
||||
|
||||
FuturePut fp4 = p2.put(Number160.createHash("key1")).sign().data(data).start().awaitUninterruptibly();
|
||||
|
@ -1,20 +1,3 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2012 Thomas Bocek
|
||||
*
|
||||
@ -90,9 +73,8 @@ public class UtilsDHT2 {
|
||||
return createAddress(new Number160(id), "127.0.0.1", 8005, 8006, false, false);
|
||||
}
|
||||
|
||||
public static PeerAddress createAddress(Number160 idSender, String inetSender, int tcpPortSender,
|
||||
int udpPortSender, boolean firewallUDP,
|
||||
boolean firewallTCP) throws UnknownHostException {
|
||||
public static PeerAddress createAddress(Number160 idSender, String inetSender, int tcpPortSender, int udpPortSender,
|
||||
boolean firewallUDP, boolean firewallTCP) throws UnknownHostException {
|
||||
InetAddress inetSend = InetAddress.getByName(inetSender);
|
||||
PeerSocketAddress peerSocketAddress = new PeerSocketAddress(inetSend, tcpPortSender, udpPortSender);
|
||||
PeerAddress n1 = new PeerAddress(idSender, peerSocketAddress, firewallTCP, firewallUDP, false,
|
||||
@ -102,10 +84,8 @@ public class UtilsDHT2 {
|
||||
|
||||
public static Message createDummyMessage(Number160 idSender, String inetSender, int tcpPortSendor,
|
||||
int udpPortSender, Number160 idRecipien, String inetRecipient,
|
||||
int tcpPortRecipient,
|
||||
int udpPortRecipient, byte command, Type type, boolean firewallUDP,
|
||||
boolean firewallTCP)
|
||||
throws UnknownHostException {
|
||||
int tcpPortRecipient, int udpPortRecipient, byte command, Type type,
|
||||
boolean firewallUDP, boolean firewallTCP) throws UnknownHostException {
|
||||
Message message = new Message();
|
||||
PeerAddress n1 = createAddress(idSender, inetSender, tcpPortSendor, udpPortSender, firewallUDP,
|
||||
firewallTCP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user