fix confirmations, add logback, ui stuff, add country(local) to bankaccount

This commit is contained in:
Manfred Karrer 2014-04-28 17:26:26 +02:00
parent 6509441e8c
commit 8856e31d78
13 changed files with 303 additions and 117 deletions

44
pom.xml
View File

@ -7,7 +7,6 @@
<groupId>io.bitsquare</groupId>
<artifactId>bitsquare</artifactId>
<version>0.01-SNAPSHOT</version>
<name>BitSquare</name>
<description>A P2P Fiat-Bitcoin Exchange</description>
<url>https://www.bitsquare.io</url>
@ -21,13 +20,19 @@
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<name>GNU AFFERO GENERAL PUBLIC LICENSE</name>
<url>http://www.gnu.org/licenses/agpl-3.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/bitsquare/bitsquare/issues</url>
</issueManagement>
<scm>
<!-- Public read-only source -->
<url>https://github.com/bitsquare/bitsquare</url>
</scm>
@ -56,13 +61,21 @@
</repository>
</repositories>
<!-- TODO Maven build not working yet... -->
<build>
<finalName>bitsquare</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<filtering>true</filtering>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
@ -78,6 +91,7 @@
</plugins>
</build>
<dependencies>
<dependency>
@ -92,17 +106,24 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.6</version>
<version>1.7.7</version>
</dependency>
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.9</version>
<version>1.1.2</version>
<scope>compile</scope>
</dependency>
@ -151,6 +172,17 @@
</dependencies>
<reporting>
<plugins>
<!-- Generate cross-referenced HTML source code listing -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</reporting>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -58,7 +58,7 @@ public class BitSquare extends Application
@Override
public void stop() throws Exception
{
walletFacade.terminateWallet();
walletFacade.shutDown();
super.stop();
}

View File

@ -1,16 +1,20 @@
package io.bitsquare.bank;
import java.io.Serializable;
import java.util.Locale;
public class BankAccount implements Serializable
{
private static final long serialVersionUID = 1792577576443221268L;
private static final long VERSION = 1;
private BankAccountType bankAccountType;
private String accountPrimaryID;
private String accountSecondaryID;
private String accountHolderName;
private Locale locale;
public BankAccountType bankAccountType;
public String accountPrimaryID;
public String accountSecondaryID;
public String accountHolderName;
private String uid;
// TODO just for mock yet
@ -19,14 +23,15 @@ public class BankAccount implements Serializable
this.bankAccountType = bankAccountType;
}
public BankAccount(BankAccountType bankAccountType, String accountPrimaryID, String accountSecondaryID, String accountHolderName)
public BankAccount(BankAccountType bankAccountType, String accountPrimaryID, String accountSecondaryID, String accountHolderName, Locale locale)
{
this.bankAccountType = bankAccountType;
this.accountPrimaryID = accountPrimaryID;
this.accountSecondaryID = accountSecondaryID;
this.accountHolderName = accountHolderName;
this.locale = locale;
uid = bankAccountType + "_" + accountPrimaryID + "_" + accountSecondaryID + "_" + accountHolderName;
uid = bankAccountType + "_" + accountPrimaryID + "_" + accountSecondaryID + "_" + accountHolderName + "_" + locale.getISO3Country();
}
public String getAccountPrimaryID()
@ -54,14 +59,16 @@ public class BankAccount implements Serializable
return uid;
}
@Override
public String toString()
// Changes of that structure must be reflected in VERSION updates
public String getStringifiedBankAccount()
{
return "BankAccount{" +
"bankAccountType=" + bankAccountType +
", accountPrimaryID='" + accountPrimaryID + '\'' +
", accountSecondaryID='" + accountSecondaryID + '\'' +
", accountHolderName='" + accountHolderName + '\'' +
return "{" +
"type=" + bankAccountType +
", primaryID='" + accountPrimaryID + '\'' +
", secondaryID='" + accountSecondaryID + '\'' +
", holderName='" + accountHolderName + '\'' +
", country='" + locale.getISO3Country() + '\'' +
", v='" + VERSION + '\'' +
'}';
}
}

View File

@ -17,7 +17,6 @@ import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static com.google.bitcoin.script.ScriptOpCodes.OP_RETURN;
@ -25,8 +24,11 @@ import static com.google.bitcoin.script.ScriptOpCodes.OP_RETURN;
public class AccountRegistrationWallet extends Wallet implements WalletEventListener
{
private static final Logger log = LoggerFactory.getLogger(AccountRegistrationWallet.class);
private final File walletFile;
private NetworkParameters networkParameters;
private BlockChain chain;
private PeerGroup peerGroup;
private List<WalletFacade.WalletListener> walletListeners = new ArrayList<>();
AccountRegistrationWallet(NetworkParameters networkParameters, BlockChain chain, PeerGroup peerGroup)
@ -34,8 +36,10 @@ public class AccountRegistrationWallet extends Wallet implements WalletEventList
super(networkParameters);
this.networkParameters = networkParameters;
this.chain = chain;
this.peerGroup = peerGroup;
File walletFile = new File(".", "bitsquare_account_reg" + ".wallet");
walletFile = new File(".", "bitsquare_account_reg" + ".wallet");
if (walletFile.exists())
{
try
@ -60,9 +64,27 @@ public class AccountRegistrationWallet extends Wallet implements WalletEventList
chain.addWallet(this);
peerGroup.addWallet(this);
try
{
saveToFile(walletFile);
} catch (IOException e)
{
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
autosaveToFile(walletFile, 1, TimeUnit.SECONDS, null);
}
void shutDown()
{
try
{
saveToFile(walletFile);
} catch (IOException e)
{
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
Address getAddress()
{
return getKey().toAddress(networkParameters);
@ -148,7 +170,7 @@ public class AccountRegistrationWallet extends Wallet implements WalletEventList
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx)
{
for (WalletFacade.WalletListener walletListener : walletListeners)
walletListener.onConfidenceChanged(tx.getConfidence().numBroadcastPeers(), tx.getConfidence().getDepthInBlocks());
walletListener.onConfidenceChanged(tx.getConfidence().numBroadcastPeers(), WalletUtil.getConfirmationDepthInBlocks(this));
log.info("onTransactionConfidenceChanged " + tx.getConfidence().toString());
}
@ -185,24 +207,8 @@ public class AccountRegistrationWallet extends Wallet implements WalletEventList
int getConfirmationNumBroadcastPeers()
{
Transaction transaction = getTransaction();
Transaction transaction = WalletUtil.getTransaction(this);
return (transaction == null || transaction.getConfidence() == null) ? 0 : transaction.getConfidence().numBroadcastPeers();
}
int getConfirmationDepthInBlocks()
{
Transaction transaction = getTransaction();
return (transaction == null || transaction.getConfidence() == null) ? 0 : transaction.getConfidence().getDepthInBlocks();
}
//TODO only 1 tx supported yet...
private Transaction getTransaction()
{
Set<Transaction> transactions = getTransactions(true);
if (transactions != null && transactions.size() == 1)
{
return transactions.iterator().next();
}
return null;
}
}

View File

@ -87,8 +87,10 @@ public class WalletFacade implements WalletEventListener
log.info(walletAppKit.wallet().toString());
}
public void terminateWallet()
public void shutDown()
{
if (accountRegistrationWallet != null)
accountRegistrationWallet.shutDown();
walletAppKit.stopAsync();
walletAppKit.awaitTerminated();
}
@ -176,7 +178,7 @@ public class WalletFacade implements WalletEventListener
public int getRegistrationConfirmationDepthInBlocks()
{
return getAccountRegistrationWallet().getConfirmationDepthInBlocks();
return WalletUtil.getConfirmationDepthInBlocks(getAccountRegistrationWallet());
}
// WalletEventListener
@ -193,7 +195,7 @@ public class WalletFacade implements WalletEventListener
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx)
{
for (WalletListener walletListener : walletListeners)
walletListener.onConfidenceChanged(tx.getConfidence().numBroadcastPeers(), tx.getConfidence().getDepthInBlocks());
walletListener.onConfidenceChanged(tx.getConfidence().numBroadcastPeers(), WalletUtil.getConfirmationDepthInBlocks(walletAppKit.wallet()));
log.info("onTransactionConfidenceChanged " + tx.getConfidence().toString());
}
@ -271,4 +273,6 @@ public class WalletFacade implements WalletEventListener
void onCoinsReceived(BigInteger newBalance);
}
}

View File

@ -0,0 +1,42 @@
package io.bitsquare.btc;
import com.google.bitcoin.core.Transaction;
import com.google.bitcoin.core.TransactionConfidence;
import com.google.bitcoin.core.Wallet;
import java.math.BigInteger;
import java.util.Set;
public class WalletUtil
{
// TODO check if that is correct and safe
public static int getConfirmationDepthInBlocks(Wallet wallet)
{
Transaction transaction = WalletUtil.getTransaction(wallet);
if (transaction != null && transaction.getConfidence() != null)
{
int appearedAtChainHeight = (transaction.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) ? transaction.getConfidence().getAppearedAtChainHeight() : 0;
return wallet.getLastBlockSeenHeight() - appearedAtChainHeight + 1;
}
else
{
return 0;
}
}
// TODO check if that is correct and safe
public static Transaction getTransaction(Wallet wallet)
{
Set<Transaction> transactions = wallet.getTransactions(true);
if (transactions != null)
{
for (Transaction transaction : transactions)
{
if (transaction.getValueSentFromMe(wallet).compareTo(BigInteger.ZERO) == 0)
return transaction;
}
}
return null;
}
}

View File

@ -46,18 +46,18 @@ public class MainController implements Initializable, NavigationController, Wall
private ToggleGroup toggleGroup;
private ToggleButton prevToggleButton;
private Image prevToggleButtonIcon;
// public ProgressBar networkSyncProgressBar;
//public Label networkSyncInfoLabel;
private Pane setupView;
private SetupController setupController;
private NetworkSyncPane networkSyncPane;
@FXML
public Pane contentPane;
@FXML
public HBox leftNavPane, rightNavPane;
@FXML
public StackPane rootContainer;
@FXML
public AnchorPane anchorPane;
private NetworkSyncPane networkSyncPane;
@Inject
public MainController(Settings settings, User user, OrderBookFilter orderBookFilter, WalletFacade walletFacade)
@ -74,24 +74,20 @@ public class MainController implements Initializable, NavigationController, Wall
networkSyncPane = new NetworkSyncPane();
networkSyncPane.setSpacing(10);
networkSyncPane.setPrefHeight(20);
AnchorPane.setBottomAnchor(networkSyncPane, 0.0);
AnchorPane.setLeftAnchor(networkSyncPane, 0.0);
walletFacade.addDownloadListener(this);
walletFacade.initWallet();
buildNavigation();
if (user.getAccountID() != null)
{
anchorPane.getChildren().add(networkSyncPane);
}
else
if (user.getAccountID() == null)
{
buildSetupView();
anchorPane.setOpacity(0);
setupController.setNetworkSyncPane(networkSyncPane);
rootContainer.getChildren().add(setupView);
}
AnchorPane.setBottomAnchor(networkSyncPane, 0.0);
AnchorPane.setLeftAnchor(networkSyncPane, 0.0);
}

View File

@ -7,7 +7,7 @@
<AnchorPane fx:id="anchorPane" id="root-pane" minHeight="300" minWidth="400" prefHeight="600" prefWidth="800">
<HBox fx:id="leftNavPane" spacing="10" AnchorPane.leftAnchor="0" AnchorPane.topAnchor="0"/>
<HBox fx:id="rightNavPane" spacing="10" AnchorPane.rightAnchor="10" AnchorPane.topAnchor="0"/>
<AnchorPane id="content-pane" fx:id="contentPane" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="0"
<AnchorPane fx:id="contentPane" id="content-pane" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="60"/>
</AnchorPane>
</StackPane>

View File

@ -18,8 +18,6 @@ import io.bitsquare.gui.util.Formatter;
import io.bitsquare.settings.Settings;
import io.bitsquare.storage.Storage;
import io.bitsquare.user.User;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
@ -29,6 +27,7 @@ import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -47,11 +46,11 @@ public class SetupController implements Initializable, ChildController, WalletFa
private Storage storage;
private List<ProcessStepItem> processStepItems = new ArrayList();
private int depthInBlocks = 0;
private NavigationController navigationController;
private ImageView confirmIconImageView;
private TextField balanceLabel, confirmationsLabel;
private TextField balanceLabel, confirmationsLabel, accountHolderName, accountPrimaryID, accountSecondaryID;
private ComboBox countryComboBox, bankTransferTypeComboBox;
@FXML
private AnchorPane rootContainer;
@ -102,8 +101,6 @@ public class SetupController implements Initializable, ChildController, WalletFa
@Override
public void onConfidenceChanged(int numBroadcastPeers, int depthInBlocks)
{
this.depthInBlocks = depthInBlocks;
updateCreateAccountButton();
confirmIconImageView.setImage(getConfirmIconImage(numBroadcastPeers, depthInBlocks));
confirmationsLabel.setText(getConfirmationsText(numBroadcastPeers, depthInBlocks));
@ -145,6 +142,12 @@ public class SetupController implements Initializable, ChildController, WalletFa
return Icons.getIconImage(Icons.getIconIDForPeersSeenTx(numBroadcastPeers));
}
private void updateCreateAccountButton()
{
boolean funded = walletFacade.getAccountRegistrationBalance().compareTo(BigInteger.ZERO) > 0;
nextButton.setDisable(!funded || walletFacade.getRegistrationConfirmationDepthInBlocks() == 0);
}
///////////////////////////////////////////////////////////////////////////////////
// GUI BUILDER
@ -202,9 +205,7 @@ public class SetupController implements Initializable, ChildController, WalletFa
buildStep1();
});
skipButton.setOnAction(e -> {
close();
});
skipButton.setOnAction(e -> close());
}
private void buildStep1()
@ -215,45 +216,81 @@ public class SetupController implements Initializable, ChildController, WalletFa
formGridPane.getChildren().clear();
int gridRow = -1;
ComboBox bankTransferTypes = FormBuilder.addComboBox(formGridPane, "Bank account type:", settings.getAllBankAccountTypes(), ++gridRow);
bankTransferTypes.setPromptText("Select");
//TODO dev
bankTransferTypes.getSelectionModel().select(1);
TextField accountHolderName = FormBuilder.addInputField(formGridPane, "Bank account holder name:", "Bob Brown", ++gridRow);
TextField accountPrimaryID = FormBuilder.addInputField(formGridPane, "Bank account primary ID", "dummy IBAN", ++gridRow);
TextField accountSecondaryID = FormBuilder.addInputField(formGridPane, "Bank account secondary ID:", "dummy BIC", ++gridRow);
bankTransferTypeComboBox = FormBuilder.addComboBox(formGridPane, "Bank account type:", settings.getAllBankAccountTypes(), ++gridRow);
bankTransferTypeComboBox.setPromptText("Select bank account type");
accountHolderName = FormBuilder.addInputField(formGridPane, "Bank account holder name:", "", ++gridRow);
accountPrimaryID = FormBuilder.addInputField(formGridPane, "Bank account primary ID", "", ++gridRow);
accountSecondaryID = FormBuilder.addInputField(formGridPane, "Bank account secondary ID:", "", ++gridRow);
countryComboBox = FormBuilder.addComboBox(formGridPane, "Country:", settings.getAllLocales("displayCountry"), ++gridRow);
countryComboBox.setPromptText("Select country");
countryComboBox.setConverter(new StringConverter()
{
@Override
public String toString(Object o)
{
return ((Locale) o).getDisplayCountry();
}
@Override
public Object fromString(String s)
{
return s;
}
});
Button addButton = new Button("Add other Bank account");
formGridPane.add(addButton, 1, ++gridRow);
nextButton.setText("Create account");
nextButton.setDisable(true);
checkCreateAccountButtonState();
skipButton.setText("Register later");
// handlers
bankTransferTypes.valueProperty().addListener(new ChangeListener<Object>()
{
@Override
public void changed(ObservableValue ov, Object oldValue, Object newValue)
{
if (newValue != null && newValue instanceof BankAccountType)
{
BankAccountType bankAccountType = (BankAccountType) newValue;
accountPrimaryID.setText("");
accountPrimaryID.setPromptText(bankAccountType.getPrimaryIDName());
accountSecondaryID.setText("");
accountSecondaryID.setPromptText(bankAccountType.getSecondaryIDName());
accountHolderName.focusedProperty().addListener((ov, oldValue, newValue) -> checkCreateAccountButtonState());
accountPrimaryID.focusedProperty().addListener((ov, oldValue, newValue) -> checkCreateAccountButtonState());
accountSecondaryID.focusedProperty().addListener((ov, oldValue, newValue) -> checkCreateAccountButtonState());
nextButton.setDisable(false);
bankTransferTypeComboBox.valueProperty().addListener((ov, oldValue, newValue) -> {
if (newValue != null && newValue instanceof BankAccountType)
{
BankAccountType bankAccountType = (BankAccountType) newValue;
accountPrimaryID.setText("");
accountPrimaryID.setPromptText(bankAccountType.getPrimaryIDName());
accountSecondaryID.setText("");
accountSecondaryID.setPromptText(bankAccountType.getSecondaryIDName());
checkCreateAccountButtonState();
}
});
countryComboBox.valueProperty().addListener((ov, oldValue, newValue) -> {
if (newValue != null && newValue instanceof BankAccountType)
{
if (newValue != null)
{
checkCreateAccountButtonState();
}
}
});
addButton.setOnAction(e -> {
if (bankTransferTypes.getSelectionModel() != null && verifyBankAccountData(bankTransferTypes.getSelectionModel().getSelectedItem(), accountPrimaryID.getText(), accountSecondaryID.getText(), accountHolderName.getText()))
if (bankTransferTypeComboBox.getSelectionModel() != null
&& verifyBankAccountData(bankTransferTypeComboBox.getSelectionModel().getSelectedItem(),
accountPrimaryID.getText(),
accountSecondaryID.getText(),
accountHolderName.getText()))
{
user.addBankAccount(new BankAccount((BankAccountType) bankTransferTypes.getSelectionModel().getSelectedItem(), accountPrimaryID.getText(), accountSecondaryID.getText(), accountHolderName.getText()));
user.addBankAccount(new BankAccount(
(BankAccountType) bankTransferTypeComboBox.getSelectionModel().getSelectedItem(),
accountPrimaryID.getText(),
accountSecondaryID.getText(),
accountHolderName.getText(),
(Locale) countryComboBox.getSelectionModel().getSelectedItem())
);
bankTransferTypes.getSelectionModel().clearSelection();
bankTransferTypeComboBox.getSelectionModel().clearSelection();
accountPrimaryID.setText("");
accountPrimaryID.setPromptText("");
accountSecondaryID.setText("");
@ -262,8 +299,21 @@ public class SetupController implements Initializable, ChildController, WalletFa
});
nextButton.setOnAction(e -> {
if (bankTransferTypes.getSelectionModel() != null && verifyBankAccountData(bankTransferTypes.getSelectionModel().getSelectedItem(), accountPrimaryID.getText(), accountSecondaryID.getText(), accountHolderName.getText()))
user.addBankAccount(new BankAccount((BankAccountType) bankTransferTypes.getSelectionModel().getSelectedItem(), accountPrimaryID.getText(), accountSecondaryID.getText(), accountHolderName.getText()));
boolean inputValid = verifyBankAccountData(bankTransferTypeComboBox.getSelectionModel().getSelectedItem(),
accountPrimaryID.getText(),
accountSecondaryID.getText(),
accountHolderName.getText());
if (bankTransferTypeComboBox.getSelectionModel() != null && countryComboBox.getSelectionModel() != null && inputValid)
{
BankAccount bankAccount = new BankAccount((BankAccountType) bankTransferTypeComboBox.getSelectionModel().getSelectedItem(),
accountPrimaryID.getText(),
accountSecondaryID.getText(),
accountHolderName.getText(),
(Locale) countryComboBox.getSelectionModel().getSelectedItem());
user.addBankAccount(bankAccount);
}
if (user.getBankAccounts().size() > 0)
{
@ -280,7 +330,6 @@ public class SetupController implements Initializable, ChildController, WalletFa
} catch (InsufficientMoneyException e1)
{
log.warn(e1.toString());
//e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
else
@ -290,9 +339,19 @@ public class SetupController implements Initializable, ChildController, WalletFa
}
});
skipButton.setOnAction(e -> {
close();
});
skipButton.setOnAction(e -> close());
}
private void checkCreateAccountButtonState()
{
boolean enabled = accountHolderName.getText().length() > 0
&& accountPrimaryID.getText().length() > 0
&& accountSecondaryID.getText().length() > 0
&& bankTransferTypeComboBox.getSelectionModel() != null
&& bankTransferTypeComboBox.getSelectionModel().getSelectedItem() != null
&& countryComboBox.getSelectionModel() != null
&& countryComboBox.getSelectionModel().getSelectedItem() != null;
nextButton.setDisable(!enabled);
}
private void buildStep2()
@ -322,9 +381,7 @@ public class SetupController implements Initializable, ChildController, WalletFa
skipButton.setOpacity(0);
// handlers
nextButton.setOnAction(e -> {
close();
});
nextButton.setOnAction(e -> close());
}
// util
@ -336,11 +393,5 @@ public class SetupController implements Initializable, ChildController, WalletFa
FormBuilder.addInputField(formGridPane, "Bank account secondary ID:", bankAccount.getAccountSecondaryID(), ++row).setMouseTransparent(true);
return row;
}
private void updateCreateAccountButton()
{
boolean funded = walletFacade.getAccountRegistrationBalance().compareTo(BigInteger.ZERO) > 0;
nextButton.setDisable(!funded || depthInBlocks == 0);
}
}

View File

@ -5,9 +5,8 @@ import io.bitsquare.bank.BankAccountType;
import io.bitsquare.storage.Storage;
import io.bitsquare.trade.orderbook.OrderBookFilter;
import java.util.ArrayList;
import java.util.Currency;
import java.util.Locale;
import java.util.*;
import java.util.function.Predicate;
public class Settings
{
@ -98,16 +97,37 @@ public class Settings
bankTransferTypes.add("AT");
return bankTransferTypes;
}
/*
public ArrayList<String> getAllCountries()
public ArrayList<Locale> getAllLocales(String sortField)
{
ArrayList<String> result = new ArrayList<>();
for (Locale locale : Locale.getAvailableLocales())
ArrayList<Locale> list = new ArrayList<Locale>(Arrays.asList(Locale.getAvailableLocales()));
list.removeIf(new Predicate<Locale>()
{
result.add(locale.getDisplayCountry());
}
return result;
} */
@Override
public boolean test(Locale locale)
{
return locale == null || locale.getCountry().equals("") || locale.getLanguage().equals("");
}
});
list.sort(new Comparator()
{
@Override
public int compare(Object o1, Object o2)
{
if (sortField.equals("displayCountry"))
return (((Locale) o1).getDisplayCountry()).compareTo(((Locale) o2).getDisplayCountry());
else
return 1;
}
});
Locale defaultLocale = Locale.getDefault();
list.remove(defaultLocale);
list.add(0, defaultLocale);
return list;
}
/*public ArrayList<String> getAllLanguages()
{

View File

@ -41,8 +41,8 @@ public class User implements Serializable
String bankAccountUIDs = "";
for (Iterator<Map.Entry<String, BankAccount>> iterator = getBankAccounts().entrySet().iterator(); iterator.hasNext(); )
{
Map.Entry entry = iterator.next();
bankAccountUIDs += entry.getValue().toString();
Map.Entry<String, BankAccount> entry = iterator.next();
bankAccountUIDs += entry.getValue().getStringifiedBankAccount();
if (iterator.hasNext())
bankAccountUIDs += ", ";

View File

@ -0,0 +1 @@
com.google.bitcoin = FATAL

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--
-->
<appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %xEx%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE_APPENDER"/>
</root>
<logger name="io.bitsquare" level="DEBUG"/>
<logger name="com.google.bitcoin" level="WARN"/>
<logger name="com.google.bitcoin.core.PeerGroup" level="ERROR" additivity="false"/>
<logger name="com.google.bitcoin.net.NioClientManager" level="ERROR" additivity="false"/>
<logger name="com.google.bitcoin.net.ConnectionHandler" level="ERROR" additivity="false"/>
<!--
-->
</configuration>