diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 61994529a0..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "libs/bitcoinj"] - path = libs/bitcoinj - url = git://github.com/bitcoinj/bitcoinj diff --git a/src/main/java/io/bitsquare/BitSquare.java b/src/main/java/io/bitsquare/BitSquare.java index f297826e9c..a9dd68166a 100644 --- a/src/main/java/io/bitsquare/BitSquare.java +++ b/src/main/java/io/bitsquare/BitSquare.java @@ -1,19 +1,25 @@ package io.bitsquare; +import com.google.common.base.Throwables; import com.google.inject.Guice; import com.google.inject.Injector; import io.bitsquare.btc.WalletFacade; import io.bitsquare.di.BitSquareModule; import io.bitsquare.di.GuiceFXMLLoader; +import io.bitsquare.gui.NavigationViewURL; +import io.bitsquare.gui.popups.Popups; import io.bitsquare.locale.Localisation; import io.bitsquare.msg.MessageFacade; import io.bitsquare.settings.Settings; import io.bitsquare.storage.Storage; import io.bitsquare.user.User; import javafx.application.Application; +import javafx.application.Platform; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; +import org.controlsfx.control.action.Action; +import org.controlsfx.dialog.Dialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,14 +40,26 @@ public class BitSquare extends Application launch(args); } + public static Stage getStage() + { + return stage; + } + @Override - public void start(Stage stage) throws Exception + public void start(Stage stage) + { + Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> Popups.handleUncaughtExceptions(Throwables.getRootCause(throwable))); + init(stage); + } + + private void init(Stage stage) { BitSquare.stage = stage; + log.debug("Startup: start"); final Injector injector = Guice.createInjector(new BitSquareModule()); - walletFacade = injector.getInstance(WalletFacade.class); + walletFacade = injector.getInstance(WalletFacade.class); messageFacade = injector.getInstance(MessageFacade.class); log.debug("Startup: messageFacade, walletFacade inited"); @@ -60,22 +78,31 @@ public class BitSquare extends Application GuiceFXMLLoader.setInjector(injector); - final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource("/io/bitsquare/gui/MainView.fxml"), Localisation.getResourceBundle()); - final Parent mainView = loader.load(); - - final Scene scene = new Scene(mainView, 800, 600); - stage.setScene(scene); - - final String bitsquare = getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm(); - scene.getStylesheets().setAll(bitsquare); stage.setMinWidth(800); stage.setMinHeight(400); stage.setWidth(800); stage.setHeight(600); - stage.show(); - log.debug("Startup: stage displayed"); + try + { + final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(NavigationViewURL.MAIN), Localisation.getResourceBundle()); + final Parent mainView = loader.load(); + final Scene scene = new Scene(mainView, 800, 600); + stage.setScene(scene); + + final String bitsquare = getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm(); + scene.getStylesheets().setAll(bitsquare); + + stage.show(); + log.debug("Startup: stage displayed"); + } catch (Exception e) + { + stage.show(); + Action response = Popups.openExceptionPopup(e); + if (response == Dialog.Actions.OK) + Platform.exit(); + } } @Override @@ -86,9 +113,4 @@ public class BitSquare extends Application super.stop(); } - - public static Stage getStage() - { - return stage; - } } diff --git a/src/main/java/io/bitsquare/RelayNode.java b/src/main/java/io/bitsquare/RelayNode.java index 1f5bea5b1d..3a06877cca 100755 --- a/src/main/java/io/bitsquare/RelayNode.java +++ b/src/main/java/io/bitsquare/RelayNode.java @@ -9,8 +9,8 @@ import net.tomp2p.peers.Number160; */ public class RelayNode { + public static final Number160 ID = Number160.createHash(1); private static Peer masterPeer = null; - public static Number160 ID = Number160.createHash(1); public static void main(String[] args) throws Exception { diff --git a/src/main/java/io/bitsquare/bank/BankAccount.java b/src/main/java/io/bitsquare/bank/BankAccount.java index c66e1270bd..2ef8db18b8 100644 --- a/src/main/java/io/bitsquare/bank/BankAccount.java +++ b/src/main/java/io/bitsquare/bank/BankAccount.java @@ -1,7 +1,6 @@ package io.bitsquare.bank; import io.bitsquare.locale.Country; - import java.io.Serializable; import java.util.Currency; import java.util.Objects; @@ -10,14 +9,14 @@ public class BankAccount implements Serializable { private static final long serialVersionUID = 1792577576443221268L; - private BankAccountTypeInfo bankAccountTypeInfo; - private String accountPrimaryID; - private String accountSecondaryID; - private String accountHolderName; - private Country country; - private Currency currency; - private String uid; - private String accountTitle; + private final BankAccountTypeInfo bankAccountTypeInfo; + private final String accountPrimaryID; + private final String accountSecondaryID; + private final String accountHolderName; + private final Country country; + private final Currency currency; + private final String uid; + private final String accountTitle; public BankAccount(BankAccountTypeInfo bankAccountTypeInfo, Currency currency, diff --git a/src/main/java/io/bitsquare/bank/BankAccountTypeInfo.java b/src/main/java/io/bitsquare/bank/BankAccountTypeInfo.java index f95cfb7d2a..0106ad323c 100644 --- a/src/main/java/io/bitsquare/bank/BankAccountTypeInfo.java +++ b/src/main/java/io/bitsquare/bank/BankAccountTypeInfo.java @@ -7,10 +7,15 @@ import java.util.Objects; public class BankAccountTypeInfo implements Serializable { private static final long serialVersionUID = -8772708150197835288L; + private final BankAccountType type; + private final String primaryIDName; + private final String secondaryIDName; - public static enum BankAccountType + public BankAccountTypeInfo(BankAccountType type, String primaryIDName, String secondaryIDName) { - SEPA, WIRE, INTERNATIONAL, OK_PAY, NET_TELLER, PERFECT_MONEY, OTHER + this.type = type; + this.primaryIDName = primaryIDName; + this.secondaryIDName = secondaryIDName; } public static ArrayList getAllBankAccountTypeInfoObjects() @@ -26,17 +31,6 @@ public class BankAccountTypeInfo implements Serializable return bankTransferTypes; } - private BankAccountType type; - private String primaryIDName; - private String secondaryIDName; - - public BankAccountTypeInfo(BankAccountType type, String primaryIDName, String secondaryIDName) - { - this.type = type; - this.primaryIDName = primaryIDName; - this.secondaryIDName = secondaryIDName; - } - public int hashCode() { return Objects.hashCode(type); @@ -67,4 +61,9 @@ public class BankAccountTypeInfo implements Serializable { return secondaryIDName; } + + public static enum BankAccountType + { + SEPA, WIRE, INTERNATIONAL, OK_PAY, NET_TELLER, PERFECT_MONEY, OTHER + } } diff --git a/src/main/java/io/bitsquare/btc/AddressBasedCoinSelector.java b/src/main/java/io/bitsquare/btc/AddressBasedCoinSelector.java index fa1e3f5b66..339bc51382 100644 --- a/src/main/java/io/bitsquare/btc/AddressBasedCoinSelector.java +++ b/src/main/java/io/bitsquare/btc/AddressBasedCoinSelector.java @@ -5,12 +5,14 @@ import com.google.bitcoin.params.RegTestParams; import com.google.bitcoin.wallet.CoinSelection; import com.google.bitcoin.wallet.DefaultCoinSelector; import com.google.common.annotations.VisibleForTesting; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.math.BigInteger; -import java.util.*; - /** * This class implements a {@link com.google.bitcoin.wallet.CoinSelector} which attempts to get the highest priority * possible. This means that the transaction is the most likely to get confirmed. Note that this means we may end up @@ -19,9 +21,9 @@ import java.util.*; public class AddressBasedCoinSelector extends DefaultCoinSelector { private static final Logger log = LoggerFactory.getLogger(AddressBasedCoinSelector.class); - private NetworkParameters params; - private AddressEntry addressEntry; - private boolean includePending; + private final NetworkParameters params; + private final AddressEntry addressEntry; + private final boolean includePending; /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -39,6 +41,53 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector this.includePending = includePending; } + @VisibleForTesting + static void sortOutputs(ArrayList outputs) + { + Collections.sort(outputs, (a, b) -> { + int depth1 = 0; + int depth2 = 0; + TransactionConfidence conf1 = a.getParentTransaction().getConfidence(); + TransactionConfidence conf2 = b.getParentTransaction().getConfidence(); + if (conf1.getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) + depth1 = conf1.getDepthInBlocks(); + if (conf2.getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) + depth2 = conf2.getDepthInBlocks(); + BigInteger aValue = a.getValue(); + BigInteger bValue = b.getValue(); + BigInteger aCoinDepth = aValue.multiply(BigInteger.valueOf(depth1)); + BigInteger bCoinDepth = bValue.multiply(BigInteger.valueOf(depth2)); + int c1 = bCoinDepth.compareTo(aCoinDepth); + if (c1 != 0) return c1; + // The "coin*days" destroyed are equal, sort by value alone to get the lowest transaction size. + int c2 = bValue.compareTo(aValue); + if (c2 != 0) return c2; + // They are entirely equivalent (possibly pending) so sort by hash to ensure a total ordering. + BigInteger aHash = a.getParentTransaction().getHash().toBigInteger(); + BigInteger bHash = b.getParentTransaction().getHash().toBigInteger(); + return aHash.compareTo(bHash); + }); + } + + private static boolean isInBlockChainOrPending(Transaction tx) + { + // Pick chain-included transactions and transactions that are pending. + TransactionConfidence confidence = tx.getConfidence(); + TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); + return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || + type.equals(TransactionConfidence.ConfidenceType.PENDING) && + // 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 + (confidence.numBroadcastPeers() > 1 || tx.getParams() == RegTestParams.get()); + } + + private static boolean isInBlockChain(Transaction tx) + { + // Only pick chain-included transactions. + TransactionConfidence confidence = tx.getConfidence(); + TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); + return type.equals(TransactionConfidence.ConfidenceType.BUILDING); + } /** * Sub-classes can override this to just customize whether transactions are usable, but keep age sorting. @@ -67,10 +116,10 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector public CoinSelection select(BigInteger biTarget, LinkedList candidates) { long target = biTarget.longValue(); - HashSet selected = new HashSet(); + HashSet selected = new HashSet<>(); // Sort the inputs by age*value so we get the highest "coindays" spent. // TODO: Consider changing the wallets internal format to track just outputs and keep them ordered. - ArrayList sortedOutputs = new ArrayList(candidates); + ArrayList sortedOutputs = new ArrayList<>(candidates); // When calculating the wallet balance, we may be asked to select all possible coins, if so, avoid sorting // them in order to improve performance. if (!biTarget.equals(NetworkParameters.MAX_MONEY)) @@ -96,59 +145,6 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector return new CoinSelection(BigInteger.valueOf(total), selected); } - @VisibleForTesting - static void sortOutputs(ArrayList outputs) - { - Collections.sort(outputs, new Comparator() - { - public int compare(TransactionOutput a, TransactionOutput b) - { - int depth1 = 0; - int depth2 = 0; - TransactionConfidence conf1 = a.getParentTransaction().getConfidence(); - TransactionConfidence conf2 = b.getParentTransaction().getConfidence(); - if (conf1.getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) - depth1 = conf1.getDepthInBlocks(); - if (conf2.getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) - depth2 = conf2.getDepthInBlocks(); - BigInteger aValue = a.getValue(); - BigInteger bValue = b.getValue(); - BigInteger aCoinDepth = aValue.multiply(BigInteger.valueOf(depth1)); - BigInteger bCoinDepth = bValue.multiply(BigInteger.valueOf(depth2)); - int c1 = bCoinDepth.compareTo(aCoinDepth); - if (c1 != 0) return c1; - // The "coin*days" destroyed are equal, sort by value alone to get the lowest transaction size. - int c2 = bValue.compareTo(aValue); - if (c2 != 0) return c2; - // They are entirely equivalent (possibly pending) so sort by hash to ensure a total ordering. - BigInteger aHash = a.getParentTransaction().getHash().toBigInteger(); - BigInteger bHash = b.getParentTransaction().getHash().toBigInteger(); - return aHash.compareTo(bHash); - } - }); - } - - - private static boolean isInBlockChainOrPending(Transaction tx) - { - // Pick chain-included transactions and transactions that are pending. - TransactionConfidence confidence = tx.getConfidence(); - TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); - return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || - type.equals(TransactionConfidence.ConfidenceType.PENDING) && - // 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 - (confidence.numBroadcastPeers() > 1 || tx.getParams() == RegTestParams.get()); - } - - private static boolean isInBlockChain(Transaction tx) - { - // Only pick chain-included transactions. - TransactionConfidence confidence = tx.getConfidence(); - TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); - return type.equals(TransactionConfidence.ConfidenceType.BUILDING); - } - /* public static boolean isSelectable(Transaction tx) { diff --git a/src/main/java/io/bitsquare/btc/AddressEntry.java b/src/main/java/io/bitsquare/btc/AddressEntry.java index ff1f5b01a7..a88d1f9c8e 100644 --- a/src/main/java/io/bitsquare/btc/AddressEntry.java +++ b/src/main/java/io/bitsquare/btc/AddressEntry.java @@ -4,26 +4,16 @@ import com.google.bitcoin.core.Address; import com.google.bitcoin.core.ECKey; import com.google.bitcoin.core.NetworkParameters; import com.google.bitcoin.core.Utils; - import java.io.Serializable; public class AddressEntry implements Serializable { private static final long serialVersionUID = 5501603992599920416L; - - public static enum AddressContext - { - REGISTRATION_FEE, - TRADE, - ARBITRATOR_DEPOSIT - } - - private ECKey key; - private NetworkParameters params; + private final ECKey key; + private final NetworkParameters params; + private final AddressContext addressContext; private String tradeId = null; - private AddressContext addressContext; - public AddressEntry(ECKey key, NetworkParameters params, AddressContext addressContext) { this.key = key; @@ -31,16 +21,16 @@ public class AddressEntry implements Serializable this.addressContext = addressContext; } - public void setTradeId(String tradeId) - { - this.tradeId = tradeId; - } - public String getTradeId() { return tradeId; } + public void setTradeId(String tradeId) + { + this.tradeId = tradeId; + } + public AddressContext getAddressContext() { return addressContext; @@ -65,4 +55,11 @@ public class AddressEntry implements Serializable { return key.toAddress(params); } + + public static enum AddressContext + { + REGISTRATION_FEE, + TRADE, + ARBITRATOR_DEPOSIT + } } diff --git a/src/main/java/io/bitsquare/btc/BitSquareWallet.java b/src/main/java/io/bitsquare/btc/BitSquareWallet.java index e1957aea55..dfda4a0bfc 100644 --- a/src/main/java/io/bitsquare/btc/BitSquareWallet.java +++ b/src/main/java/io/bitsquare/btc/BitSquareWallet.java @@ -3,11 +3,10 @@ package io.bitsquare.btc; import com.google.bitcoin.core.NetworkParameters; import com.google.bitcoin.core.Wallet; import com.google.bitcoin.crypto.KeyCrypter; +import java.io.Serializable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Serializable; - public class BitSquareWallet extends Wallet implements Serializable { private static final Logger log = LoggerFactory.getLogger(BitSquareWallet.class); diff --git a/src/main/java/io/bitsquare/btc/BitSquareWalletAppKit.java b/src/main/java/io/bitsquare/btc/BitSquareWalletAppKit.java index 17cf43d31f..e69ea1d597 100644 --- a/src/main/java/io/bitsquare/btc/BitSquareWalletAppKit.java +++ b/src/main/java/io/bitsquare/btc/BitSquareWalletAppKit.java @@ -8,7 +8,6 @@ import com.google.bitcoin.store.SPVBlockStore; import com.google.bitcoin.store.WalletProtobufSerializer; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -98,7 +97,8 @@ public class BitSquareWalletAppKit extends WalletAppKit if (blockingStartup) { - vPeerGroup.startAndWait(); + vPeerGroup.startAsync(); + vPeerGroup.awaitRunning(); // Make sure we shut down cleanly. installShutdownHook(); // TODO: Be able to use the provided download listener when doing a blocking startup. @@ -142,7 +142,9 @@ public class BitSquareWalletAppKit extends WalletAppKit { try { - BitSquareWalletAppKit.this.stopAndWait(); + BitSquareWalletAppKit.this.stopAsync(); + BitSquareWalletAppKit.this.awaitTerminated(); + } catch (Exception e) { throw new RuntimeException(e); diff --git a/src/main/java/io/bitsquare/btc/BtcFormatter.java b/src/main/java/io/bitsquare/btc/BtcFormatter.java index bf5734793a..c126f0f72b 100644 --- a/src/main/java/io/bitsquare/btc/BtcFormatter.java +++ b/src/main/java/io/bitsquare/btc/BtcFormatter.java @@ -3,19 +3,17 @@ package io.bitsquare.btc; import com.google.bitcoin.core.Utils; import io.bitsquare.gui.util.BitSquareConverter; import io.bitsquare.gui.util.BitSquareFormatter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.math.BigInteger; import java.text.DecimalFormat; import java.util.Locale; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; // TODO public class BtcFormatter { + public static final BigInteger BTC = new BigInteger("100000000"); private static final Logger log = LoggerFactory.getLogger(BtcFormatter.class); - - public static BigInteger BTC = new BigInteger("100000000"); public static BigInteger mBTC = new BigInteger("100000"); diff --git a/src/main/java/io/bitsquare/btc/BtcValidator.java b/src/main/java/io/bitsquare/btc/BtcValidator.java index f9c2203a8f..a37bd3a312 100644 --- a/src/main/java/io/bitsquare/btc/BtcValidator.java +++ b/src/main/java/io/bitsquare/btc/BtcValidator.java @@ -5,7 +5,6 @@ import com.google.bitcoin.core.AddressFormatException; import com.google.bitcoin.core.NetworkParameters; import com.google.bitcoin.core.Transaction; import com.google.inject.Inject; - import java.math.BigInteger; public class BtcValidator diff --git a/src/main/java/io/bitsquare/btc/FeePolicy.java b/src/main/java/io/bitsquare/btc/FeePolicy.java index bd218f33d2..344164db41 100644 --- a/src/main/java/io/bitsquare/btc/FeePolicy.java +++ b/src/main/java/io/bitsquare/btc/FeePolicy.java @@ -2,20 +2,17 @@ package io.bitsquare.btc; import com.google.bitcoin.core.*; import com.google.inject.Inject; +import java.math.BigInteger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.math.BigInteger; - public class FeePolicy { + public static final BigInteger TX_FEE = Transaction.REFERENCE_DEFAULT_MIN_TX_FEE; + public static final BigInteger ACCOUNT_REGISTRATION_FEE = Utils.toNanoCoins("0.01"); + public static final BigInteger CREATE_OFFER_FEE = Utils.toNanoCoins("0.001"); + public static final BigInteger TAKE_OFFER_FEE = CREATE_OFFER_FEE; private static final Logger log = LoggerFactory.getLogger(FeePolicy.class); - - public static BigInteger TX_FEE = Transaction.REFERENCE_DEFAULT_MIN_TX_FEE; - public static BigInteger ACCOUNT_REGISTRATION_FEE = Utils.toNanoCoins("0.01"); - public static BigInteger CREATE_OFFER_FEE = Utils.toNanoCoins("0.001"); - public static BigInteger TAKE_OFFER_FEE = CREATE_OFFER_FEE; - private static final String registrationFeeAddress = "mvkDXt4QmN4Nq9dRUsRigBCaovde9nLkZR"; private static final String createOfferFeeAddress = "n2upbsaKAe4PD3cc4JfS7UCqPC5oNd7Ckg"; private static final String takeOfferFeeAddress = "n2upbsaKAe4PD3cc4JfS7UCqPC5oNd7Ckg"; diff --git a/src/main/java/io/bitsquare/btc/WalletFacade.java b/src/main/java/io/bitsquare/btc/WalletFacade.java index 8e32bc7937..929095df96 100644 --- a/src/main/java/io/bitsquare/btc/WalletFacade.java +++ b/src/main/java/io/bitsquare/btc/WalletFacade.java @@ -7,7 +7,6 @@ import com.google.bitcoin.params.RegTestParams; import com.google.bitcoin.script.Script; import com.google.bitcoin.script.ScriptBuilder; import com.google.bitcoin.utils.Threading; -import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -20,17 +19,15 @@ import io.bitsquare.btc.listeners.BalanceListener; import io.bitsquare.btc.listeners.ConfidenceListener; import io.bitsquare.crypto.CryptoFacade; import io.bitsquare.storage.Storage; -import javafx.application.Platform; -import javafx.util.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.Nullable; -import javax.annotation.concurrent.GuardedBy; import java.math.BigInteger; import java.util.*; -import java.util.concurrent.ExecutionException; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import javafx.application.Platform; +import javafx.util.Pair; +import javax.annotation.concurrent.GuardedBy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static com.google.bitcoin.script.ScriptOpCodes.OP_RETURN; @@ -43,23 +40,23 @@ public class WalletFacade public static final String TEST_NET = "TEST_NET"; public static final String REG_TEST_NET = "REG_TEST_NET"; - public static String WALLET_PREFIX = BitSquare.ID; + public static final String WALLET_PREFIX = BitSquare.ID; private static final Logger log = LoggerFactory.getLogger(WalletFacade.class); private final ReentrantLock lock = Threading.lock("lock"); - private String saveAddressEntryListId; - private NetworkParameters params; - private BitSquareWalletAppKit walletAppKit; - private FeePolicy feePolicy; - private CryptoFacade cryptoFacade; - private Storage storage; + private final String saveAddressEntryListId; + private final NetworkParameters params; + private final BitSquareWalletAppKit walletAppKit; + private final FeePolicy feePolicy; + private final CryptoFacade cryptoFacade; + private final Storage storage; + private final List downloadListeners = new ArrayList<>(); + private final List confidenceListeners = new ArrayList<>(); + private final List balanceListeners = new ArrayList<>(); private BitSquareWallet wallet; private WalletEventListener walletEventListener; - private List downloadListeners = new ArrayList<>(); - private List confidenceListeners = new ArrayList<>(); - private List balanceListeners = new ArrayList<>(); @GuardedBy("lock") private List addressEntryList = new ArrayList<>(); @@ -171,26 +168,30 @@ public class WalletFacade }; wallet.addEventListener(walletEventListener); - List savedAddressEntryList = (List) storage.read(saveAddressEntryListId); - if (savedAddressEntryList != null) + Object object = storage.read(saveAddressEntryListId); + if (object instanceof List) { - addressEntryList = savedAddressEntryList; - } - else - { - lock.lock(); - try + List savedAddressEntryList = (List) object; + if (savedAddressEntryList != null) { - ECKey registrationKey = wallet.getKeys().get(0); - AddressEntry registrationAddressEntry = new AddressEntry(registrationKey, params, AddressEntry.AddressContext.REGISTRATION_FEE); - addressEntryList.add(registrationAddressEntry); - } finally - { - lock.unlock(); + addressEntryList = savedAddressEntryList; } + else + { + lock.lock(); + try + { + ECKey registrationKey = wallet.getKeys().get(0); + AddressEntry registrationAddressEntry = new AddressEntry(registrationKey, params, AddressEntry.AddressContext.REGISTRATION_FEE); + addressEntryList.add(registrationAddressEntry); + } finally + { + lock.unlock(); + } - saveAddressInfoList(); - getNewTradeAddressEntry(); + saveAddressInfoList(); + getNewTradeAddressEntry(); + } } } @@ -272,14 +273,7 @@ public class WalletFacade public AddressEntry getUnusedTradeAddressInfo() { - List filteredList = Lists.newArrayList(Collections2.filter(ImmutableList.copyOf(addressEntryList), new Predicate() - { - @Override - public boolean apply(@Nullable AddressEntry addressInfo) - { - return (addressInfo != null && addressInfo.getAddressContext().equals(AddressEntry.AddressContext.TRADE) && addressInfo.getTradeId() == null); - } - })); + List filteredList = Lists.newArrayList(Collections2.filter(ImmutableList.copyOf(addressEntryList), addressInfo -> (addressInfo != null && addressInfo.getAddressContext().equals(AddressEntry.AddressContext.TRADE) && addressInfo.getTradeId() == null))); if (filteredList != null && filteredList.size() > 0) return filteredList.get(0); @@ -289,14 +283,7 @@ public class WalletFacade private AddressEntry getAddressInfoByAddressContext(AddressEntry.AddressContext addressContext) { - List filteredList = Lists.newArrayList(Collections2.filter(ImmutableList.copyOf(addressEntryList), new Predicate() - { - @Override - public boolean apply(@Nullable AddressEntry addressInfo) - { - return (addressInfo != null && addressContext != null && addressInfo.getAddressContext() != null && addressInfo.getAddressContext().equals(addressContext)); - } - })); + List filteredList = Lists.newArrayList(Collections2.filter(ImmutableList.copyOf(addressEntryList), addressInfo -> (addressInfo != null && addressContext != null && addressInfo.getAddressContext() != null && addressInfo.getAddressContext().equals(addressContext)))); if (filteredList != null && filteredList.size() > 0) return filteredList.get(0); @@ -374,20 +361,22 @@ public class WalletFacade Set transactions = wallet.getTransactions(true); if (transactions != null) { - for (Transaction tx : transactions) + transactionConfidenceList.addAll(transactions.stream().map(tx -> getTransactionConfidence(tx, address)).collect(Collectors.toList())); + /* same as: + for (Transaction tx : transactions) { transactionConfidenceList.add(getTransactionConfidence(tx, address)); } + */ } return getMostRecentConfidence(transactionConfidenceList); } private void notifyConfidenceListeners(Transaction tx) { - for (int i = 0; i < confidenceListeners.size(); i++) + for (ConfidenceListener confidenceListener : confidenceListeners) { List transactionConfidenceList = new ArrayList<>(); - ConfidenceListener confidenceListener = confidenceListeners.get(i); transactionConfidenceList.add(getTransactionConfidence(tx, confidenceListener.getAddress())); TransactionConfidence transactionConfidence = getMostRecentConfidence(transactionConfidenceList); @@ -400,9 +389,17 @@ public class WalletFacade List mergedOutputs = getOutputsWithConnectedOutputs(tx); List transactionConfidenceList = new ArrayList<>(); - for (int i = 0; i < mergedOutputs.size(); i++) + mergedOutputs.stream().filter(transactionOutput -> transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH()).forEach(transactionOutput -> { + Address outputAddress = transactionOutput.getScriptPubKey().getToAddress(params); + if (address.equals(outputAddress)) + { + transactionConfidenceList.add(tx.getConfidence()); + } + }); + /* + same as: + for (TransactionOutput transactionOutput : mergedOutputs) { - TransactionOutput transactionOutput = mergedOutputs.get(i); if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH()) { Address outputAddress = transactionOutput.getScriptPubKey().getToAddress(params); @@ -412,6 +409,7 @@ public class WalletFacade } } } + */ return getMostRecentConfidence(transactionConfidenceList); } @@ -422,9 +420,8 @@ public class WalletFacade // add all connected outputs from any inputs as well List transactionInputs = tx.getInputs(); - for (int i = 0; i < transactionInputs.size(); i++) + for (TransactionInput transactionInput : transactionInputs) { - TransactionInput transactionInput = transactionInputs.get(i); TransactionOutput transactionOutput = transactionInput.getConnectedOutput(); if (transactionOutput != null) connectedOutputs.add(transactionOutput); @@ -439,9 +436,8 @@ public class WalletFacade private TransactionConfidence getMostRecentConfidence(List transactionConfidenceList) { TransactionConfidence transactionConfidence = null; - for (int i = 0; i < transactionConfidenceList.size(); i++) + for (TransactionConfidence confidence : transactionConfidenceList) { - TransactionConfidence confidence = transactionConfidenceList.get(i); if (confidence != null) { if (transactionConfidence == null || @@ -494,10 +490,8 @@ public class WalletFacade private void notifyBalanceListeners(Transaction tx) { - for (int i = 0; i < balanceListeners.size(); i++) + for (BalanceListener balanceListener : balanceListeners) { - BalanceListener balanceListener = balanceListeners.get(i); - BigInteger balance; if (balanceListener.getAddress() != null) balance = getBalanceForAddress(balanceListener.getAddress()); @@ -723,7 +717,7 @@ public class WalletFacade String arbitratorPubKey, String offerersPartialDepositTxAsHex, String tradeId - ) throws InsufficientMoneyException, ExecutionException, InterruptedException, AddressFormatException + ) throws InsufficientMoneyException { log.debug("takerAddPaymentAndSignTx"); log.trace("inputs: "); @@ -837,7 +831,7 @@ public class WalletFacade String takersSignedScriptSigAsHex, long offererTxOutIndex, long takerTxOutIndex, - FutureCallback callback) throws Exception + FutureCallback callback) { log.debug("offererSignAndPublishTx"); log.trace("inputs: "); @@ -859,7 +853,7 @@ public class WalletFacade // add input Transaction offerersFirstTxConnOut = wallet.getTransaction(offerersFirstTx.getInput(0).getOutpoint().getHash()); // pass that around! TransactionOutPoint offerersFirstTxOutPoint = new TransactionOutPoint(params, offererTxOutIndex, offerersFirstTxConnOut); - //TransactionInput offerersFirstTxInput = new TransactionInput(params, tx, offerersFirstTx.getInput(0).getScriptBytes(), offerersFirstTxOutPoint); // pass that around! getScriptBytes = empty bytes aray + //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 offerersFirstTxInput.setParent(tx); tx.addInput(offerersFirstTxInput); @@ -971,7 +965,7 @@ public class WalletFacade BigInteger offererPaybackAmount, BigInteger takerPaybackAmount, String takerAddress, - String tradeID) throws InsufficientMoneyException, AddressFormatException + String tradeID) throws AddressFormatException { log.debug("offererCreatesAndSignsPayoutTx"); log.trace("inputs: "); @@ -1009,7 +1003,7 @@ public class WalletFacade BigInteger takerPaybackAmount, String offererAddress, String tradeID, - FutureCallback callback) throws InsufficientMoneyException, AddressFormatException + FutureCallback callback) throws AddressFormatException { log.debug("takerSignsAndSendsTx"); log.trace("inputs: "); @@ -1125,6 +1119,13 @@ public class WalletFacade // Inner classes /////////////////////////////////////////////////////////////////////////////////////////// + public static interface DownloadListener + { + void progress(double percent, int blocksSoFar, Date date); + + void doneDownload(); + } + private class BlockChainDownloadListener extends com.google.bitcoin.core.DownloadListener { @Override @@ -1138,7 +1139,7 @@ public class WalletFacade protected void doneDownload() { super.doneDownload(); - Platform.runLater(() -> onDoneDownloadInUserThread()); + Platform.runLater(this::onDoneDownloadInUserThread); } private void onProgressInUserThread(double percent, int blocksSoFar, final Date date) @@ -1154,11 +1155,4 @@ public class WalletFacade } } - public static interface DownloadListener - { - void progress(double percent, int blocksSoFar, Date date); - - void doneDownload(); - } - } \ No newline at end of file diff --git a/src/main/java/io/bitsquare/btc/listeners/BalanceListener.java b/src/main/java/io/bitsquare/btc/listeners/BalanceListener.java index 295c078add..6856bfb33c 100644 --- a/src/main/java/io/bitsquare/btc/listeners/BalanceListener.java +++ b/src/main/java/io/bitsquare/btc/listeners/BalanceListener.java @@ -1,7 +1,6 @@ package io.bitsquare.btc.listeners; import com.google.bitcoin.core.Address; - import java.math.BigInteger; public class BalanceListener diff --git a/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java b/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java index 19f64f6ba7..7d41dcb170 100644 --- a/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java +++ b/src/main/java/io/bitsquare/btc/listeners/ConfidenceListener.java @@ -5,7 +5,7 @@ import com.google.bitcoin.core.TransactionConfidence; public class ConfidenceListener { - private Address address; + private final Address address; public ConfidenceListener(Address address) { diff --git a/src/main/java/io/bitsquare/crypto/CryptoFacade.java b/src/main/java/io/bitsquare/crypto/CryptoFacade.java index e68bde57ec..d1e6ab6bab 100644 --- a/src/main/java/io/bitsquare/crypto/CryptoFacade.java +++ b/src/main/java/io/bitsquare/crypto/CryptoFacade.java @@ -4,11 +4,10 @@ import com.google.bitcoin.core.ECKey; import com.google.bitcoin.core.Utils; import com.google.common.base.Charsets; import com.google.inject.Inject; +import java.security.SignatureException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.security.SignatureException; - /** * That facade delivers crypto functionality from the bitcoinJ library */ diff --git a/src/main/java/io/bitsquare/di/BitSquareModule.java b/src/main/java/io/bitsquare/di/BitSquareModule.java index d89a8fbde7..faee876566 100644 --- a/src/main/java/io/bitsquare/di/BitSquareModule.java +++ b/src/main/java/io/bitsquare/di/BitSquareModule.java @@ -23,7 +23,6 @@ import io.bitsquare.trade.orderbook.OrderBook; import io.bitsquare.trade.orderbook.OrderBookFilter; import io.bitsquare.user.User; import io.bitsquare.util.Utilities; - import java.io.File; public class BitSquareModule extends AbstractModule @@ -59,7 +58,7 @@ public class BitSquareModule extends AbstractModule class BitSquareWalletAppKitProvider implements Provider { - private NetworkParameters networkParameters; + private final NetworkParameters networkParameters; @Inject public BitSquareWalletAppKitProvider(NetworkParameters networkParameters) @@ -75,7 +74,7 @@ class BitSquareWalletAppKitProvider implements Provider class NetworkParametersProvider implements Provider { - private String networkType; + private final String networkType; @Inject public NetworkParametersProvider(@Named("networkType") String networkType) diff --git a/src/main/java/io/bitsquare/di/GuiceControllerFactory.java b/src/main/java/io/bitsquare/di/GuiceControllerFactory.java index be18d87f14..d271e92278 100644 --- a/src/main/java/io/bitsquare/di/GuiceControllerFactory.java +++ b/src/main/java/io/bitsquare/di/GuiceControllerFactory.java @@ -7,14 +7,14 @@ import javafx.util.Callback; * A JavaFX controller factory for constructing controllers via Guice DI. To * install this in the {@link javafx.fxml.FXMLLoader}, pass it as a parameter to * {@link javafx.fxml.FXMLLoader#setControllerFactory(Callback)}. - *

+ *

* Once set, make sure you do not use the static methods on * {@link javafx.fxml.FXMLLoader} when creating your JavaFX node. */ public class GuiceControllerFactory implements Callback, Object> { - private Injector injector; + private final Injector injector; public GuiceControllerFactory(Injector injector) { diff --git a/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java b/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java index 73032cd9bf..6a2015f379 100644 --- a/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java +++ b/src/main/java/io/bitsquare/di/GuiceFXMLLoader.java @@ -1,11 +1,10 @@ package io.bitsquare.di; import com.google.inject.Injector; -import javafx.fxml.FXMLLoader; -import javafx.util.BuilderFactory; - import java.net.URL; import java.util.ResourceBundle; +import javafx.fxml.FXMLLoader; +import javafx.util.BuilderFactory; /** * Guice support for fxml controllers @@ -15,11 +14,6 @@ public class GuiceFXMLLoader extends FXMLLoader private static Injector injector = null; - public static void setInjector(Injector injector) - { - GuiceFXMLLoader.injector = injector; - } - public GuiceFXMLLoader() { super(); @@ -44,6 +38,11 @@ public class GuiceFXMLLoader extends FXMLLoader setupControllerFactory(); } + public static void setInjector(Injector injector) + { + GuiceFXMLLoader.injector = injector; + } + private void setupControllerFactory() { if (GuiceFXMLLoader.injector != null) diff --git a/src/main/java/io/bitsquare/gui/MainController.java b/src/main/java/io/bitsquare/gui/MainController.java index b64d9b3e7d..84deecb931 100644 --- a/src/main/java/io/bitsquare/gui/MainController.java +++ b/src/main/java/io/bitsquare/gui/MainController.java @@ -16,8 +16,12 @@ import io.bitsquare.storage.Storage; import io.bitsquare.trade.Direction; import io.bitsquare.trade.Trading; import io.bitsquare.user.User; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; +import java.io.IOException; +import java.math.BigInteger; +import java.net.URL; +import java.util.Date; +import java.util.ResourceBundle; +import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.fxml.Initializable; @@ -35,41 +39,40 @@ import net.tomp2p.peers.PeerAddress; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.math.BigInteger; -import java.net.URL; -import java.util.Date; -import java.util.ResourceBundle; - public class MainController implements Initializable, NavigationController { private static final Logger log = LoggerFactory.getLogger(MainController.class); private static MainController mainController; - private User user; - private WalletFacade walletFacade; - private MessageFacade messageFacade; - private Trading trading; + private final User user; + private final WalletFacade walletFacade; + private final MessageFacade messageFacade; + private final Trading trading; + private final Storage storage; + private final String selectedNavigationItemStorageId; + private final ToggleGroup toggleGroup = new ToggleGroup(); + private ChildController childController; - private Storage storage; - private String selectedNavigationItemStorageId; private NavigationItem selectedNavigationItem; private NetworkSyncPane networkSyncPane; - private ToggleGroup toggleGroup = new ToggleGroup(); private ToggleButton prevToggleButton; private Image prevToggleButtonIcon; private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton; private Pane msgButtonHolder, ordersButtonButtonHolder; private TextField balanceTextField; + @FXML + private Pane contentPane; + @FXML + private HBox leftNavPane, rightNavPane; + @FXML + private ProgressBar loadingBar; + @FXML + private AnchorPane rootPane; + @FXML + private Label loadingLabel; - @FXML - public Pane contentPane; - @FXML - public HBox leftNavPane, rightNavPane; - @FXML - public AnchorPane anchorPane; /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -101,6 +104,11 @@ public class MainController implements Initializable, NavigationController @Override public void initialize(URL url, ResourceBundle rb) + { + Platform.runLater(this::init); + } + + public void init() { networkSyncPane = new NetworkSyncPane(); networkSyncPane.setSpacing(10); @@ -137,7 +145,14 @@ public class MainController implements Initializable, NavigationController AnchorPane.setBottomAnchor(networkSyncPane, 0.0); AnchorPane.setLeftAnchor(networkSyncPane, 0.0); - messageFacade.addTakeOfferRequestListener((tradingMessage, sender) -> showTakeOfferRequest(tradingMessage, sender)); + messageFacade.addTakeOfferRequestListener(this::showTakeOfferRequest); + + loadingBar.setProgress(-1); + rootPane.getChildren().removeAll(loadingLabel, loadingBar); + + leftNavPane.setVisible(true); + rightNavPane.setVisible(true); + contentPane.setVisible(true); } @@ -152,9 +167,7 @@ public class MainController implements Initializable, NavigationController alertButton.relocate(36, 19); Tooltip.install(alertButton, new Tooltip("Someone accepted your offer")); - alertButton.setOnAction((e) -> { - ordersButton.fire(); - }); + alertButton.setOnAction((e) -> ordersButton.fire()); ordersButtonButtonHolder.getChildren().add(alertButton); } catch (NullPointerException e) @@ -331,7 +344,7 @@ public class MainController implements Initializable, NavigationController { if (user.getBankAccounts().size() > 1) { - ComboBox accountComboBox = new ComboBox(FXCollections.observableArrayList(user.getBankAccounts())); + ComboBox accountComboBox = new ComboBox(FXCollections.observableArrayList(user.getBankAccounts())); accountComboBox.setLayoutY(12); accountComboBox.setValue(user.getCurrentBankAccount()); accountComboBox.setConverter(new StringConverter() @@ -360,14 +373,7 @@ public class MainController implements Initializable, NavigationController vBox.getChildren().setAll(accountComboBox, titleLabel); parent.getChildren().add(vBox); - accountComboBox.valueProperty().addListener(new ChangeListener() - { - @Override - public void changed(ObservableValue ov, BankAccount oldValue, BankAccount newValue) - { - user.setCurrentBankAccount(newValue); - } - }); + accountComboBox.valueProperty().addListener((ov, oldValue, newValue) -> user.setCurrentBankAccount(newValue)); } } diff --git a/src/main/java/io/bitsquare/gui/MainView.fxml b/src/main/java/io/bitsquare/gui/MainView.fxml index b0e3a3fc7d..23363a79df 100644 --- a/src/main/java/io/bitsquare/gui/MainView.fxml +++ b/src/main/java/io/bitsquare/gui/MainView.fxml @@ -1,9 +1,14 @@ + + - - - - + + + + + + + \ No newline at end of file diff --git a/src/main/java/io/bitsquare/gui/NavigationViewURL.java b/src/main/java/io/bitsquare/gui/NavigationViewURL.java index 497b3e66a3..048175bbeb 100644 --- a/src/main/java/io/bitsquare/gui/NavigationViewURL.java +++ b/src/main/java/io/bitsquare/gui/NavigationViewURL.java @@ -2,24 +2,30 @@ package io.bitsquare.gui; public class NavigationViewURL { + public static final String MAIN = "/io/bitsquare/gui/MainView.fxml"; + public static final String HOME = "/io/bitsquare/gui/home/HomeView.fxml"; public static final String MARKET = "/io/bitsquare/gui/market/MarketView.fxml"; public static final String ORDERS = "/io/bitsquare/gui/orders/OrdersView.fxml"; public static final String FUNDS = "/io/bitsquare/gui/funds/FundsView.fxml"; public static final String MSG = "/io/bitsquare/gui/msg/MsgView.fxml"; public static final String SETTINGS = "/io/bitsquare/gui/settings/SettingsView.fxml"; + public static final String ORDER_BOOK = "/io/bitsquare/gui/market/orderbook/OrderBookView.fxml"; public static final String TAKER_TRADE = "/io/bitsquare/gui/market/trade/TakerTradeView.fxml"; public static final String OFFERER_TRADE = "/io/bitsquare/gui/orders/OffererTradeView.fxml"; public static final String CREATE_OFFER = "/io/bitsquare/gui/market/createOffer/CreateOfferView.fxml"; - public static final String ARBITRATOR_PROFILE = "/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"; - public static final String ARBITRATOR_OVERVIEW = "/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml"; - public static final String ARBITRATOR_REGISTRATION = "/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml"; + public static final String CLOSED_TRADE = "/io/bitsquare/gui/orders/closed/ClosedTradeView.fxml"; public static final String OFFER = "/io/bitsquare/gui/orders/offer/OfferView.fxml"; public static final String PENDING_TRADE = "/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"; + public static final String DEPOSIT = "/io/bitsquare/gui/funds/deposit/DepositView.fxml"; public static final String WITHDRAWAL = "/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"; public static final String TRANSACTIONS = "/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"; + public static final String ARBITRATOR_PROFILE = "/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"; + public static final String ARBITRATOR_OVERVIEW = "/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml"; + public static final String ARBITRATOR_REGISTRATION = "/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml"; + } diff --git a/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewController.java b/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewController.java index e2592b0db2..c3c64780ad 100644 --- a/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewController.java +++ b/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewController.java @@ -14,6 +14,12 @@ import io.bitsquare.msg.listeners.ArbitratorListener; import io.bitsquare.settings.Settings; import io.bitsquare.storage.Storage; import io.bitsquare.user.Arbitrator; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; @@ -25,26 +31,19 @@ import javafx.stage.Stage; import net.tomp2p.peers.Number160; import net.tomp2p.storage.Data; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - public class ArbitratorOverviewController implements Initializable, ChildController, NavigationController, ArbitratorListener { - private Settings settings; - private Storage storage; - private MessageFacade messageFacade; + private final Settings settings; + private final Storage storage; + private final MessageFacade messageFacade; + private final List allArbitrators = new ArrayList<>(); private Arbitrator currentArbitrator; private NavigationController navigationController; private ArbitratorProfileController arbitratorProfileController; - private List allArbitrators = new ArrayList<>(); private int index = -1; @FXML - private Button prevButton, nextButton, selectButton; + private Button prevButton, nextButton, selectButton, closeButton; @FXML private AnchorPane rootContainer; @FXML diff --git a/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml b/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml index 100fd6f49a..19631ae973 100644 --- a/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml +++ b/src/main/java/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml @@ -2,13 +2,11 @@ - - - -