mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-04 03:03:48 +01:00
removed unused code, comments, small refactorings
This commit is contained in:
parent
d3d23cc459
commit
919cde4e43
75 changed files with 142 additions and 457 deletions
|
@ -25,10 +25,10 @@ import io.bitsquare.gui.components.Popups;
|
||||||
import io.bitsquare.gui.util.Profiler;
|
import io.bitsquare.gui.util.Profiler;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
import io.bitsquare.util.AWTSystemTray;
|
import io.bitsquare.util.AWTSystemTray;
|
||||||
import io.bitsquare.util.StorageDirectory;
|
import io.bitsquare.util.AppDirectoryUtil;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ import javafx.stage.Stage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
public class BitSquare extends Application {
|
public class BitSquare extends Application {
|
||||||
private static final Logger log = LoggerFactory.getLogger(BitSquare.class);
|
private static final Logger log = LoggerFactory.getLogger(BitSquare.class);
|
||||||
|
|
||||||
|
@ -83,8 +82,8 @@ public class BitSquare extends Application {
|
||||||
Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> Popups.handleUncaughtExceptions
|
Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> Popups.handleUncaughtExceptions
|
||||||
(Throwables.getRootCause(throwable)));
|
(Throwables.getRootCause(throwable)));
|
||||||
|
|
||||||
StorageDirectory.setStorageDirectory(
|
AppDirectoryUtil.setStorageDirectory(
|
||||||
new File(StorageDirectory.getApplicationDirectory().getCanonicalPath() + "/data"));
|
new File(AppDirectoryUtil.getApplicationDirectory().getCanonicalPath() + "/data"));
|
||||||
|
|
||||||
// currently there is not SystemTray support for java fx (planned for version 3) so we use the old AWT
|
// currently there is not SystemTray support for java fx (planned for version 3) so we use the old AWT
|
||||||
AWTSystemTray.createSystemTray(primaryStage);
|
AWTSystemTray.createSystemTray(primaryStage);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.user;
|
package io.bitsquare.arbitrator;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
@ -15,13 +15,18 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.user;
|
package io.bitsquare.arbitrator;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
//TODO still open if we use that really...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reputation for Arbitrators
|
||||||
|
*/
|
||||||
public class Reputation implements Serializable {
|
public class Reputation implements Serializable {
|
||||||
private static final long serialVersionUID = -3073174320050879490L;
|
private static final long serialVersionUID = -3073174320050879490L;
|
||||||
|
|
|
@ -21,8 +21,8 @@ import io.bitsquare.BitSquare;
|
||||||
import io.bitsquare.btc.listeners.BalanceListener;
|
import io.bitsquare.btc.listeners.BalanceListener;
|
||||||
import io.bitsquare.btc.listeners.ConfidenceListener;
|
import io.bitsquare.btc.listeners.ConfidenceListener;
|
||||||
import io.bitsquare.crypto.CryptoFacade;
|
import io.bitsquare.crypto.CryptoFacade;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.util.StorageDirectory;
|
import io.bitsquare.util.AppDirectoryUtil;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Address;
|
import com.google.bitcoin.core.Address;
|
||||||
import com.google.bitcoin.core.AddressFormatException;
|
import com.google.bitcoin.core.AddressFormatException;
|
||||||
|
@ -139,7 +139,7 @@ public class WalletFacade {
|
||||||
Threading.USER_THREAD = Platform::runLater;
|
Threading.USER_THREAD = Platform::runLater;
|
||||||
|
|
||||||
// If seed is non-null it means we are restoring from backup.
|
// If seed is non-null it means we are restoring from backup.
|
||||||
walletAppKit = new WalletAppKit(params, StorageDirectory.getStorageDirectory(), WALLET_PREFIX) {
|
walletAppKit = new WalletAppKit(params, AppDirectoryUtil.getStorageDirectory(), WALLET_PREFIX) {
|
||||||
@Override
|
@Override
|
||||||
protected void onSetupCompleted() {
|
protected void onSetupCompleted() {
|
||||||
// Don't make the user wait for confirmations for now, as the intention is they're sending it
|
// Don't make the user wait for confirmations for now, as the intention is they're sending it
|
||||||
|
|
|
@ -28,7 +28,7 @@ import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.msg.P2PNode;
|
import io.bitsquare.msg.P2PNode;
|
||||||
import io.bitsquare.msg.SeedNodeAddress;
|
import io.bitsquare.msg.SeedNodeAddress;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.trade.TradeManager;
|
import io.bitsquare.trade.TradeManager;
|
||||||
import io.bitsquare.trade.orderbook.OrderBook;
|
import io.bitsquare.trade.orderbook.OrderBook;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import io.bitsquare.gui.util.Profiler;
|
||||||
import io.bitsquare.gui.util.Transitions;
|
import io.bitsquare.gui.util.Transitions;
|
||||||
import io.bitsquare.msg.listeners.BootstrapListener;
|
import io.bitsquare.msg.listeners.BootstrapListener;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.trade.TradeManager;
|
import io.bitsquare.trade.TradeManager;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
import io.bitsquare.util.AWTSystemTray;
|
import io.bitsquare.util.AWTSystemTray;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public enum NavigationItem {
|
||||||
TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"),
|
TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"),
|
||||||
|
|
||||||
ARBITRATOR_PROFILE("/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"),
|
ARBITRATOR_PROFILE("/io/bitsquare/gui/arbitrators/profile/ArbitratorProfileView.fxml"),
|
||||||
ARBITRATOR_OVERVIEW("/io/bitsquare/gui/arbitrators/overview/ArbitratorOverviewView.fxml"),
|
ARBITRATOR_BROWSER("/io/bitsquare/gui/arbitrators/browser/ArbitratorBrowserView.fxml"),
|
||||||
ARBITRATOR_REGISTRATION("/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml");
|
ARBITRATOR_REGISTRATION("/io/bitsquare/gui/arbitrators/registration/ArbitratorRegistrationView.fxml");
|
||||||
|
|
||||||
private final String fxmlUrl;
|
private final String fxmlUrl;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.arbitrators.overview;
|
package io.bitsquare.gui.arbitrators.browser;
|
||||||
|
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.CachedViewController;
|
import io.bitsquare.gui.CachedViewController;
|
||||||
|
@ -26,8 +26,8 @@ import io.bitsquare.locale.LanguageUtil;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.msg.listeners.ArbitratorListener;
|
import io.bitsquare.msg.listeners.ArbitratorListener;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ import net.tomp2p.storage.Data;
|
||||||
*
|
*
|
||||||
* Arbitration is not much developed yet
|
* Arbitration is not much developed yet
|
||||||
*/
|
*/
|
||||||
public class ArbitratorOverviewController extends CachedViewController implements ArbitratorListener {
|
public class ArbitratorBrowserController extends CachedViewController implements ArbitratorListener {
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
private final Persistence persistence;
|
private final Persistence persistence;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class ArbitratorOverviewController extends CachedViewController implement
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ArbitratorOverviewController(Settings settings, Persistence persistence, MessageFacade messageFacade) {
|
public ArbitratorBrowserController(Settings settings, Persistence persistence, MessageFacade messageFacade) {
|
||||||
|
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.persistence = persistence;
|
this.persistence = persistence;
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.arbitrators.overview.ArbitratorOverviewController"
|
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.arbitrators.browser.ArbitratorBrowserController"
|
||||||
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
||||||
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
|
@ -22,8 +22,8 @@ import io.bitsquare.gui.NavigationItem;
|
||||||
import io.bitsquare.gui.ViewController;
|
import io.bitsquare.gui.ViewController;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,13 @@ import io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController;
|
||||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.gui.util.BitSquareValidator;
|
import io.bitsquare.gui.util.BitSquareValidator;
|
||||||
import io.bitsquare.gui.util.ConfidenceDisplay;
|
import io.bitsquare.gui.components.ConfidenceDisplay;
|
||||||
import io.bitsquare.locale.LanguageUtil;
|
import io.bitsquare.locale.LanguageUtil;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.user.Reputation;
|
import io.bitsquare.arbitrator.Reputation;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
import io.bitsquare.util.DSAKeyUtil;
|
import io.bitsquare.util.DSAKeyUtil;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ package io.bitsquare.gui.components;
|
||||||
|
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.ViewController;
|
import io.bitsquare.gui.ViewController;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ import org.slf4j.LoggerFactory;
|
||||||
* So when switching back to an already opened tab it is faster as no fxml loading is needed anymore.
|
* So when switching back to an already opened tab it is faster as no fxml loading is needed anymore.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//TODO remove manual caching as its done now in loader
|
|
||||||
public class CachingTabPane extends TabPane {
|
public class CachingTabPane extends TabPane {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CachingTabPane.class);
|
private static final Logger log = LoggerFactory.getLogger(CachingTabPane.class);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.components;
|
||||||
|
|
||||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
|
|
||||||
|
@ -35,19 +35,15 @@ import javafx.scene.control.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
// TODO refactor
|
||||||
public class ConfidenceDisplay {
|
public class ConfidenceDisplay {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ConfidenceDisplay.class);
|
private static final Logger log = LoggerFactory.getLogger(ConfidenceDisplay.class);
|
||||||
|
|
||||||
private WalletEventListener walletEventListener;
|
private WalletEventListener walletEventListener;
|
||||||
|
|
||||||
|
|
||||||
private Wallet wallet;
|
private Wallet wallet;
|
||||||
|
|
||||||
private Label confirmationLabel;
|
private Label confirmationLabel;
|
||||||
|
|
||||||
private TextField balanceTextField;
|
private TextField balanceTextField;
|
||||||
private Transaction transaction;
|
private Transaction transaction;
|
||||||
|
|
||||||
private ConfidenceProgressIndicator progressIndicator;
|
private ConfidenceProgressIndicator progressIndicator;
|
||||||
|
|
||||||
public ConfidenceDisplay(Wallet wallet, Label confirmationLabel, TextField balanceTextField,
|
public ConfidenceDisplay(Wallet wallet, Label confirmationLabel, TextField balanceTextField,
|
|
@ -21,8 +21,6 @@ package io.bitsquare.gui.components;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
public class HSpacer extends Pane {
|
public class HSpacer extends Pane {
|
||||||
public HSpacer() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public HSpacer(double width) {
|
public HSpacer(double width) {
|
||||||
setPrefWidth(width);
|
setPrefWidth(width);
|
||||||
|
|
|
@ -23,6 +23,8 @@ import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
|
||||||
|
// TODO replace with new notification component from lighthouse/bitcoinJ
|
||||||
|
|
||||||
public class NetworkSyncPane extends HBox {
|
public class NetworkSyncPane extends HBox {
|
||||||
|
|
||||||
private final ProgressBar networkSyncProgressBar;
|
private final ProgressBar networkSyncProgressBar;
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Bitsquare.
|
|
||||||
*
|
|
||||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bitsquare.gui.components;
|
|
||||||
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
|
|
||||||
class NoFocusScrollPane extends ScrollPane {
|
|
||||||
public NoFocusScrollPane() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void requestFocus() {
|
|
||||||
// prevent focus
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,6 +32,9 @@ import org.controlsfx.control.action.Action;
|
||||||
import org.controlsfx.dialog.Dialog;
|
import org.controlsfx.dialog.Dialog;
|
||||||
import org.controlsfx.dialog.Dialogs;
|
import org.controlsfx.dialog.Dialogs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection of controlsfx Popups
|
||||||
|
*/
|
||||||
public class Popups {
|
public class Popups {
|
||||||
|
|
||||||
// Information
|
// Information
|
||||||
|
|
|
@ -21,8 +21,6 @@ package io.bitsquare.gui.components;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
public class VSpacer extends Pane {
|
public class VSpacer extends Pane {
|
||||||
public VSpacer() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public VSpacer(double height) {
|
public VSpacer(double height) {
|
||||||
setPrefHeight(height);
|
setPrefHeight(height);
|
||||||
|
|
|
@ -46,6 +46,8 @@ import org.slf4j.LoggerFactory;
|
||||||
* </div>
|
* </div>
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TODO replace with ValidatingTextField
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class ValidatedTextField extends TextField {
|
public class ValidatedTextField extends TextField {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ValidatedTextField.class);
|
private static final Logger log = LoggerFactory.getLogger(ValidatedTextField.class);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.components;
|
package io.bitsquare.gui.components;
|
||||||
|
|
||||||
import io.bitsquare.gui.util.NumberValidator;
|
import io.bitsquare.gui.util.validation.NumberValidator;
|
||||||
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
|
|
@ -35,6 +35,8 @@ import javafx.css.PseudoClass;
|
||||||
import javafx.css.StyleableProperty;
|
import javafx.css.StyleableProperty;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
|
// TODO Copied form OpenJFX, check license issues and way how we integrated it
|
||||||
|
// We changed behaviour which was not exposed via APIs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A circular control which is used for indicating progress, either
|
* A circular control which is used for indicating progress, either
|
||||||
|
|
|
@ -31,6 +31,11 @@ import java.util.Collections;
|
||||||
|
|
||||||
import com.sun.javafx.scene.control.behavior.BehaviorBase;
|
import com.sun.javafx.scene.control.behavior.BehaviorBase;
|
||||||
|
|
||||||
|
// TODO Copied form OpenJFX, check license issues and way how we integrated it
|
||||||
|
// We changed behaviour which was not exposed via APIs
|
||||||
|
/**
|
||||||
|
* @param <C>
|
||||||
|
*/
|
||||||
public class ConfidenceProgressIndicatorBehavior<C extends ConfidenceProgressIndicator> extends BehaviorBase<C> {
|
public class ConfidenceProgressIndicatorBehavior<C extends ConfidenceProgressIndicator> extends BehaviorBase<C> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,7 +64,9 @@ import com.sun.javafx.css.converters.PaintConverter;
|
||||||
import com.sun.javafx.css.converters.SizeConverter;
|
import com.sun.javafx.css.converters.SizeConverter;
|
||||||
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
|
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
|
||||||
|
|
||||||
@SuppressWarnings({"WeakerAccess", "SameReturnValue"})
|
// TODO Copied form OpenJFX, check license issues and way how we integrated it
|
||||||
|
// We changed behaviour which was not exposed via APIs
|
||||||
|
|
||||||
public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<ConfidenceProgressIndicator,
|
public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<ConfidenceProgressIndicator,
|
||||||
ConfidenceProgressIndicatorBehavior<ConfidenceProgressIndicator>> {
|
ConfidenceProgressIndicatorBehavior<ConfidenceProgressIndicator>> {
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Bitsquare.
|
|
||||||
*
|
|
||||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bitsquare.gui.components.processbar;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
|
|
||||||
public class ProcessStepBar<T> extends Control {
|
|
||||||
|
|
||||||
|
|
||||||
private List<ProcessStepItem> processStepItems = null;
|
|
||||||
|
|
||||||
public ProcessStepBar() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ProcessStepBar(List<ProcessStepItem> processStepItems) {
|
|
||||||
this.processStepItems = processStepItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Skin<?> createDefaultSkin() {
|
|
||||||
return new ProcessStepBarSkin<>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
List<ProcessStepItem> getProcessStepItems() {
|
|
||||||
return processStepItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProcessStepItems(List<ProcessStepItem> processStepItems) {
|
|
||||||
this.processStepItems = processStepItems;
|
|
||||||
if (getSkin() != null) {
|
|
||||||
((ProcessStepBarSkin) getSkin()).dataChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void next() {
|
|
||||||
((ProcessStepBarSkin) getSkin()).next();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,208 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Bitsquare.
|
|
||||||
*
|
|
||||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bitsquare.gui.components.processbar;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.scene.*;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.*;
|
|
||||||
import javafx.scene.paint.*;
|
|
||||||
import javafx.scene.shape.*;
|
|
||||||
|
|
||||||
import com.sun.javafx.scene.control.behavior.BehaviorBase;
|
|
||||||
import com.sun.javafx.scene.control.behavior.KeyBinding;
|
|
||||||
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
|
|
||||||
|
|
||||||
class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, BehaviorBase<ProcessStepBar<T>>> {
|
|
||||||
private final ProcessStepBar<T> controller;
|
|
||||||
private LabelWithBorder currentLabelWithBorder;
|
|
||||||
private LabelWithBorder prevLabelWithBorder;
|
|
||||||
private int index;
|
|
||||||
private List<LabelWithBorder> labelWithBorders;
|
|
||||||
|
|
||||||
public ProcessStepBarSkin(final ProcessStepBar<T> control) {
|
|
||||||
super(control, new BehaviorBase<>(control, Collections.<KeyBinding>emptyList()));
|
|
||||||
|
|
||||||
controller = getSkinnable();
|
|
||||||
|
|
||||||
applyData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dataChanged() {
|
|
||||||
applyData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyData() {
|
|
||||||
if (controller.getProcessStepItems() != null) {
|
|
||||||
int i = 0;
|
|
||||||
labelWithBorders = new ArrayList<>();
|
|
||||||
int size = controller.getProcessStepItems().size();
|
|
||||||
for (ProcessStepItem processStepItem : controller.getProcessStepItems()) {
|
|
||||||
LabelWithBorder labelWithBorder = new LabelWithBorder(processStepItem, i == 0, i == size - 1);
|
|
||||||
getChildren().add(labelWithBorder);
|
|
||||||
labelWithBorders.add(labelWithBorder);
|
|
||||||
if (i == 0) {
|
|
||||||
currentLabelWithBorder = prevLabelWithBorder = labelWithBorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentLabelWithBorder.select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void next() {
|
|
||||||
index++;
|
|
||||||
|
|
||||||
prevLabelWithBorder.deSelect();
|
|
||||||
if (index < labelWithBorders.size()) {
|
|
||||||
currentLabelWithBorder = labelWithBorders.get(index);
|
|
||||||
currentLabelWithBorder.select();
|
|
||||||
|
|
||||||
prevLabelWithBorder = currentLabelWithBorder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void layoutChildren(double x, double y, double width, double height) {
|
|
||||||
double distance = 10;
|
|
||||||
double padding = 50;
|
|
||||||
for (int i = 0; i < getChildren().size(); i++) {
|
|
||||||
Node node = getChildren().get(i);
|
|
||||||
|
|
||||||
double newWidth = snapSize(node.prefWidth(height)) + padding;
|
|
||||||
double newHeight = snapSize(node.prefHeight(-1) + 10);
|
|
||||||
|
|
||||||
if (i > 0) {
|
|
||||||
x = snapPosition(x - ((LabelWithBorder) node).getArrowWidth());
|
|
||||||
}
|
|
||||||
|
|
||||||
x = snapPosition(x);
|
|
||||||
y = snapPosition(y);
|
|
||||||
node.resize(newWidth, newHeight);
|
|
||||||
node.relocate(x, y);
|
|
||||||
x += newWidth + distance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static class LabelWithBorder extends Label {
|
|
||||||
final double borderWidth = 1;
|
|
||||||
private final double arrowWidth = 10;
|
|
||||||
private final double arrowHeight = 30;
|
|
||||||
|
|
||||||
private final ProcessStepItem processStepItem;
|
|
||||||
private final boolean isFirst;
|
|
||||||
private final boolean isLast;
|
|
||||||
|
|
||||||
public LabelWithBorder(ProcessStepItem processStepItem, boolean isFirst, boolean isLast) {
|
|
||||||
super(processStepItem.getLabel());
|
|
||||||
this.processStepItem = processStepItem;
|
|
||||||
|
|
||||||
this.isFirst = isFirst;
|
|
||||||
this.isLast = isLast;
|
|
||||||
|
|
||||||
setAlignment(Pos.CENTER);
|
|
||||||
setTextFill(Color.GRAY);
|
|
||||||
setStyle("-fx-font-size: 14");
|
|
||||||
|
|
||||||
this.setShape(createButtonShape());
|
|
||||||
|
|
||||||
BorderStroke borderStroke = new BorderStroke(Color.LIGHTGRAY, BorderStrokeStyle.SOLID, null,
|
|
||||||
new BorderWidths(borderWidth, borderWidth, borderWidth, borderWidth), Insets.EMPTY);
|
|
||||||
this.setBorder(new Border(borderStroke));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void select() {
|
|
||||||
BorderStroke borderStroke = new BorderStroke(processStepItem.getColor(), BorderStrokeStyle.SOLID, null,
|
|
||||||
new BorderWidths(borderWidth, borderWidth, borderWidth, borderWidth), Insets.EMPTY);
|
|
||||||
this.setBorder(new Border(borderStroke));
|
|
||||||
setTextFill(processStepItem.getColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deSelect() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getArrowWidth() {
|
|
||||||
return arrowWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Path createButtonShape() {
|
|
||||||
// build the following shape (or home without left arrow)
|
|
||||||
|
|
||||||
// --------
|
|
||||||
// \ \
|
|
||||||
// / /
|
|
||||||
// --------
|
|
||||||
Path path = new Path();
|
|
||||||
|
|
||||||
// begin in the upper left corner
|
|
||||||
MoveTo e1 = new MoveTo(0, 0);
|
|
||||||
path.getElements().add(e1);
|
|
||||||
|
|
||||||
// draw a horizontal line that defines the width of the shape
|
|
||||||
HLineTo e2 = new HLineTo();
|
|
||||||
// bind the width of the shape to the width of the button
|
|
||||||
e2.xProperty().bind(this.widthProperty().subtract(arrowWidth));
|
|
||||||
path.getElements().add(e2);
|
|
||||||
|
|
||||||
if (!isLast) {
|
|
||||||
// draw upper part of right arrow
|
|
||||||
LineTo e3 = new LineTo();
|
|
||||||
// the x endpoint of this line depends on the x property of line e2
|
|
||||||
e3.xProperty().bind(e2.xProperty().add(arrowWidth));
|
|
||||||
e3.setY(arrowHeight / 2.0);
|
|
||||||
path.getElements().add(e3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// draw lower part of right arrow
|
|
||||||
LineTo e4 = new LineTo();
|
|
||||||
// the x endpoint of this line depends on the x property of line e2
|
|
||||||
e4.xProperty().bind(e2.xProperty());
|
|
||||||
e4.setY(arrowHeight);
|
|
||||||
path.getElements().add(e4);
|
|
||||||
|
|
||||||
// draw lower horizontal line
|
|
||||||
HLineTo e5 = new HLineTo(0);
|
|
||||||
path.getElements().add(e5);
|
|
||||||
|
|
||||||
if (!isFirst) {
|
|
||||||
LineTo e6 = new LineTo(arrowWidth, arrowHeight / 2.0);
|
|
||||||
path.getElements().add(e6);
|
|
||||||
}
|
|
||||||
|
|
||||||
// close path
|
|
||||||
ClosePath e7 = new ClosePath();
|
|
||||||
path.getElements().add(e7);
|
|
||||||
// this is a dummy color to fill the shape, it won't be visible
|
|
||||||
path.setFill(Color.BLACK);
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Bitsquare.
|
|
||||||
*
|
|
||||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bitsquare.gui.components.processbar;
|
|
||||||
|
|
||||||
import io.bitsquare.gui.util.Colors;
|
|
||||||
|
|
||||||
import javafx.scene.paint.*;
|
|
||||||
|
|
||||||
public class ProcessStepItem {
|
|
||||||
private final String label;
|
|
||||||
private final Paint color;
|
|
||||||
private final boolean progressIndicator;
|
|
||||||
|
|
||||||
public ProcessStepItem(String label) {
|
|
||||||
this(label, Colors.BLUE, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProcessStepItem(String label, Paint color) {
|
|
||||||
this(label, color, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProcessStepItem(String label, Paint color, boolean hasProgressIndicator) {
|
|
||||||
this.label = label;
|
|
||||||
this.color = color;
|
|
||||||
this.progressIndicator = hasProgressIndicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Paint getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasProgressIndicator() {
|
|
||||||
return progressIndicator;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,7 +21,7 @@ import io.bitsquare.gui.CachedViewController;
|
||||||
import io.bitsquare.gui.NavigationItem;
|
import io.bitsquare.gui.NavigationItem;
|
||||||
import io.bitsquare.gui.ViewController;
|
import io.bitsquare.gui.ViewController;
|
||||||
import io.bitsquare.gui.components.CachingTabPane;
|
import io.bitsquare.gui.components.CachingTabPane;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
// TODO: might be removed completely
|
||||||
public class DepositController extends CachedViewController {
|
public class DepositController extends CachedViewController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(DepositController.class);
|
private static final Logger log = LoggerFactory.getLogger(DepositController.class);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ import javafx.scene.*;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
// home is just hosting the arbiters buttons yet, but that's just for dev, not clear yet what will be in home,
|
||||||
|
// probably overview, event history, new, charts,... -> low prio
|
||||||
public class HomeController extends CachedViewController {
|
public class HomeController extends CachedViewController {
|
||||||
private ArbitratorRegistrationController arbitratorRegistrationController;
|
private ArbitratorRegistrationController arbitratorRegistrationController;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ import javax.inject.Inject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
// will be probably only used for arbitration communication, will be renamed and the icon changed
|
||||||
|
|
||||||
public class MsgController extends CachedViewController {
|
public class MsgController extends CachedViewController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(MsgController.class);
|
private static final Logger log = LoggerFactory.getLogger(MsgController.class);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import io.bitsquare.gui.CachedViewController;
|
||||||
import io.bitsquare.gui.NavigationItem;
|
import io.bitsquare.gui.NavigationItem;
|
||||||
import io.bitsquare.gui.ViewController;
|
import io.bitsquare.gui.ViewController;
|
||||||
import io.bitsquare.gui.components.CachingTabPane;
|
import io.bitsquare.gui.components.CachingTabPane;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
//TODO impl. missing yet
|
||||||
public class ClosedTradeController extends CachedViewController {
|
public class ClosedTradeController extends CachedViewController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ClosedTradeController.class);
|
private static final Logger log = LoggerFactory.getLogger(ClosedTradeController.class);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import io.bitsquare.btc.WalletFacade;
|
||||||
import io.bitsquare.gui.CachedViewController;
|
import io.bitsquare.gui.CachedViewController;
|
||||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.gui.util.ConfidenceDisplay;
|
import io.bitsquare.gui.components.ConfidenceDisplay;
|
||||||
import io.bitsquare.gui.util.ImageUtil;
|
import io.bitsquare.gui.util.ImageUtil;
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
|
|
|
@ -35,9 +35,9 @@ import io.bitsquare.locale.Localisation;
|
||||||
import io.bitsquare.locale.Region;
|
import io.bitsquare.locale.Region;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.user.Reputation;
|
import io.bitsquare.arbitrator.Reputation;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
import io.bitsquare.util.DSAKeyUtil;
|
import io.bitsquare.util.DSAKeyUtil;
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ import org.controlsfx.control.action.Action;
|
||||||
import org.controlsfx.dialog.Dialog;
|
import org.controlsfx.dialog.Dialog;
|
||||||
|
|
||||||
// TODO separate in 2 view/controllers
|
// TODO separate in 2 view/controllers
|
||||||
|
// TODO: change ui to dispaly a menu on the left and the content on the right
|
||||||
|
// there will be more screens
|
||||||
|
|
||||||
public class SettingsController extends CachedViewController {
|
public class SettingsController extends CachedViewController {
|
||||||
private final User user;
|
private final User user;
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
|
@ -183,7 +186,7 @@ public class SettingsController extends CachedViewController {
|
||||||
Scene scene = new Scene((Parent) view, 800, 600);
|
Scene scene = new Scene((Parent) view, 800, 600);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setOnHidden(windowEvent -> {
|
stage.setOnHidden(windowEvent -> {
|
||||||
if (navigationItem == NavigationItem.ARBITRATOR_OVERVIEW)
|
if (navigationItem == NavigationItem.ARBITRATOR_BROWSER)
|
||||||
updateArbitrators();
|
updateArbitrators();
|
||||||
});
|
});
|
||||||
stage.show();
|
stage.show();
|
||||||
|
@ -232,7 +235,7 @@ public class SettingsController extends CachedViewController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void onOpenArbitratorScreen() {
|
public void onOpenArbitratorScreen() {
|
||||||
loadViewAndGetChildController(NavigationItem.ARBITRATOR_OVERVIEW);
|
loadViewAndGetChildController(NavigationItem.ARBITRATOR_BROWSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import io.bitsquare.gui.ViewController;
|
||||||
import io.bitsquare.gui.components.ValidatingTextField;
|
import io.bitsquare.gui.components.ValidatingTextField;
|
||||||
import io.bitsquare.gui.trade.createoffer.CreateOfferCodeBehind;
|
import io.bitsquare.gui.trade.createoffer.CreateOfferCodeBehind;
|
||||||
import io.bitsquare.gui.trade.orderbook.OrderBookController;
|
import io.bitsquare.gui.trade.orderbook.OrderBookController;
|
||||||
import io.bitsquare.gui.trade.takeoffer.TakerOfferController;
|
import io.bitsquare.gui.trade.takeoffer.TakeOfferController;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -47,7 +47,7 @@ public class TradeController extends CachedViewController {
|
||||||
|
|
||||||
protected OrderBookController orderBookController;
|
protected OrderBookController orderBookController;
|
||||||
protected CreateOfferCodeBehind createOfferCodeBehind;
|
protected CreateOfferCodeBehind createOfferCodeBehind;
|
||||||
protected TakerOfferController takerOfferController;
|
protected TakeOfferController takeOfferController;
|
||||||
protected GuiceFXMLLoader orderBookLoader;
|
protected GuiceFXMLLoader orderBookLoader;
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,20 +126,20 @@ public class TradeController extends CachedViewController {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (navigationItem == NavigationItem.TAKE_OFFER) {
|
else if (navigationItem == NavigationItem.TAKE_OFFER) {
|
||||||
checkArgument(takerOfferController == null);
|
checkArgument(takeOfferController == null);
|
||||||
|
|
||||||
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times
|
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times
|
||||||
// in different graphs
|
// in different graphs
|
||||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||||
try {
|
try {
|
||||||
final Parent view = loader.load();
|
final Parent view = loader.load();
|
||||||
takerOfferController = loader.getController();
|
takeOfferController = loader.getController();
|
||||||
takerOfferController.setParentController(this);
|
takeOfferController.setParentController(this);
|
||||||
final Tab tab = new Tab("Take offer");
|
final Tab tab = new Tab("Take offer");
|
||||||
tab.setContent(view);
|
tab.setContent(view);
|
||||||
tabPane.getTabs().add(tab);
|
tabPane.getTabs().add(tab);
|
||||||
tabPane.getSelectionModel().select(tabPane.getTabs().size() - 1);
|
tabPane.getSelectionModel().select(tabPane.getTabs().size() - 1);
|
||||||
return takerOfferController;
|
return takeOfferController;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public class TradeController extends CachedViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTakeOfferViewRemoved() {
|
public void onTakeOfferViewRemoved() {
|
||||||
takerOfferController = null;
|
takeOfferController = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model:
|
* Data model:
|
||||||
* Does not know the Presenter and View (CodeBehind)
|
* Does not know the Presenter and View (CodeBehind)
|
||||||
* Use Guice for DI
|
* Use Guice for DI
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
|
@ -45,7 +45,7 @@ import static javafx.beans.binding.Bindings.createStringBinding;
|
||||||
* Knows Model, does not know the View (CodeBehind)
|
* Knows Model, does not know the View (CodeBehind)
|
||||||
* <p/>
|
* <p/>
|
||||||
* - Holds data and state of the View (formatted)
|
* - Holds data and state of the View (formatted)
|
||||||
* - Receive view input from Controller. Validates input, apply business logic, format to Presenter properties and
|
* - Receive view input from CodeBehind. Validates input, apply business logic, format to Presenter properties and
|
||||||
* convert input to Model.
|
* convert input to Model.
|
||||||
* - Listen to updates from Model, apply business logic and format it to Presenter properties. Model update handling
|
* - Listen to updates from Model, apply business logic and format it to Presenter properties. Model update handling
|
||||||
* can be done via Binding.
|
* can be done via Binding.
|
||||||
|
|
|
@ -26,7 +26,7 @@ import io.bitsquare.gui.NavigationItem;
|
||||||
import io.bitsquare.gui.ViewController;
|
import io.bitsquare.gui.ViewController;
|
||||||
import io.bitsquare.gui.components.Popups;
|
import io.bitsquare.gui.components.Popups;
|
||||||
import io.bitsquare.gui.trade.createoffer.CreateOfferCodeBehind;
|
import io.bitsquare.gui.trade.createoffer.CreateOfferCodeBehind;
|
||||||
import io.bitsquare.gui.trade.takeoffer.TakerOfferController;
|
import io.bitsquare.gui.trade.takeoffer.TakeOfferController;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.gui.util.ImageUtil;
|
import io.bitsquare.gui.util.ImageUtil;
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
|
@ -34,7 +34,7 @@ import io.bitsquare.locale.CurrencyUtil;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
import io.bitsquare.trade.Offer;
|
import io.bitsquare.trade.Offer;
|
||||||
import io.bitsquare.trade.orderbook.OrderBook;
|
import io.bitsquare.trade.orderbook.OrderBook;
|
||||||
|
@ -343,8 +343,8 @@ public class OrderBookController extends CachedViewController {
|
||||||
|
|
||||||
private void takeOffer(Offer offer) {
|
private void takeOffer(Offer offer) {
|
||||||
if (isRegistered()) {
|
if (isRegistered()) {
|
||||||
TakerOfferController takerOfferController =
|
TakeOfferController takeOfferController =
|
||||||
(TakerOfferController) parentController.loadViewAndGetChildController(NavigationItem.TAKE_OFFER);
|
(TakeOfferController) parentController.loadViewAndGetChildController(NavigationItem.TAKE_OFFER);
|
||||||
|
|
||||||
Coin requestedAmount;
|
Coin requestedAmount;
|
||||||
if (!"".equals(amount.getText())) {
|
if (!"".equals(amount.getText())) {
|
||||||
|
@ -354,8 +354,8 @@ public class OrderBookController extends CachedViewController {
|
||||||
requestedAmount = offer.getAmount();
|
requestedAmount = offer.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (takerOfferController != null) {
|
if (takeOfferController != null) {
|
||||||
takerOfferController.initWithData(offer, requestedAmount);
|
takeOfferController.initWithData(offer, requestedAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -46,8 +46,8 @@ import javafx.scene.control.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class TakerOfferController extends CachedViewController {
|
public class TakeOfferController extends CachedViewController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(TakerOfferController.class);
|
private static final Logger log = LoggerFactory.getLogger(TakeOfferController.class);
|
||||||
|
|
||||||
private final TradeManager tradeManager;
|
private final TradeManager tradeManager;
|
||||||
private final WalletFacade walletFacade;
|
private final WalletFacade walletFacade;
|
||||||
|
@ -74,7 +74,7 @@ public class TakerOfferController extends CachedViewController {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private TakerOfferController(TradeManager tradeManager, WalletFacade walletFacade) {
|
private TakeOfferController(TradeManager tradeManager, WalletFacade walletFacade) {
|
||||||
this.tradeManager = tradeManager;
|
this.tradeManager = tradeManager;
|
||||||
this.walletFacade = walletFacade;
|
this.walletFacade = walletFacade;
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.trade.takeoffer.TakerOfferController"
|
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.trade.takeoffer.TakeOfferController"
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
||||||
<Accordion fx:id="accordion" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
<Accordion fx:id="accordion" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
||||||
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
|
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
|
||||||
|
|
|
@ -20,7 +20,7 @@ package io.bitsquare.gui.util;
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
import com.google.bitcoin.utils.CoinFormat;
|
import com.google.bitcoin.utils.CoinFormat;
|
||||||
|
|
|
@ -47,12 +47,10 @@ public class ImageUtil {
|
||||||
public static final String SELL = "/images/sell.png";
|
public static final String SELL = "/images/sell.png";
|
||||||
public static final String REMOVE = "/images/removeOffer.png";
|
public static final String REMOVE = "/images/removeOffer.png";
|
||||||
|
|
||||||
|
|
||||||
public static Image getIconImage(String iconName) {
|
public static Image getIconImage(String iconName) {
|
||||||
return new Image(ImageUtil.class.getResourceAsStream(iconName));
|
return new Image(ImageUtil.class.getResourceAsStream(iconName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ImageView getIconImageView(String iconName) {
|
public static ImageView getIconImageView(String iconName) {
|
||||||
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName)));
|
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
import com.google.bitcoin.core.NetworkParameters;
|
import com.google.bitcoin.core.NetworkParameters;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
import io.bitsquare.gui.components.ValidatingTextField;
|
import io.bitsquare.gui.components.ValidatingTextField;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.msg;
|
package io.bitsquare.msg;
|
||||||
|
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
|
|
|
@ -24,8 +24,8 @@ import io.bitsquare.msg.listeners.IncomingTradeMessageListener;
|
||||||
import io.bitsquare.msg.listeners.OrderBookListener;
|
import io.bitsquare.msg.listeners.OrderBookListener;
|
||||||
import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
|
import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
|
||||||
import io.bitsquare.trade.Offer;
|
import io.bitsquare.trade.Offer;
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package io.bitsquare.msg;
|
package io.bitsquare.msg;
|
||||||
|
|
||||||
import io.bitsquare.BitSquare;
|
import io.bitsquare.BitSquare;
|
||||||
import io.bitsquare.util.StorageDirectory;
|
import io.bitsquare.util.AppDirectoryUtil;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
@ -302,7 +302,7 @@ public class P2PNode {
|
||||||
if (useDiscStorage) {
|
if (useDiscStorage) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
File path = new File(StorageDirectory.getStorageDirectory().getCanonicalPath() + "/" + BitSquare
|
File path = new File(AppDirectoryUtil.getStorageDirectory().getCanonicalPath() + "/" + BitSquare
|
||||||
.getAppName() + "_tomP2P");
|
.getAppName() + "_tomP2P");
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
boolean created = path.mkdir();
|
boolean created = path.mkdir();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.msg.listeners;
|
package io.bitsquare.msg.listeners;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import net.tomp2p.peers.PeerAddress;
|
import net.tomp2p.peers.PeerAddress;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.storage;
|
package io.bitsquare.persistence;
|
||||||
|
|
||||||
import io.bitsquare.BitSquare;
|
import io.bitsquare.BitSquare;
|
||||||
import io.bitsquare.util.FileUtil;
|
import io.bitsquare.util.FileUtil;
|
|
@ -18,7 +18,7 @@
|
||||||
package io.bitsquare.settings;
|
package io.bitsquare.settings;
|
||||||
|
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ import java.io.Serializable;
|
||||||
|
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
|
|
||||||
|
//TODO flatten down?
|
||||||
|
// TODO The relation Offer, Trade and Contract need to be reviewed and might be changed
|
||||||
|
|
||||||
public class Contract implements Serializable {
|
public class Contract implements Serializable {
|
||||||
private static final long serialVersionUID = 71472356206100158L;
|
private static final long serialVersionUID = 71472356206100158L;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ package io.bitsquare.trade;
|
||||||
|
|
||||||
import io.bitsquare.bank.BankAccountType;
|
import io.bitsquare.bank.BankAccountType;
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
//TODO flatten down?
|
||||||
|
|
||||||
public class Offer implements Serializable {
|
public class Offer implements Serializable {
|
||||||
private static final long serialVersionUID = -971164804305475826L;
|
private static final long serialVersionUID = -971164804305475826L;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ import java.io.Serializable;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
|
||||||
|
//TODO flatten down?
|
||||||
|
|
||||||
public class Trade implements Serializable {
|
public class Trade implements Serializable {
|
||||||
private static final long serialVersionUID = -8275323072940974077L;
|
private static final long serialVersionUID = -8275323072940974077L;
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ import io.bitsquare.gui.components.Popups;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.msg.listeners.TakeOfferRequestListener;
|
import io.bitsquare.msg.listeners.TakeOfferRequestListener;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.trade.handlers.ErrorMessageHandler;
|
import io.bitsquare.trade.handlers.ErrorMessageHandler;
|
||||||
import io.bitsquare.trade.handlers.TransactionResultHandler;
|
import io.bitsquare.trade.handlers.TransactionResultHandler;
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
import io.bitsquare.trade.protocol.createoffer.CreateOfferCoordinator;
|
import io.bitsquare.trade.protocol.createoffer.CreateOfferCoordinator;
|
||||||
import io.bitsquare.trade.protocol.trade.offerer.BuyerAcceptsOfferProtocol;
|
import io.bitsquare.trade.protocol.trade.offerer.BuyerAcceptsOfferProtocol;
|
||||||
import io.bitsquare.trade.protocol.trade.offerer.BuyerAcceptsOfferProtocolListener;
|
import io.bitsquare.trade.protocol.trade.offerer.BuyerAcceptsOfferProtocolListener;
|
||||||
|
@ -67,6 +67,10 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The domain for the trading
|
||||||
|
* TODO: Too messy, need to be improved a lot....
|
||||||
|
*/
|
||||||
public class TradeManager {
|
public class TradeManager {
|
||||||
private static final Logger log = LoggerFactory.getLogger(TradeManager.class);
|
private static final Logger log = LoggerFactory.getLogger(TradeManager.class);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import io.bitsquare.settings.Settings;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
import io.bitsquare.trade.Offer;
|
import io.bitsquare.trade.Offer;
|
||||||
import io.bitsquare.trade.TradeManager;
|
import io.bitsquare.trade.TradeManager;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -19,7 +19,7 @@ package io.bitsquare.trade.protocol.createoffer;
|
||||||
|
|
||||||
import io.bitsquare.btc.WalletFacade;
|
import io.bitsquare.btc.WalletFacade;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.storage.Persistence;
|
import io.bitsquare.persistence.Persistence;
|
||||||
import io.bitsquare.trade.Offer;
|
import io.bitsquare.trade.Offer;
|
||||||
import io.bitsquare.trade.handlers.FaultHandler;
|
import io.bitsquare.trade.handlers.FaultHandler;
|
||||||
import io.bitsquare.trade.handlers.TransactionResultHandler;
|
import io.bitsquare.trade.handlers.TransactionResultHandler;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol;
|
package io.bitsquare.trade.protocol.trade;
|
||||||
|
|
||||||
public interface TradeMessage {
|
public interface TradeMessage {
|
||||||
public String getTradeId();
|
public String getTradeId();
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
||||||
|
|
||||||
import io.bitsquare.bank.BankAccount;
|
import io.bitsquare.bank.BankAccount;
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
package io.bitsquare.trade.protocol.trade.offerer.messages;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol.trade.taker.messages;
|
package io.bitsquare.trade.protocol.trade.taker.messages;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package io.bitsquare.trade.protocol.trade.taker.messages;
|
package io.bitsquare.trade.protocol.trade.taker.messages;
|
||||||
|
|
||||||
import io.bitsquare.bank.BankAccount;
|
import io.bitsquare.bank.BankAccount;
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol.trade.taker.messages;
|
package io.bitsquare.trade.protocol.trade.taker.messages;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.trade.protocol.trade.taker.messages;
|
package io.bitsquare.trade.protocol.trade.taker.messages;
|
||||||
|
|
||||||
import io.bitsquare.trade.protocol.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The User is persisted locally it is never transmitted over the wire (messageKeyPair contains private key!).
|
* The User is persisted locally.
|
||||||
|
* It must never be transmitted over the wire (messageKeyPair contains private key!).
|
||||||
*/
|
*/
|
||||||
public class User implements Serializable {
|
public class User implements Serializable {
|
||||||
private static final Logger log = LoggerFactory.getLogger(User.class);
|
private static final Logger log = LoggerFactory.getLogger(User.class);
|
||||||
|
|
|
@ -31,6 +31,10 @@ import javafx.stage.Stage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is no JavaFX support yet, so we need to use AWT.
|
||||||
|
* TODO research more
|
||||||
|
*/
|
||||||
public class AWTSystemTray {
|
public class AWTSystemTray {
|
||||||
private static final Logger log = LoggerFactory.getLogger(AWTSystemTray.class);
|
private static final Logger log = LoggerFactory.getLogger(AWTSystemTray.class);
|
||||||
private static boolean isStageVisible = true;
|
private static boolean isStageVisible = true;
|
||||||
|
|
|
@ -23,8 +23,8 @@ import java.io.IOException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class StorageDirectory {
|
public class AppDirectoryUtil {
|
||||||
private static final Logger log = LoggerFactory.getLogger(StorageDirectory.class);
|
private static final Logger log = LoggerFactory.getLogger(AppDirectoryUtil.class);
|
||||||
private static File storageDirectory;
|
private static File storageDirectory;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -53,7 +53,7 @@ public class StorageDirectory {
|
||||||
|
|
||||||
public static File getApplicationDirectory() {
|
public static File getApplicationDirectory() {
|
||||||
File executionRoot =
|
File executionRoot =
|
||||||
new File(StorageDirectory.class.getProtectionDomain().getCodeSource().getLocation().getFile());
|
new File(AppDirectoryUtil.class.getProtectionDomain().getCodeSource().getLocation().getFile());
|
||||||
try {
|
try {
|
||||||
log.trace("executionRoot " + executionRoot.getCanonicalPath());
|
log.trace("executionRoot " + executionRoot.getCanonicalPath());
|
||||||
|
|
|
@ -31,12 +31,6 @@ import org.slf4j.LoggerFactory;
|
||||||
public class DSAKeyUtil {
|
public class DSAKeyUtil {
|
||||||
private static final Logger log = LoggerFactory.getLogger(DSAKeyUtil.class);
|
private static final Logger log = LoggerFactory.getLogger(DSAKeyUtil.class);
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Public API
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
public static String getHexStringFromPublicKey(PublicKey publicKey) {
|
public static String getHexStringFromPublicKey(PublicKey publicKey) {
|
||||||
final X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(publicKey.getEncoded());
|
final X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(publicKey.getEncoded());
|
||||||
return Utils.HEX.encode(x509EncodedKeySpec.getEncoded());
|
return Utils.HEX.encode(x509EncodedKeySpec.getEncoded());
|
||||||
|
|
|
@ -29,11 +29,11 @@ public class FileUtil {
|
||||||
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
|
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
|
||||||
|
|
||||||
public static File getFile(String name, String suffix) {
|
public static File getFile(String name, String suffix) {
|
||||||
return new File(StorageDirectory.getStorageDirectory(), name + "." + suffix);
|
return new File(AppDirectoryUtil.getStorageDirectory(), name + "." + suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getTempFile(String prefix) throws IOException {
|
public static File getTempFile(String prefix) throws IOException {
|
||||||
return File.createTempFile("temp_" + prefix, null, StorageDirectory.getStorageDirectory());
|
return File.createTempFile("temp_" + prefix, null, AppDirectoryUtil.getStorageDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeTempFileToFile(File tempFile, File file) throws IOException {
|
public static void writeTempFileToFile(File tempFile, File file) throws IOException {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# TODO: locale support will be added when ui is more final
|
||||||
|
|
||||||
# generic
|
# generic
|
||||||
OTHER=Other
|
OTHER=Other
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util;
|
||||||
|
|
||||||
|
import io.bitsquare.gui.util.validation.BtcValidator;
|
||||||
|
import io.bitsquare.gui.util.validation.NumberValidator;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
import com.google.bitcoin.core.NetworkParameters;
|
import com.google.bitcoin.core.NetworkParameters;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util;
|
||||||
|
|
||||||
|
import io.bitsquare.gui.util.validation.FiatValidator;
|
||||||
|
import io.bitsquare.gui.util.validation.NumberValidator;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
Loading…
Add table
Reference in a new issue