tx table
|
@ -66,8 +66,8 @@ public class BitSquare extends Application
|
||||||
final Scene scene = new Scene(mainView, 800, 600);
|
final Scene scene = new Scene(mainView, 800, 600);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
|
|
||||||
final String global = getClass().getResource("/io/bitsquare/gui/global.css").toExternalForm();
|
final String bitsquare = getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm();
|
||||||
scene.getStylesheets().setAll(global);
|
scene.getStylesheets().setAll(bitsquare);
|
||||||
|
|
||||||
stage.setMinWidth(800);
|
stage.setMinWidth(800);
|
||||||
stage.setMinHeight(400);
|
stage.setMinHeight(400);
|
||||||
|
|
|
@ -498,7 +498,12 @@ public class WalletFacade
|
||||||
{
|
{
|
||||||
BalanceListener balanceListener = balanceListeners.get(i);
|
BalanceListener balanceListener = balanceListeners.get(i);
|
||||||
|
|
||||||
BigInteger balance = getBalanceForAddress(balanceListener.getAddress());
|
BigInteger balance;
|
||||||
|
if (balanceListener.getAddress() != null)
|
||||||
|
balance = getBalanceForAddress(balanceListener.getAddress());
|
||||||
|
else
|
||||||
|
balance = getWalletBalance();
|
||||||
|
|
||||||
balanceListener.onBalanceChanged(balance);
|
balanceListener.onBalanceChanged(balance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,10 @@ public class BalanceListener
|
||||||
{
|
{
|
||||||
private Address address;
|
private Address address;
|
||||||
|
|
||||||
|
public BalanceListener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public BalanceListener(Address address)
|
public BalanceListener(Address address)
|
||||||
{
|
{
|
||||||
this.address = address;
|
this.address = address;
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
package io.bitsquare.gui;
|
package io.bitsquare.gui;
|
||||||
|
|
||||||
import com.google.bitcoin.core.ECKey;
|
|
||||||
import com.google.bitcoin.core.Transaction;
|
|
||||||
import com.google.bitcoin.core.Wallet;
|
|
||||||
import com.google.bitcoin.core.WalletEventListener;
|
|
||||||
import com.google.bitcoin.script.Script;
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import io.bitsquare.bank.BankAccount;
|
import io.bitsquare.bank.BankAccount;
|
||||||
import io.bitsquare.btc.BtcFormatter;
|
import io.bitsquare.btc.BtcFormatter;
|
||||||
import io.bitsquare.btc.WalletFacade;
|
import io.bitsquare.btc.WalletFacade;
|
||||||
|
import io.bitsquare.btc.listeners.BalanceListener;
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.components.NetworkSyncPane;
|
import io.bitsquare.gui.components.NetworkSyncPane;
|
||||||
import io.bitsquare.gui.market.MarketController;
|
import io.bitsquare.gui.market.MarketController;
|
||||||
|
@ -30,7 +26,10 @@ import javafx.scene.Node;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
import net.tomp2p.peers.PeerAddress;
|
import net.tomp2p.peers.PeerAddress;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -40,7 +39,6 @@ import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class MainController implements Initializable, NavigationController
|
public class MainController implements Initializable, NavigationController
|
||||||
|
@ -48,32 +46,31 @@ public class MainController implements Initializable, NavigationController
|
||||||
private static final Logger log = LoggerFactory.getLogger(MainController.class);
|
private static final Logger log = LoggerFactory.getLogger(MainController.class);
|
||||||
private static MainController mainController;
|
private static MainController mainController;
|
||||||
|
|
||||||
|
|
||||||
private User user;
|
private User user;
|
||||||
private WalletFacade walletFacade;
|
private WalletFacade walletFacade;
|
||||||
private MessageFacade messageFacade;
|
private MessageFacade messageFacade;
|
||||||
private Trading trading;
|
private Trading trading;
|
||||||
private ChildController childController;
|
private ChildController childController;
|
||||||
private ToggleGroup toggleGroup;
|
private Storage storage;
|
||||||
|
private String selectedNavigationItemStorageId;
|
||||||
|
private NavigationItem selectedNavigationItem;
|
||||||
|
private NetworkSyncPane networkSyncPane;
|
||||||
|
private ToggleGroup toggleGroup = new ToggleGroup();
|
||||||
private ToggleButton prevToggleButton;
|
private ToggleButton prevToggleButton;
|
||||||
private Image prevToggleButtonIcon;
|
private Image prevToggleButtonIcon;
|
||||||
private NetworkSyncPane networkSyncPane;
|
private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton;
|
||||||
private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, historyButton, fundsButton, settingsButton;
|
private Pane msgButtonHolder, ordersButtonButtonHolder;
|
||||||
private Pane msgButtonHolder, buyButtonHolder, sellButtonHolder, ordersButtonButtonHolder;
|
|
||||||
private TextField balanceTextField;
|
private TextField balanceTextField;
|
||||||
private Storage storage;
|
|
||||||
private String storageId;
|
|
||||||
private ToggleButton selectedNavigationItem;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public Pane contentPane;
|
public Pane contentPane;
|
||||||
@FXML
|
@FXML
|
||||||
public HBox leftNavPane, rightNavPane;
|
public HBox leftNavPane, rightNavPane;
|
||||||
@FXML
|
@FXML
|
||||||
public StackPane rootContainer;
|
|
||||||
@FXML
|
|
||||||
public AnchorPane anchorPane;
|
public AnchorPane anchorPane;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -88,8 +85,8 @@ public class MainController implements Initializable, NavigationController
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
|
|
||||||
MainController.mainController = this;
|
MainController.mainController = this;
|
||||||
storageId = this.getClass().getName() + ".selectedNavigationItem";
|
|
||||||
|
|
||||||
|
selectedNavigationItemStorageId = this.getClass().getName() + ".selectedNavigationItem";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainController getInstance()
|
public static MainController getInstance()
|
||||||
|
@ -130,18 +127,12 @@ public class MainController implements Initializable, NavigationController
|
||||||
|
|
||||||
buildNavigation();
|
buildNavigation();
|
||||||
|
|
||||||
selectedNavigationItem = (ToggleButton) storage.read(storageId);
|
Object f = storage.read(selectedNavigationItemStorageId);
|
||||||
|
selectedNavigationItem = (NavigationItem) storage.read(selectedNavigationItemStorageId);
|
||||||
if (selectedNavigationItem == null)
|
if (selectedNavigationItem == null)
|
||||||
selectedNavigationItem = homeButton;
|
selectedNavigationItem = NavigationItem.HOME;
|
||||||
|
|
||||||
selectedNavigationItem.fire();
|
navigateToView(selectedNavigationItem);
|
||||||
//homeButton.fire();
|
|
||||||
//settingsButton.fire();
|
|
||||||
//fundsButton.fire();
|
|
||||||
// sellButton.fire();
|
|
||||||
// ordersButton.fire();
|
|
||||||
// homeButton.fire();
|
|
||||||
// msgButton.fire();
|
|
||||||
|
|
||||||
AnchorPane.setBottomAnchor(networkSyncPane, 0.0);
|
AnchorPane.setBottomAnchor(networkSyncPane, 0.0);
|
||||||
AnchorPane.setLeftAnchor(networkSyncPane, 0.0);
|
AnchorPane.setLeftAnchor(networkSyncPane, 0.0);
|
||||||
|
@ -149,6 +140,7 @@ public class MainController implements Initializable, NavigationController
|
||||||
messageFacade.addTakeOfferRequestListener((tradingMessage, sender) -> showTakeOfferRequest(tradingMessage, sender));
|
messageFacade.addTakeOfferRequestListener((tradingMessage, sender) -> showTakeOfferRequest(tradingMessage, sender));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showTakeOfferRequest(final TradeMessage tradeMessage, PeerAddress sender)
|
private void showTakeOfferRequest(final TradeMessage tradeMessage, PeerAddress sender)
|
||||||
{
|
{
|
||||||
trading.createOffererPaymentProtocol(tradeMessage, sender);
|
trading.createOffererPaymentProtocol(tradeMessage, sender);
|
||||||
|
@ -177,35 +169,37 @@ public class MainController implements Initializable, NavigationController
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
// use the buttons to trigger the change to get the correct button states
|
switch (navigationItem)
|
||||||
switch (fxmlView)
|
|
||||||
{
|
{
|
||||||
case NavigationController.HOME:
|
case HOME:
|
||||||
homeButton.fire();
|
homeButton.fire();
|
||||||
break;
|
break;
|
||||||
case NavigationController.FUNDS:
|
case FUNDS:
|
||||||
fundsButton.fire();
|
fundsButton.fire();
|
||||||
break;
|
break;
|
||||||
case NavigationController.HISTORY:
|
case MSG:
|
||||||
historyButton.fire();
|
|
||||||
break;
|
|
||||||
case NavigationController.MSG:
|
|
||||||
msgButton.fire();
|
msgButton.fire();
|
||||||
break;
|
break;
|
||||||
case NavigationController.ORDERS:
|
case ORDERS:
|
||||||
ordersButton.fire();
|
ordersButton.fire();
|
||||||
break;
|
break;
|
||||||
case NavigationController.SETTINGS:
|
case SETTINGS:
|
||||||
settingsButton.fire();
|
settingsButton.fire();
|
||||||
break;
|
break;
|
||||||
|
case SELL:
|
||||||
|
sellButton.fire();
|
||||||
|
break;
|
||||||
|
case BUY:
|
||||||
|
buyButton.fire();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return navigateToView(fxmlView, "");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
if (childController != null)
|
if (childController != null)
|
||||||
childController.cleanup();
|
childController.cleanup();
|
||||||
|
@ -232,41 +226,29 @@ public class MainController implements Initializable, NavigationController
|
||||||
|
|
||||||
private void buildNavigation()
|
private void buildNavigation()
|
||||||
{
|
{
|
||||||
toggleGroup = new ToggleGroup();
|
homeButton = addNavButton(leftNavPane, "Overview", Icons.HOME, Icons.HOME_ACTIVE, NavigationViewURL.HOME, NavigationItem.HOME);
|
||||||
|
|
||||||
homeButton = addNavButton(leftNavPane, "Overview", Icons.HOME, Icons.HOME_ACTIVE, NavigationController.HOME);
|
buyButton = addNavButton(leftNavPane, "Buy BTC", Icons.NAV_BUY, Icons.NAV_BUY_ACTIVE, NavigationViewURL.MARKET, NavigationItem.BUY);
|
||||||
|
|
||||||
buyButtonHolder = new Pane();
|
sellButton = addNavButton(leftNavPane, "Sell BTC", Icons.NAV_SELL, Icons.NAV_SELL_ACTIVE, NavigationViewURL.MARKET, NavigationItem.SELL);
|
||||||
buyButton = addNavButton(buyButtonHolder, "Buy BTC", Icons.NAV_BUY, Icons.NAV_BUY_ACTIVE, NavigationController.MARKET, Direction.BUY);
|
|
||||||
leftNavPane.getChildren().add(buyButtonHolder);
|
|
||||||
|
|
||||||
sellButtonHolder = new Pane();
|
|
||||||
sellButton = addNavButton(sellButtonHolder, "Sell BTC", Icons.NAV_SELL, Icons.NAV_SELL_ACTIVE, NavigationController.MARKET, Direction.SELL);
|
|
||||||
leftNavPane.getChildren().add(sellButtonHolder);
|
|
||||||
|
|
||||||
ordersButtonButtonHolder = new Pane();
|
ordersButtonButtonHolder = new Pane();
|
||||||
ordersButton = addNavButton(ordersButtonButtonHolder, "Orders", Icons.ORDERS, Icons.ORDERS_ACTIVE, NavigationController.ORDERS);
|
ordersButton = addNavButton(ordersButtonButtonHolder, "Orders", Icons.ORDERS, Icons.ORDERS_ACTIVE, NavigationViewURL.ORDERS, NavigationItem.ORDERS);
|
||||||
leftNavPane.getChildren().add(ordersButtonButtonHolder);
|
leftNavPane.getChildren().add(ordersButtonButtonHolder);
|
||||||
|
|
||||||
historyButton = addNavButton(leftNavPane, "History", Icons.HISTORY, Icons.HISTORY_ACTIVE, NavigationController.HISTORY);
|
fundsButton = addNavButton(leftNavPane, "Funds", Icons.FUNDS, Icons.FUNDS_ACTIVE, NavigationViewURL.FUNDS, NavigationItem.FUNDS);
|
||||||
fundsButton = addNavButton(leftNavPane, "Funds", Icons.FUNDS, Icons.FUNDS_ACTIVE, NavigationController.FUNDS);
|
|
||||||
|
|
||||||
msgButtonHolder = new Pane();
|
msgButtonHolder = new Pane();
|
||||||
msgButton = addNavButton(msgButtonHolder, "Message", Icons.MSG, Icons.MSG_ACTIVE, NavigationController.MSG);
|
msgButton = addNavButton(msgButtonHolder, "Message", Icons.MSG, Icons.MSG_ACTIVE, NavigationViewURL.MSG, NavigationItem.MSG);
|
||||||
leftNavPane.getChildren().add(msgButtonHolder);
|
leftNavPane.getChildren().add(msgButtonHolder);
|
||||||
|
|
||||||
addBalanceInfo(rightNavPane);
|
addBalanceInfo(rightNavPane);
|
||||||
addAccountComboBox(rightNavPane);
|
addAccountComboBox(rightNavPane);
|
||||||
|
|
||||||
settingsButton = addNavButton(rightNavPane, "Settings", Icons.SETTINGS, Icons.SETTINGS_ACTIVE, NavigationController.SETTINGS);
|
settingsButton = addNavButton(rightNavPane, "Settings", Icons.SETTINGS, Icons.SETTINGS_ACTIVE, NavigationViewURL.SETTINGS, NavigationItem.SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToggleButton addNavButton(Pane parent, String title, String iconId, String iconIdActivated, String navTarget)
|
private ToggleButton addNavButton(Pane parent, String title, String iconId, String iconIdActivated, String navTarget, NavigationItem navigationItem)
|
||||||
{
|
|
||||||
return addNavButton(parent, title, iconId, iconIdActivated, navTarget, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ToggleButton addNavButton(Pane parent, String title, String iconId, String iconIdActivated, String navTarget, Direction direction)
|
|
||||||
{
|
{
|
||||||
Pane pane = new Pane();
|
Pane pane = new Pane();
|
||||||
pane.setPrefSize(50, 50);
|
pane.setPrefSize(50, 50);
|
||||||
|
@ -282,18 +264,12 @@ public class MainController implements Initializable, NavigationController
|
||||||
prevToggleButtonIcon = ((ImageView) (toggleButton.getGraphic())).getImage();
|
prevToggleButtonIcon = ((ImageView) (toggleButton.getGraphic())).getImage();
|
||||||
((ImageView) (toggleButton.getGraphic())).setImage(Icons.getIconImage(iconIdActivated));
|
((ImageView) (toggleButton.getGraphic())).setImage(Icons.getIconImage(iconIdActivated));
|
||||||
|
|
||||||
if (childController instanceof MarketController && direction != null)
|
childController = navigateToView(navTarget);
|
||||||
{
|
|
||||||
((MarketController) childController).setDirection(direction);
|
if (childController instanceof MarketController)
|
||||||
}
|
((MarketController) childController).setDirection(navigationItem == NavigationItem.BUY ? Direction.BUY : Direction.SELL);
|
||||||
else
|
|
||||||
{
|
storage.write(selectedNavigationItemStorageId, navigationItem);
|
||||||
childController = navigateToView(navTarget, direction == Direction.BUY ? "Orderbook Buy" : "Orderbook Sell");
|
|
||||||
if (childController instanceof MarketController && direction != null)
|
|
||||||
{
|
|
||||||
((MarketController) childController).setDirection(direction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
prevToggleButton = toggleButton;
|
prevToggleButton = toggleButton;
|
||||||
|
|
||||||
|
@ -338,45 +314,13 @@ public class MainController implements Initializable, NavigationController
|
||||||
parent.getChildren().add(vBox);
|
parent.getChildren().add(vBox);
|
||||||
|
|
||||||
balanceTextField.setText(BtcFormatter.satoshiToString(walletFacade.getWalletBalance()));
|
balanceTextField.setText(BtcFormatter.satoshiToString(walletFacade.getWalletBalance()));
|
||||||
walletFacade.getWallet().addEventListener(new WalletEventListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onCoinsReceived(Wallet wallet, Transaction tx, BigInteger prevBalance, BigInteger newBalance)
|
|
||||||
{
|
|
||||||
balanceTextField.setText(BtcFormatter.satoshiToString(newBalance));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
walletFacade.addBalanceListener(new BalanceListener()
|
||||||
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx)
|
|
||||||
{
|
{
|
||||||
balanceTextField.setText(BtcFormatter.satoshiToString(walletFacade.getWallet().getBalance()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCoinsSent(Wallet wallet, Transaction tx, BigInteger prevBalance, BigInteger newBalance)
|
public void onBalanceChanged(BigInteger balance)
|
||||||
{
|
|
||||||
balanceTextField.setText(BtcFormatter.satoshiToString(newBalance));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReorganize(Wallet wallet)
|
|
||||||
{
|
|
||||||
balanceTextField.setText(BtcFormatter.satoshiToString(walletFacade.getWallet().getBalance()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWalletChanged(Wallet wallet)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeysAdded(Wallet wallet, List<ECKey> keys)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScriptsAdded(Wallet wallet, List<Script> scripts)
|
|
||||||
{
|
{
|
||||||
|
balanceTextField.setText(BtcFormatter.satoshiToString(balance));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<StackPane fx:id="rootContainer" stylesheets="/io/bitsquare/gui/global.css" xmlns:fx="http://javafx.com/fxml/1"
|
<AnchorPane fx:id="anchorPane" id="root-pane" fx:controller="io.bitsquare.gui.MainController" stylesheets="/io/bitsquare/gui/bitsquare.css" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.MainController">
|
xmlns="http://javafx.com/javafx/8">
|
||||||
<AnchorPane fx:id="anchorPane" id="root-pane">
|
|
||||||
<HBox fx:id="leftNavPane" spacing="10" AnchorPane.leftAnchor="0" AnchorPane.topAnchor="0"/>
|
<HBox fx:id="leftNavPane" spacing="10" AnchorPane.leftAnchor="0" AnchorPane.topAnchor="0"/>
|
||||||
<HBox fx:id="rightNavPane" spacing="10" AnchorPane.rightAnchor="10" AnchorPane.topAnchor="0"/>
|
<HBox fx:id="rightNavPane" spacing="10" AnchorPane.rightAnchor="10" AnchorPane.topAnchor="0"/>
|
||||||
<AnchorPane fx:id="contentPane" id="content-pane" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="0"
|
<AnchorPane fx:id="contentPane" id="content-pane" AnchorPane.bottomAnchor="20" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="60"/>
|
||||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="60"/>
|
</AnchorPane>
|
||||||
</AnchorPane>
|
|
||||||
</StackPane>
|
|
|
@ -2,34 +2,7 @@ package io.bitsquare.gui;
|
||||||
|
|
||||||
public interface NavigationController
|
public interface NavigationController
|
||||||
{
|
{
|
||||||
public static final String SETUP = "/io/bitsquare/gui/setup/SetupView.fxml";
|
ChildController navigateToView(NavigationItem navigationItem);
|
||||||
|
|
||||||
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 HISTORY = "/io/bitsquare/gui/history/HistoryView.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";
|
|
||||||
|
|
||||||
ChildController navigateToView(String fxmlView);
|
ChildController navigateToView(String fxmlView);
|
||||||
|
|
||||||
ChildController navigateToView(String fxmlView, String title);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
6
src/main/java/io/bitsquare/gui/NavigationItem.java
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package io.bitsquare.gui;
|
||||||
|
|
||||||
|
public enum NavigationItem
|
||||||
|
{
|
||||||
|
HOME, BUY, SELL, ORDERS, FUNDS, MSG, SETTINGS
|
||||||
|
}
|
25
src/main/java/io/bitsquare/gui/NavigationViewURL.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package io.bitsquare.gui;
|
||||||
|
|
||||||
|
public class NavigationViewURL
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,8 @@ import com.google.inject.Inject;
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationItem;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController;
|
import io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController;
|
||||||
import io.bitsquare.locale.LanguageUtil;
|
import io.bitsquare.locale.LanguageUtil;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
|
@ -72,7 +74,7 @@ public class ArbitratorOverviewController implements Initializable, ChildControl
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb)
|
public void initialize(URL url, ResourceBundle rb)
|
||||||
{
|
{
|
||||||
navigateToView(NavigationController.ARBITRATOR_PROFILE, "");
|
navigateToView(NavigationViewURL.ARBITRATOR_PROFILE);
|
||||||
checkButtonState();
|
checkButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,13 +101,13 @@ public class ArbitratorOverviewController implements Initializable, ChildControl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
return navigateToView(fxmlView, "");
|
return navigateToView(navigationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (arbitratorProfileController != null)
|
if (arbitratorProfileController != null)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package io.bitsquare.gui.funds;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationItem;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.components.LazyLoadingTabPane;
|
import io.bitsquare.gui.components.LazyLoadingTabPane;
|
||||||
import io.bitsquare.storage.Storage;
|
import io.bitsquare.storage.Storage;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -40,7 +42,7 @@ public class FundsController implements Initializable, ChildController, Navigati
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb)
|
public void initialize(URL url, ResourceBundle rb)
|
||||||
{
|
{
|
||||||
tabPane.initialize(this, storage, NavigationController.DEPOSIT, NavigationController.WITHDRAWAL);
|
tabPane.initialize(this, storage, NavigationViewURL.DEPOSIT, NavigationViewURL.WITHDRAWAL, NavigationViewURL.TRANSACTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,13 +66,13 @@ public class FundsController implements Initializable, ChildController, Navigati
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
return navigateToView(fxmlView, "");
|
return navigateToView(navigationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
return tabPane.navigateToView(fxmlView);
|
return tabPane.navigateToView(fxmlView);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
<Tab text="Deposit" closable="false"/>
|
<Tab text="Deposit" closable="false"/>
|
||||||
<Tab text="Withdrawal" closable="false"/>
|
<Tab text="Withdrawal" closable="false"/>
|
||||||
|
<Tab text="Transactions" closable="false"/>
|
||||||
|
|
||||||
</LazyLoadingTabPane>
|
</LazyLoadingTabPane>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
package io.bitsquare.gui.funds.transactions;
|
||||||
|
|
||||||
|
import com.google.bitcoin.core.Transaction;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import io.bitsquare.btc.WalletFacade;
|
||||||
|
import io.bitsquare.gui.ChildController;
|
||||||
|
import io.bitsquare.gui.Hibernate;
|
||||||
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.util.Callback;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
public class TransactionsController implements Initializable, ChildController, Hibernate
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(TransactionsController.class);
|
||||||
|
|
||||||
|
private WalletFacade walletFacade;
|
||||||
|
protected ObservableList<TransactionsListItem> transactionsListItems;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TableView<TransactionsListItem> tableView;
|
||||||
|
@FXML
|
||||||
|
private TableColumn<String, TransactionsListItem> dateColumn, addressColumn, amountColumn, typeColumn, confidenceColumn;
|
||||||
|
@FXML
|
||||||
|
private Button addNewAddressButton;
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Constructor
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public TransactionsController(WalletFacade walletFacade)
|
||||||
|
{
|
||||||
|
this.walletFacade = walletFacade;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Interface implementation: Initializable
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL url, ResourceBundle rb)
|
||||||
|
{
|
||||||
|
awake();
|
||||||
|
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||||
|
|
||||||
|
setAddressColumnCellFactory();
|
||||||
|
setConfidenceColumnCellFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Interface implementation: ChildController
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNavigationController(NavigationController navigationController)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cleanup()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < transactionsListItems.size(); i++)
|
||||||
|
{
|
||||||
|
transactionsListItems.get(i).cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Interface implementation: Hibernate
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sleep()
|
||||||
|
{
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void awake()
|
||||||
|
{
|
||||||
|
List<Transaction> transactions = walletFacade.getWallet().getRecentTransactions(10000, true);
|
||||||
|
transactionsListItems = FXCollections.observableArrayList();
|
||||||
|
for (int i = 0; i < transactions.size(); i++)
|
||||||
|
{
|
||||||
|
transactionsListItems.add(new TransactionsListItem(transactions.get(i), walletFacade));
|
||||||
|
}
|
||||||
|
|
||||||
|
tableView.setItems(transactionsListItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// UI handlers
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Private methods
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Cell factories
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
private void setAddressColumnCellFactory()
|
||||||
|
{
|
||||||
|
addressColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||||
|
addressColumn.setCellFactory(new Callback<TableColumn<String, TransactionsListItem>, TableCell<String, TransactionsListItem>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public TableCell<String, TransactionsListItem> call(TableColumn<String, TransactionsListItem> column)
|
||||||
|
{
|
||||||
|
return new TableCell<String, TransactionsListItem>()
|
||||||
|
{
|
||||||
|
Hyperlink hyperlink;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateItem(final TransactionsListItem item, boolean empty)
|
||||||
|
{
|
||||||
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
|
if (item != null && !empty)
|
||||||
|
{
|
||||||
|
hyperlink = new Hyperlink(item.getAddressString());
|
||||||
|
hyperlink.setId("id-link");
|
||||||
|
hyperlink.setOnAction(new EventHandler<ActionEvent>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent event)
|
||||||
|
{
|
||||||
|
log.info("Show trade details " + item.getAddressString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setGraphic(hyperlink);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setGraphic(null);
|
||||||
|
setId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setConfidenceColumnCellFactory()
|
||||||
|
{
|
||||||
|
confidenceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue()));
|
||||||
|
confidenceColumn.setCellFactory(new Callback<TableColumn<String, TransactionsListItem>, TableCell<String, TransactionsListItem>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public TableCell<String, TransactionsListItem> call(TableColumn<String, TransactionsListItem> column)
|
||||||
|
{
|
||||||
|
return new TableCell<String, TransactionsListItem>()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateItem(final TransactionsListItem item, boolean empty)
|
||||||
|
{
|
||||||
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
|
if (item != null && !empty)
|
||||||
|
{
|
||||||
|
setGraphic(item.getProgressIndicator());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setGraphic(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
package io.bitsquare.gui.funds.transactions;
|
||||||
|
|
||||||
|
import com.google.bitcoin.core.Address;
|
||||||
|
import com.google.bitcoin.core.Transaction;
|
||||||
|
import com.google.bitcoin.core.TransactionConfidence;
|
||||||
|
import com.google.bitcoin.core.TransactionOutput;
|
||||||
|
import io.bitsquare.btc.BtcFormatter;
|
||||||
|
import io.bitsquare.btc.WalletFacade;
|
||||||
|
import io.bitsquare.btc.listeners.ConfidenceListener;
|
||||||
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
|
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.beans.property.StringProperty;
|
||||||
|
import javafx.scene.control.Tooltip;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
public class TransactionsListItem
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(TransactionsListItem.class);
|
||||||
|
private final StringProperty date = new SimpleStringProperty();
|
||||||
|
private final StringProperty amount = new SimpleStringProperty();
|
||||||
|
private final StringProperty type = new SimpleStringProperty();
|
||||||
|
private String addressString;
|
||||||
|
|
||||||
|
private Transaction transaction;
|
||||||
|
private WalletFacade walletFacade;
|
||||||
|
private ConfidenceListener confidenceListener;
|
||||||
|
private ConfidenceProgressIndicator progressIndicator;
|
||||||
|
private Tooltip tooltip;
|
||||||
|
|
||||||
|
public TransactionsListItem(Transaction transaction, WalletFacade walletFacade)
|
||||||
|
{
|
||||||
|
this.transaction = transaction;
|
||||||
|
this.walletFacade = walletFacade;
|
||||||
|
|
||||||
|
BigInteger valueSentToMe = transaction.getValueSentToMe(walletFacade.getWallet());
|
||||||
|
BigInteger valueSentFromMe = transaction.getValueSentFromMe(walletFacade.getWallet());
|
||||||
|
Address address = null;
|
||||||
|
if (valueSentToMe.compareTo(BigInteger.ZERO) == 0)
|
||||||
|
{
|
||||||
|
amount.set("-" + BtcFormatter.satoshiToString(valueSentFromMe));
|
||||||
|
|
||||||
|
for (TransactionOutput transactionOutput : transaction.getOutputs())
|
||||||
|
{
|
||||||
|
if (!transactionOutput.isMine(walletFacade.getWallet()))
|
||||||
|
{
|
||||||
|
type.set("Sent to");
|
||||||
|
|
||||||
|
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH())
|
||||||
|
{
|
||||||
|
address = transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
|
||||||
|
addressString = address.toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addressString = "No sent to address script used.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (valueSentFromMe.compareTo(BigInteger.ZERO) == 0)
|
||||||
|
{
|
||||||
|
amount.set(BtcFormatter.satoshiToString(valueSentToMe));
|
||||||
|
type.set("Received with");
|
||||||
|
|
||||||
|
for (TransactionOutput transactionOutput : transaction.getOutputs())
|
||||||
|
{
|
||||||
|
if (transactionOutput.isMine(walletFacade.getWallet()))
|
||||||
|
{
|
||||||
|
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH())
|
||||||
|
{
|
||||||
|
address = transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
|
||||||
|
addressString = address.toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addressString = "No sent to address script used.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount.set(BtcFormatter.satoshiToString(valueSentToMe.subtract(valueSentFromMe)));
|
||||||
|
|
||||||
|
boolean outgoing = false;
|
||||||
|
for (TransactionOutput transactionOutput : transaction.getOutputs())
|
||||||
|
{
|
||||||
|
if (!transactionOutput.isMine(walletFacade.getWallet()))
|
||||||
|
{
|
||||||
|
outgoing = true;
|
||||||
|
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH())
|
||||||
|
{
|
||||||
|
address = transactionOutput.getScriptPubKey().getToAddress(walletFacade.getWallet().getParams());
|
||||||
|
addressString = address.toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addressString = "No sent to address script used.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outgoing)
|
||||||
|
{
|
||||||
|
type.set("Sent to");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type.set("Internal (TX Fee)");
|
||||||
|
addressString = "Internal swap between addresses.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
date.set(BitSquareFormatter.formatDateTime(transaction.getUpdateTime()));
|
||||||
|
|
||||||
|
// confidence
|
||||||
|
progressIndicator = new ConfidenceProgressIndicator();
|
||||||
|
progressIndicator.setId("funds-confidence");
|
||||||
|
tooltip = new Tooltip("Not used yet");
|
||||||
|
progressIndicator.setProgress(0);
|
||||||
|
progressIndicator.setPrefHeight(30);
|
||||||
|
progressIndicator.setPrefWidth(30);
|
||||||
|
Tooltip.install(progressIndicator, tooltip);
|
||||||
|
|
||||||
|
|
||||||
|
if (address != null)
|
||||||
|
{
|
||||||
|
confidenceListener = walletFacade.addConfidenceListener(new ConfidenceListener(address)
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onTransactionConfidenceChanged(TransactionConfidence confidence)
|
||||||
|
{
|
||||||
|
updateConfidence(confidence);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updateConfidence(walletFacade.getConfidenceForAddress(address));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void cleanup()
|
||||||
|
{
|
||||||
|
walletFacade.removeConfidenceListener(confidenceListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateConfidence(TransactionConfidence confidence)
|
||||||
|
{
|
||||||
|
if (confidence != null)
|
||||||
|
{
|
||||||
|
//log.debug("Type numBroadcastPeers getDepthInBlocks " + confidence.getConfidenceType() + " / " + confidence.numBroadcastPeers() + " / " + confidence.getDepthInBlocks());
|
||||||
|
switch (confidence.getConfidenceType())
|
||||||
|
{
|
||||||
|
case UNKNOWN:
|
||||||
|
tooltip.setText("Unknown transaction status");
|
||||||
|
progressIndicator.setProgress(0);
|
||||||
|
break;
|
||||||
|
case PENDING:
|
||||||
|
tooltip.setText("Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 confirmations");
|
||||||
|
progressIndicator.setProgress(-1.0);
|
||||||
|
break;
|
||||||
|
case BUILDING:
|
||||||
|
tooltip.setText("Confirmed in " + confidence.getDepthInBlocks() + " block(s)");
|
||||||
|
progressIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
|
||||||
|
break;
|
||||||
|
case DEAD:
|
||||||
|
tooltip.setText("Transaction is invalid.");
|
||||||
|
progressIndicator.setProgress(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
progressIndicator.setPrefSize(24, 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ConfidenceProgressIndicator getProgressIndicator()
|
||||||
|
{
|
||||||
|
return progressIndicator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final StringProperty dateProperty()
|
||||||
|
{
|
||||||
|
return this.date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final StringProperty amountProperty()
|
||||||
|
{
|
||||||
|
return this.amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final StringProperty typeProperty()
|
||||||
|
{
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddressString()
|
||||||
|
{
|
||||||
|
return addressString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<VBox spacing="10" fx:controller="io.bitsquare.gui.funds.transactions.TransactionsController" xmlns="http://javafx.com/javafx/8"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||||
|
</padding>
|
||||||
|
<TableView fx:id="tableView" VBox.vgrow="ALWAYS">
|
||||||
|
<columns>
|
||||||
|
<TableColumn text="Date" fx:id="dateColumn" minWidth="100" sortable="false">
|
||||||
|
<cellValueFactory>
|
||||||
|
<PropertyValueFactory property="date"/>
|
||||||
|
</cellValueFactory>
|
||||||
|
</TableColumn>
|
||||||
|
<TableColumn text="Type" fx:id="typeColumn" minWidth="70" sortable="false">
|
||||||
|
<cellValueFactory>
|
||||||
|
<PropertyValueFactory property="type"/>
|
||||||
|
</cellValueFactory>
|
||||||
|
</TableColumn>
|
||||||
|
<TableColumn text="Address" fx:id="addressColumn" minWidth="240" sortable="false"/>
|
||||||
|
<TableColumn text="Amount" fx:id="amountColumn" minWidth="70" sortable="false">
|
||||||
|
<cellValueFactory>
|
||||||
|
<PropertyValueFactory property="amount"/>
|
||||||
|
</cellValueFactory>
|
||||||
|
</TableColumn>
|
||||||
|
|
||||||
|
<TableColumn text="Status" fx:id="confidenceColumn" minWidth="30" sortable="false"/>
|
||||||
|
</columns>
|
||||||
|
</TableView>
|
||||||
|
</VBox>
|
|
@ -62,8 +62,6 @@ public class WithdrawalController implements Initializable, ChildController, Hib
|
||||||
public WithdrawalController(WalletFacade walletFacade)
|
public WithdrawalController(WalletFacade walletFacade)
|
||||||
{
|
{
|
||||||
this.walletFacade = walletFacade;
|
this.walletFacade = walletFacade;
|
||||||
if (walletFacade == null)
|
|
||||||
walletFacade = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import io.bitsquare.BitSquare;
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationItem;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.arbitrators.registration.ArbitratorRegistrationController;
|
import io.bitsquare.gui.arbitrators.registration.ArbitratorRegistrationController;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
|
@ -50,13 +52,13 @@ public class HomeController implements Initializable, ChildController, Navigatio
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
return navigateToView(fxmlView, "");
|
return navigateToView(navigationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (arbitratorRegistrationController != null)
|
if (arbitratorRegistrationController != null)
|
||||||
|
@ -71,7 +73,7 @@ public class HomeController implements Initializable, ChildController, Navigatio
|
||||||
|
|
||||||
final Stage rootStage = BitSquare.getStage();
|
final Stage rootStage = BitSquare.getStage();
|
||||||
final Stage stage = new Stage();
|
final Stage stage = new Stage();
|
||||||
stage.setTitle(title);
|
stage.setTitle("Arbitrator");
|
||||||
stage.setMinWidth(800);
|
stage.setMinWidth(800);
|
||||||
stage.setMinHeight(400);
|
stage.setMinHeight(400);
|
||||||
stage.setWidth(800);
|
stage.setWidth(800);
|
||||||
|
@ -95,13 +97,13 @@ public class HomeController implements Initializable, ChildController, Navigatio
|
||||||
@FXML
|
@FXML
|
||||||
public void onArbitratorRegistration(ActionEvent actionEvent)
|
public void onArbitratorRegistration(ActionEvent actionEvent)
|
||||||
{
|
{
|
||||||
navigateToView(NavigationController.ARBITRATOR_REGISTRATION, "Registration as Arbitrator");
|
navigateToView(NavigationViewURL.ARBITRATOR_REGISTRATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void onArbitratorEdit(ActionEvent actionEvent)
|
public void onArbitratorEdit(ActionEvent actionEvent)
|
||||||
{
|
{
|
||||||
navigateToView(NavigationController.ARBITRATOR_REGISTRATION, "Edit my arbitrator details");
|
navigateToView(NavigationViewURL.ARBITRATOR_REGISTRATION);
|
||||||
arbitratorRegistrationController.setEditMode(true);
|
arbitratorRegistrationController.setEditMode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package io.bitsquare.gui.market;
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationItem;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.market.orderbook.OrderBookController;
|
import io.bitsquare.gui.market.orderbook.OrderBookController;
|
||||||
import io.bitsquare.locale.Localisation;
|
import io.bitsquare.locale.Localisation;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
|
@ -34,7 +36,7 @@ public class MarketController implements Initializable, NavigationController, Ch
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb)
|
public void initialize(URL url, ResourceBundle rb)
|
||||||
{
|
{
|
||||||
navigateToView(NavigationController.ORDER_BOOK, "Orderbook");
|
navigateToView(NavigationViewURL.ORDER_BOOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,15 +45,15 @@ public class MarketController implements Initializable, NavigationController, Ch
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
return navigateToView(fxmlView, "");
|
return navigateToView(navigationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
if (fxmlView.equals(NavigationController.ORDER_BOOK) && orderbookCreated)
|
if (fxmlView.equals(NavigationViewURL.ORDER_BOOK) && orderbookCreated)
|
||||||
{
|
{
|
||||||
tabPane.getSelectionModel().select(0);
|
tabPane.getSelectionModel().select(0);
|
||||||
return null;
|
return null;
|
||||||
|
@ -67,11 +69,11 @@ public class MarketController implements Initializable, NavigationController, Ch
|
||||||
if (childController instanceof OrderBookController)
|
if (childController instanceof OrderBookController)
|
||||||
orderBookController = (OrderBookController) childController;
|
orderBookController = (OrderBookController) childController;
|
||||||
|
|
||||||
Tab tab = new Tab(title);
|
Tab tab = new Tab("Orderbook");
|
||||||
tab.setContent(view);
|
tab.setContent(view);
|
||||||
tabPane.getTabs().add(tab);
|
tabPane.getTabs().add(tab);
|
||||||
|
|
||||||
if (fxmlView.equals(NavigationController.ORDER_BOOK))
|
if (fxmlView.equals(NavigationViewURL.ORDER_BOOK))
|
||||||
{
|
{
|
||||||
tab.setClosable(false);
|
tab.setClosable(false);
|
||||||
orderbookCreated = true;
|
orderbookCreated = true;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import io.bitsquare.btc.WalletFacade;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.Hibernate;
|
import io.bitsquare.gui.Hibernate;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
import io.bitsquare.gui.util.BitSquareConverter;
|
import io.bitsquare.gui.util.BitSquareConverter;
|
||||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||||
|
@ -255,7 +256,7 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||||
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
||||||
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
||||||
|
|
||||||
navigationController.navigateToView(NavigationController.ORDER_BOOK, "Orderbook");
|
navigationController.navigateToView(NavigationViewURL.ORDER_BOOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,7 @@ import io.bitsquare.bank.BankAccountTypeInfo;
|
||||||
import io.bitsquare.btc.BtcFormatter;
|
import io.bitsquare.btc.BtcFormatter;
|
||||||
import io.bitsquare.btc.FeePolicy;
|
import io.bitsquare.btc.FeePolicy;
|
||||||
import io.bitsquare.btc.WalletFacade;
|
import io.bitsquare.btc.WalletFacade;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.*;
|
||||||
import io.bitsquare.gui.MainController;
|
|
||||||
import io.bitsquare.gui.NavigationController;
|
|
||||||
import io.bitsquare.gui.market.createOffer.CreateOfferController;
|
import io.bitsquare.gui.market.createOffer.CreateOfferController;
|
||||||
import io.bitsquare.gui.market.trade.TakerTradeController;
|
import io.bitsquare.gui.market.trade.TakerTradeController;
|
||||||
import io.bitsquare.gui.util.BitSquareConverter;
|
import io.bitsquare.gui.util.BitSquareConverter;
|
||||||
|
@ -250,7 +248,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||||
Action response = Popups.openErrorPopup("Registration fee not confirmed yet", "The registration fee transaction has not been confirmed yet in the blockchain. Please wait until it has at least 1 confirmation.");
|
Action response = Popups.openErrorPopup("Registration fee not confirmed yet", "The registration fee transaction has not been confirmed yet in the blockchain. Please wait until it has at least 1 confirmation.");
|
||||||
if (response == Dialog.Actions.OK)
|
if (response == Dialog.Actions.OK)
|
||||||
{
|
{
|
||||||
MainController.getInstance().navigateToView(NavigationController.FUNDS);
|
MainController.getInstance().navigateToView(NavigationItem.FUNDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +257,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||||
Action response = Popups.openErrorPopup("Missing registration fee", "You have not funded the full registration fee of " + BtcFormatter.satoshiToString(FeePolicy.ACCOUNT_REGISTRATION_FEE) + " BTC.");
|
Action response = Popups.openErrorPopup("Missing registration fee", "You have not funded the full registration fee of " + BtcFormatter.satoshiToString(FeePolicy.ACCOUNT_REGISTRATION_FEE) + " BTC.");
|
||||||
if (response == Dialog.Actions.OK)
|
if (response == Dialog.Actions.OK)
|
||||||
{
|
{
|
||||||
MainController.getInstance().navigateToView(NavigationController.FUNDS);
|
MainController.getInstance().navigateToView(NavigationItem.FUNDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,11 +280,11 @@ public class OrderBookController implements Initializable, ChildController
|
||||||
Action registrationMissingAction = Popups.openRegistrationMissingPopup("Not registered yet", "Please follow these steps:", "You need to register before you can place an offer.", commandLinks, selectedIndex);
|
Action registrationMissingAction = Popups.openRegistrationMissingPopup("Not registered yet", "Please follow these steps:", "You need to register before you can place an offer.", commandLinks, selectedIndex);
|
||||||
if (registrationMissingAction == settingsCommandLink)
|
if (registrationMissingAction == settingsCommandLink)
|
||||||
{
|
{
|
||||||
MainController.getInstance().navigateToView(NavigationController.SETTINGS);
|
MainController.getInstance().navigateToView(NavigationItem.SETTINGS);
|
||||||
}
|
}
|
||||||
else if (registrationMissingAction == depositFeeCommandLink)
|
else if (registrationMissingAction == depositFeeCommandLink)
|
||||||
{
|
{
|
||||||
MainController.getInstance().navigateToView(NavigationController.FUNDS);
|
MainController.getInstance().navigateToView(NavigationItem.FUNDS);
|
||||||
}
|
}
|
||||||
else if (registrationMissingAction == sendRegistrationCommandLink)
|
else if (registrationMissingAction == sendRegistrationCommandLink)
|
||||||
{
|
{
|
||||||
|
@ -332,7 +330,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||||
{
|
{
|
||||||
if (walletFacade.isUnusedTradeAddressBalanceAboveCreationFee())
|
if (walletFacade.isUnusedTradeAddressBalanceAboveCreationFee())
|
||||||
{
|
{
|
||||||
ChildController nextController = navigationController.navigateToView(NavigationController.CREATE_OFFER, "Create offer");
|
ChildController nextController = navigationController.navigateToView(NavigationViewURL.CREATE_OFFER);
|
||||||
((CreateOfferController) nextController).setOrderBookFilter(orderBookFilter);
|
((CreateOfferController) nextController).setOrderBookFilter(orderBookFilter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -340,7 +338,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||||
Action response = Popups.openErrorPopup("No funds for a trade", "You have to add some funds before you create a new offer.");
|
Action response = Popups.openErrorPopup("No funds for a trade", "You have to add some funds before you create a new offer.");
|
||||||
if (response == Dialog.Actions.OK)
|
if (response == Dialog.Actions.OK)
|
||||||
{
|
{
|
||||||
MainController.getInstance().navigateToView(NavigationController.FUNDS);
|
MainController.getInstance().navigateToView(NavigationItem.FUNDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +353,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||||
if (isRegistered())
|
if (isRegistered())
|
||||||
{
|
{
|
||||||
String title = offer.getDirection() == Direction.BUY ? "Trade: Sell Bitcoin" : "Trade: Buy Bitcoin";
|
String title = offer.getDirection() == Direction.BUY ? "Trade: Sell Bitcoin" : "Trade: Buy Bitcoin";
|
||||||
TakerTradeController takerTradeController = (TakerTradeController) navigationController.navigateToView(NavigationController.TAKER_TRADE, title);
|
TakerTradeController takerTradeController = (TakerTradeController) navigationController.navigateToView(NavigationViewURL.TAKER_TRADE);
|
||||||
|
|
||||||
BigInteger requestedAmount = offer.getAmount();
|
BigInteger requestedAmount = offer.getAmount();
|
||||||
if (!amount.getText().equals(""))
|
if (!amount.getText().equals(""))
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.google.inject.Inject;
|
||||||
import io.bitsquare.btc.*;
|
import io.bitsquare.btc.*;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
import io.bitsquare.gui.components.processbar.ProcessStepBar;
|
import io.bitsquare.gui.components.processbar.ProcessStepBar;
|
||||||
import io.bitsquare.gui.components.processbar.ProcessStepItem;
|
import io.bitsquare.gui.components.processbar.ProcessStepItem;
|
||||||
|
@ -398,7 +399,7 @@ public class TakerTradeController implements Initializable, ChildController
|
||||||
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
||||||
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
||||||
|
|
||||||
navigationController.navigateToView(NavigationController.ORDER_BOOK, "Orderbook");
|
navigationController.navigateToView(NavigationViewURL.ORDER_BOOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other Private methods
|
// Other Private methods
|
||||||
|
|
|
@ -3,6 +3,8 @@ package io.bitsquare.gui.orders;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationItem;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.components.LazyLoadingTabPane;
|
import io.bitsquare.gui.components.LazyLoadingTabPane;
|
||||||
import io.bitsquare.storage.Storage;
|
import io.bitsquare.storage.Storage;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -40,7 +42,7 @@ public class OrdersController implements Initializable, ChildController, Navigat
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb)
|
public void initialize(URL url, ResourceBundle rb)
|
||||||
{
|
{
|
||||||
tabPane.initialize(this, storage, NavigationController.OFFER, NavigationController.PENDING_TRADE, NavigationController.CLOSED_TRADE);
|
tabPane.initialize(this, storage, NavigationViewURL.OFFER, NavigationViewURL.PENDING_TRADE, NavigationViewURL.CLOSED_TRADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,13 +66,13 @@ public class OrdersController implements Initializable, ChildController, Navigat
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
return navigateToView(fxmlView, "");
|
return navigateToView(navigationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
return tabPane.navigateToView(fxmlView);
|
return tabPane.navigateToView(fxmlView);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,156 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator?>
|
|
||||||
<?import javafx.geometry.*?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<VBox fx:id="rootContainer" fx:controller="io.bitsquare.gui.orders.OrdersController2" spacing="10" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0"
|
|
||||||
AnchorPane.topAnchor="0" xmlns="http://javafx.com/javafx/8"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1">
|
|
||||||
<children>
|
|
||||||
<Label id="headline-label" text="Open trades">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="10.0" top="10.0"/>
|
|
||||||
</VBox.margin>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<TableView id="orderbook-table" fx:id="openTradesTable" prefHeight="150.0">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="amountColumn" minWidth="120" text="Amount (Min.)">
|
|
||||||
<cellValueFactory>
|
|
||||||
<PropertyValueFactory property="amount"/>
|
|
||||||
</cellValueFactory>
|
|
||||||
</TableColumn>
|
|
||||||
<TableColumn fx:id="priceColumn" minWidth="70" text="Price">
|
|
||||||
<cellValueFactory>
|
|
||||||
<PropertyValueFactory property="price"/>
|
|
||||||
</cellValueFactory>
|
|
||||||
</TableColumn>
|
|
||||||
<TableColumn fx:id="volumeColumn" minWidth="130" text="Volume (Min.)">
|
|
||||||
<cellValueFactory>
|
|
||||||
<PropertyValueFactory property="volume"/>
|
|
||||||
</cellValueFactory>
|
|
||||||
</TableColumn>
|
|
||||||
<TableColumn fx:id="countryColumn" minWidth="60" text="Country"/>
|
|
||||||
<TableColumn fx:id="bankAccountTypeColumn" minWidth="140" text="Bank transfer type"/>
|
|
||||||
<TableColumn fx:id="directionColumn" minWidth="80" sortable="false" text="Offer type"/>
|
|
||||||
<TableColumn fx:id="statusColumn" minWidth="80" text="Status">
|
|
||||||
<cellValueFactory>
|
|
||||||
<PropertyValueFactory property="status"/>
|
|
||||||
</cellValueFactory>
|
|
||||||
</TableColumn>
|
|
||||||
|
|
||||||
<TableColumn fx:id="selectColumn" minWidth="60" sortable="false" text=""/>
|
|
||||||
</columns>
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="10.0" right="10.0"/>
|
|
||||||
</VBox.margin>
|
|
||||||
</TableView>
|
|
||||||
|
|
||||||
|
|
||||||
<Label text="After you received 1 blockchain confirmation you are safe to start the bank transfer.">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets bottom="10.0" left="10.0" top="10.0"/>
|
|
||||||
</VBox.margin>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<GridPane hgap="5.0" vgap="5.0">
|
|
||||||
<children>
|
|
||||||
|
|
||||||
<!-- row 0 -->
|
|
||||||
<Label fx:id="txHeaderLabel" id="headline-label" text="Deposit transaction" GridPane.columnSpan="2" GridPane.halignment="LEFT"/>
|
|
||||||
|
|
||||||
<!-- row 1 -->
|
|
||||||
<Label fx:id="txTitleLabel" text="Deposit transaction ID:" GridPane.rowIndex="1"/>
|
|
||||||
<TextField fx:id="txTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
|
||||||
<Label fx:id="txIDCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="1">
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
|
||||||
</padding>
|
|
||||||
<tooltip>
|
|
||||||
<Tooltip text="Copy address to clipboard"/>
|
|
||||||
</tooltip>
|
|
||||||
</Label>
|
|
||||||
<ConfidenceProgressIndicator fx:id="progressIndicator" visible="false" progress="0" GridPane.columnIndex="3" GridPane.halignment="LEFT" GridPane.rowIndex="1"
|
|
||||||
GridPane.rowSpan="2" GridPane.valignment="TOP">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets top="2.0"/>
|
|
||||||
</GridPane.margin>
|
|
||||||
</ConfidenceProgressIndicator>
|
|
||||||
<Label fx:id="confirmationLabel" visible="false" GridPane.columnIndex="4" GridPane.rowIndex="1"/>
|
|
||||||
|
|
||||||
<!-- row 2 -->
|
|
||||||
<Label fx:id="bankAccountDetailsHeaderLabel" id="headline-label" text="Bank details" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="LEFT"
|
|
||||||
GridPane.rowIndex="2"/>
|
|
||||||
|
|
||||||
<!-- row 3 -->
|
|
||||||
<Label fx:id="bankAccountTypeTitleLabel" text="Bank account type:" GridPane.columnIndex="0" GridPane.rowIndex="3"/>
|
|
||||||
<TextField fx:id="bankAccountTypeTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
|
||||||
|
|
||||||
<!-- row 4 -->
|
|
||||||
<Label fx:id="holderNameTitleLabel" text="Holder name:" GridPane.columnIndex="0" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="holderNameTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
|
||||||
<Label fx:id="holderNameCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="4">
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
|
||||||
</padding>
|
|
||||||
<tooltip>
|
|
||||||
<Tooltip text="Copy address to clipboard"/>
|
|
||||||
</tooltip>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<!-- row 5 -->
|
|
||||||
<Label fx:id="primaryBankAccountIDTitleLabel" text="Primary bank account ID:" GridPane.columnIndex="0" GridPane.rowIndex="5"/>
|
|
||||||
<TextField fx:id="primaryBankAccountIDTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
|
||||||
<Label fx:id="primaryBankAccountIDCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="5">
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
|
||||||
</padding>
|
|
||||||
<tooltip>
|
|
||||||
<Tooltip text="Copy address to clipboard"/>
|
|
||||||
</tooltip>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<!-- row 6 -->
|
|
||||||
<Label fx:id="secondaryBankAccountIDTitleLabel" text="Secondary bank account ID:" GridPane.columnIndex="0" GridPane.rowIndex="6"/>
|
|
||||||
<TextField fx:id="secondaryBankAccountIDTextField" editable="false" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
|
||||||
<Label fx:id="secondaryBankAccountIDCopyIcon" id="copy-icon" minWidth="10" GridPane.columnIndex="2" GridPane.rowIndex="6">
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="0.0" left="0.0" right="0.0" top="-1.0"/>
|
|
||||||
</padding>
|
|
||||||
<tooltip>
|
|
||||||
<Tooltip text="Copy address to clipboard"/>
|
|
||||||
</tooltip>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<!-- row 7 -->
|
|
||||||
<Button fx:id="bankTransferInitedButton" defaultButton="true" onAction="#bankTransferInited" disable="true" text="Bank transfer inited"
|
|
||||||
GridPane.columnIndex="1"
|
|
||||||
GridPane.rowIndex="7"/>
|
|
||||||
|
|
||||||
</children>
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES"/>
|
|
||||||
<ColumnConstraints hgrow="ALWAYS"/>
|
|
||||||
<ColumnConstraints fillWidth="false" hgrow="SOMETIMES" minWidth="20"/>
|
|
||||||
<ColumnConstraints fillWidth="false" hgrow="SOMETIMES" minWidth="20" prefWidth="20"/>
|
|
||||||
<ColumnConstraints fillWidth="false" hgrow="SOMETIMES"/>
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints/>
|
|
||||||
</rowConstraints>
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="10.0" right="10.0"/>
|
|
||||||
</VBox.margin>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
|
@ -6,9 +6,6 @@ import io.bitsquare.trade.Offer;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class OfferListItem
|
public class OfferListItem
|
||||||
{
|
{
|
||||||
protected final StringProperty price = new SimpleStringProperty();
|
protected final StringProperty price = new SimpleStringProperty();
|
||||||
|
@ -22,10 +19,7 @@ public class OfferListItem
|
||||||
{
|
{
|
||||||
this.offer = offer;
|
this.offer = offer;
|
||||||
|
|
||||||
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.getDefault());
|
this.date.set(BitSquareFormatter.formatDateTime(offer.getCreationDate()));
|
||||||
DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.getDefault());
|
|
||||||
this.date.set(dateFormatter.format(offer.getCreationDate()) + " " + timeFormatter.format(offer.getCreationDate()));
|
|
||||||
|
|
||||||
this.price.set(BitSquareFormatter.formatPrice(offer.getPrice()));
|
this.price.set(BitSquareFormatter.formatPrice(offer.getPrice()));
|
||||||
|
|
||||||
double amountAsBtcDouble = BtcFormatter.satoshiToBTC(offer.getAmount());
|
double amountAsBtcDouble = BtcFormatter.satoshiToBTC(offer.getAmount());
|
||||||
|
|
|
@ -10,6 +10,8 @@ import io.bitsquare.btc.WalletFacade;
|
||||||
import io.bitsquare.di.GuiceFXMLLoader;
|
import io.bitsquare.di.GuiceFXMLLoader;
|
||||||
import io.bitsquare.gui.ChildController;
|
import io.bitsquare.gui.ChildController;
|
||||||
import io.bitsquare.gui.NavigationController;
|
import io.bitsquare.gui.NavigationController;
|
||||||
|
import io.bitsquare.gui.NavigationItem;
|
||||||
|
import io.bitsquare.gui.NavigationViewURL;
|
||||||
import io.bitsquare.gui.util.BitSquareValidator;
|
import io.bitsquare.gui.util.BitSquareValidator;
|
||||||
import io.bitsquare.gui.util.Icons;
|
import io.bitsquare.gui.util.Icons;
|
||||||
import io.bitsquare.locale.*;
|
import io.bitsquare.locale.*;
|
||||||
|
@ -207,13 +209,13 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView)
|
public ChildController navigateToView(NavigationItem navigationItem)
|
||||||
{
|
{
|
||||||
return navigateToView(fxmlView, "");
|
return navigateToView(navigationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChildController navigateToView(String fxmlView, String title)
|
public ChildController navigateToView(String fxmlView)
|
||||||
{
|
{
|
||||||
if (childController != null)
|
if (childController != null)
|
||||||
childController.cleanup();
|
childController.cleanup();
|
||||||
|
@ -227,7 +229,7 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||||
|
|
||||||
final Stage rootStage = BitSquare.getStage();
|
final Stage rootStage = BitSquare.getStage();
|
||||||
final Stage stage = new Stage();
|
final Stage stage = new Stage();
|
||||||
stage.setTitle(title);
|
stage.setTitle("Arbitrator selection");
|
||||||
stage.setMinWidth(800);
|
stage.setMinWidth(800);
|
||||||
stage.setMinHeight(500);
|
stage.setMinHeight(500);
|
||||||
stage.setWidth(800);
|
stage.setWidth(800);
|
||||||
|
@ -243,7 +245,7 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||||
@Override
|
@Override
|
||||||
public void handle(WindowEvent windowEvent)
|
public void handle(WindowEvent windowEvent)
|
||||||
{
|
{
|
||||||
if (fxmlView.equals(NavigationController.ARBITRATOR_OVERVIEW))
|
if (fxmlView.equals(NavigationViewURL.ARBITRATOR_OVERVIEW))
|
||||||
updateArbitrators();
|
updateArbitrators();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -289,7 +291,7 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||||
@FXML
|
@FXML
|
||||||
public void onAddArbitrator(ActionEvent actionEvent)
|
public void onAddArbitrator(ActionEvent actionEvent)
|
||||||
{
|
{
|
||||||
navigateToView(NavigationController.ARBITRATOR_OVERVIEW, "Arbitration selection");
|
navigateToView(NavigationViewURL.ARBITRATOR_OVERVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,10 @@ import io.bitsquare.locale.Localisation;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
import io.bitsquare.user.Arbitrator;
|
import io.bitsquare.user.Arbitrator;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Currency;
|
import java.util.Currency;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -169,4 +171,13 @@ public class BitSquareFormatter
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatDateTime(Date date)
|
||||||
|
{
|
||||||
|
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.getDefault());
|
||||||
|
DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.getDefault());
|
||||||
|
return dateFormatter.format(date) + " " + timeFormatter.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ public class Icons
|
||||||
public static final String NAV_SELL_ACTIVE = "/images/nav/nav_sell_active.png";
|
public static final String NAV_SELL_ACTIVE = "/images/nav/nav_sell_active.png";
|
||||||
public static final String ORDERS = "/images/nav/orders.png";
|
public static final String ORDERS = "/images/nav/orders.png";
|
||||||
public static final String ORDERS_ACTIVE = "/images/nav/orders_active.png";
|
public static final String ORDERS_ACTIVE = "/images/nav/orders_active.png";
|
||||||
public static final String HISTORY = "/images/nav/history.png";
|
public static final String HISTORY = "/images/unused/history.png";
|
||||||
public static final String HISTORY_ACTIVE = "/images/nav/history_active.png";
|
public static final String HISTORY_ACTIVE = "/images/unused/history_active.png";
|
||||||
public static final String FUNDS = "/images/nav/funds.png";
|
public static final String FUNDS = "/images/nav/funds.png";
|
||||||
public static final String FUNDS_ACTIVE = "/images/nav/funds_active.png";
|
public static final String FUNDS_ACTIVE = "/images/nav/funds_active.png";
|
||||||
public static final String MSG = "/images/nav/msg.png";
|
public static final String MSG = "/images/nav/msg.png";
|
||||||
|
|
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 618 B |
Before Width: | Height: | Size: 577 B |
Before Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 538 B |
Before Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 436 B |