mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-03-15 10:26:37 -04:00
add support for caching views
This commit is contained in:
parent
3391f6f4d3
commit
71ce70bf4b
@ -7,7 +7,7 @@ import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.di.BitSquareModule;
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.popups.Popups;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.util.Profiler;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.settings.Settings;
|
||||
@ -94,7 +94,7 @@ public class BitSquare extends Application
|
||||
|
||||
GuiceFXMLLoader.setInjector(injector);
|
||||
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.MAIN.getFxmlUrl()));
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.MAIN.getFxmlUrl()), false);
|
||||
final Parent view = loader.load();
|
||||
final Scene scene = new Scene(view, 1000, 750);
|
||||
scene.getStylesheets().setAll(getClass().getResource("/io/bitsquare/gui/bitsquare.css").toExternalForm());
|
||||
|
@ -40,8 +40,6 @@ public class GuiceFXMLLoader
|
||||
{
|
||||
this.url = url;
|
||||
|
||||
//TODO
|
||||
useCaching = false;
|
||||
isCached = useCaching && cachedGUIItems.containsKey(url);
|
||||
if (!isCached)
|
||||
{
|
||||
|
67
src/main/java/io/bitsquare/gui/CachedViewController.java
Normal file
67
src/main/java/io/bitsquare/gui/CachedViewController.java
Normal file
@ -0,0 +1,67 @@
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* If caching is used for loader we use the CachedViewController for turning the controller into sleep mode if not active and awake it at reactivation.
|
||||
*/
|
||||
public abstract class CachedViewController extends ViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CachedViewController.class);
|
||||
|
||||
/**
|
||||
* Get called form GUI framework when the UI is ready.
|
||||
* In caching controllers the initialize is only used for static UI setup.
|
||||
* The activate() method is called to start resources like.
|
||||
*
|
||||
* @param url
|
||||
* @param rb
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
log.trace("Lifecycle: initialize " + this.getClass().getSimpleName());
|
||||
root.sceneProperty().addListener((ov, oldValue, newValue) -> {
|
||||
// we got removed from the scene
|
||||
// lets terminate
|
||||
log.trace("Lifecycle: sceneProperty changed: " + this.getClass().getSimpleName() + " / oldValue=" + oldValue + " / newValue=" + newValue);
|
||||
if (oldValue == null && newValue != null) activate();
|
||||
else if (oldValue != null && newValue == null) deactivate();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* In caching controllers the terminate calls the deactivate method.
|
||||
*/
|
||||
@Override
|
||||
public void terminate()
|
||||
{
|
||||
log.trace("Lifecycle: terminate " + this.getClass().getSimpleName());
|
||||
super.terminate();
|
||||
|
||||
deactivate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for deactivating resources (removing listeners, stopping timers or animations,...)
|
||||
*/
|
||||
public void deactivate()
|
||||
{
|
||||
log.trace("Lifecycle: deactivate " + this.getClass().getSimpleName());
|
||||
if (childController instanceof CachedViewController) ((CachedViewController) childController).deactivate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to activate resources (adding listeners, starting timers or animations,...)
|
||||
*/
|
||||
public void activate()
|
||||
{
|
||||
log.trace("Lifecycle: activate " + this.getClass().getSimpleName());
|
||||
if (childController instanceof CachedViewController) ((CachedViewController) childController).activate();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package io.bitsquare.gui;
|
||||
|
||||
public interface ChildController
|
||||
{
|
||||
void setNavigationController(NavigationController navigationController);
|
||||
|
||||
void cleanup();
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package io.bitsquare.gui;
|
||||
|
||||
public interface Hibernate
|
||||
{
|
||||
void sleep();
|
||||
|
||||
void awake();
|
||||
|
||||
}
|
@ -21,8 +21,6 @@ import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
@ -42,7 +40,7 @@ import org.slf4j.LoggerFactory;
|
||||
* We use a sequence of Platform.runLater cascaded calls to make the startup more smooth, otherwise the rendering is frozen for too long.
|
||||
* Pre-loading of views is not implemented yet, and after a quick test it seemed that it does not give much improvements.
|
||||
*/
|
||||
public class MainController implements Initializable, NavigationController
|
||||
public class MainController extends ViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(MainController.class);
|
||||
private static MainController INSTANCE;
|
||||
@ -55,7 +53,6 @@ public class MainController implements Initializable, NavigationController
|
||||
private final ToggleGroup toggleGroup = new ToggleGroup();
|
||||
private final ViewBuilder viewBuilder;
|
||||
|
||||
private ChildController childController;
|
||||
private ToggleButton prevToggleButton;
|
||||
private Image prevToggleButtonIcon;
|
||||
private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton;
|
||||
@ -63,7 +60,15 @@ public class MainController implements Initializable, NavigationController
|
||||
private boolean messageFacadeInited;
|
||||
private boolean walletFacadeInited;
|
||||
|
||||
@FXML private BorderPane root;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static MainController GET_INSTANCE()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -84,34 +89,33 @@ public class MainController implements Initializable, NavigationController
|
||||
MainController.INSTANCE = this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public static MainController GET_INSTANCE()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
Profiler.printMsgWithTime("MainController.initialize");
|
||||
Platform.runLater(() -> viewBuilder.buildSplashScreen(root, this));
|
||||
Platform.runLater(() -> viewBuilder.buildSplashScreen((BorderPane) root, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate()
|
||||
{
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
switch (navigationItem)
|
||||
{
|
||||
@ -145,7 +149,7 @@ public class MainController implements Initializable, NavigationController
|
||||
// Startup Handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onViewInitialized()
|
||||
void onViewInitialized()
|
||||
{
|
||||
Profiler.printMsgWithTime("MainController.onViewInitialized");
|
||||
Platform.runLater(this::initFacades);
|
||||
@ -282,7 +286,7 @@ public class MainController implements Initializable, NavigationController
|
||||
if (selectedNavigationItem == null)
|
||||
selectedNavigationItem = NavigationItem.BUY;
|
||||
|
||||
navigateToView(selectedNavigationItem);
|
||||
loadViewAndGetChildController(selectedNavigationItem);
|
||||
|
||||
Platform.runLater(this::onContentViewLoaded);
|
||||
}
|
||||
@ -292,31 +296,25 @@ public class MainController implements Initializable, NavigationController
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private ChildController loadView(NavigationItem navigationItem)
|
||||
private void loadViewFromNavButton(NavigationItem navigationItem)
|
||||
{
|
||||
if (childController != null)
|
||||
{
|
||||
childController.cleanup();
|
||||
if (childController instanceof Hibernate)
|
||||
((Hibernate) childController).sleep();
|
||||
}
|
||||
|
||||
|
||||
/* if (childController instanceof CachedViewController)
|
||||
((CachedViewController) childController).deactivate();
|
||||
else if (childController != null)
|
||||
childController.terminate();*/
|
||||
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
||||
try
|
||||
{
|
||||
final Node view = loader.load();
|
||||
viewBuilder.contentPane.getChildren().setAll(view);
|
||||
childController = loader.getController();
|
||||
childController.setNavigationController(this);
|
||||
childController.setParentController(this);
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
log.error("Loading view failed. " + navigationItem.getFxmlUrl());
|
||||
}
|
||||
if (childController instanceof Hibernate)
|
||||
((Hibernate) childController).awake();
|
||||
|
||||
return childController;
|
||||
}
|
||||
|
||||
private ToggleButton addNavButton(Pane parent, String title, NavigationItem navigationItem)
|
||||
@ -335,7 +333,7 @@ public class MainController implements Initializable, NavigationController
|
||||
prevToggleButtonIcon = ((ImageView) (toggleButton.getGraphic())).getImage();
|
||||
((ImageView) (toggleButton.getGraphic())).setImage(ImageUtil.getIconImage(navigationItem.getActiveIcon()));
|
||||
|
||||
childController = loadView(navigationItem);
|
||||
loadViewFromNavButton(navigationItem);
|
||||
|
||||
persistence.write(this, "selectedNavigationItem", navigationItem);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<BorderPane fx:id="root" id="splash" fx:controller="io.bitsquare.gui.MainController" prefHeight="750" prefWidth="1000" stylesheets="/io/bitsquare/gui/bitsquare.css"
|
||||
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<BorderPane fx:id="root" id="splash" fx:controller="io.bitsquare.gui.MainController"
|
||||
prefHeight="750" prefWidth="1000" stylesheets="/io/bitsquare/gui/bitsquare.css" xmlns:fx="http://javafx.com/fxml">
|
||||
</BorderPane>
|
@ -1,7 +0,0 @@
|
||||
package io.bitsquare.gui;
|
||||
|
||||
public interface NavigationController
|
||||
{
|
||||
|
||||
ChildController navigateToView(NavigationItem navigationItem);
|
||||
}
|
@ -6,16 +6,16 @@ public enum NavigationItem
|
||||
{
|
||||
MAIN("/io/bitsquare/gui/MainView.fxml"),
|
||||
HOME("/io/bitsquare/gui/home/HomeView.fxml", ImageUtil.HOME, ImageUtil.HOME_ACTIVE),
|
||||
BUY("/io/bitsquare/gui/market/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
|
||||
SELL("/io/bitsquare/gui/market/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
|
||||
BUY("/io/bitsquare/gui/trade/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
|
||||
SELL("/io/bitsquare/gui/trade/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
|
||||
ORDERS("/io/bitsquare/gui/orders/OrdersView.fxml", ImageUtil.ORDERS, ImageUtil.ORDERS_ACTIVE),
|
||||
FUNDS("/io/bitsquare/gui/funds/FundsView.fxml", ImageUtil.FUNDS, ImageUtil.FUNDS_ACTIVE),
|
||||
MSG("/io/bitsquare/gui/msg/MsgView.fxml", ImageUtil.MSG, ImageUtil.MSG_ACTIVE),
|
||||
SETTINGS("/io/bitsquare/gui/settings/SettingsView.fxml", ImageUtil.SETTINGS, ImageUtil.SETTINGS_ACTIVE),
|
||||
|
||||
ORDER_BOOK("/io/bitsquare/gui/market/orderbook/OrderBookView.fxml"),
|
||||
CREATE_OFFER("/io/bitsquare/gui/market/createOffer/CreateOfferView.fxml"),
|
||||
TAKE_OFFER("/io/bitsquare/gui/market/trade/TakeOfferView.fxml"),
|
||||
ORDER_BOOK("/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"),
|
||||
CREATE_OFFER("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"),
|
||||
TAKE_OFFER("/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml"),
|
||||
//OFFERER_TRADE("/io/bitsquare/gui/orders/OffererTradeView.fxml"),
|
||||
|
||||
OFFER("/io/bitsquare/gui/orders/offer/OfferView.fxml"),
|
||||
|
68
src/main/java/io/bitsquare/gui/ViewController.java
Normal file
68
src/main/java/io/bitsquare/gui/ViewController.java
Normal file
@ -0,0 +1,68 @@
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Base class for all controllers.
|
||||
*/
|
||||
public abstract class ViewController implements Initializable
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ViewController.class);
|
||||
|
||||
protected ViewController childController;
|
||||
protected ViewController parentController;
|
||||
|
||||
@FXML protected Parent root;
|
||||
|
||||
/**
|
||||
* Get called form GUI framework when the UI is ready.
|
||||
*
|
||||
* @param url
|
||||
* @param rb
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
log.trace("Lifecycle: initialize " + this.getClass().getSimpleName());
|
||||
root.sceneProperty().addListener((ov, oldValue, newValue) -> {
|
||||
// we got removed from the scene
|
||||
// lets terminate
|
||||
if (oldValue != null && newValue == null) terminate();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called automatically when view gets removed. Used for house keeping (removing listeners, stopping timers or animations,...).
|
||||
*/
|
||||
public void terminate()
|
||||
{
|
||||
log.trace("Lifecycle: terminate " + this.getClass().getSimpleName());
|
||||
if (childController != null) childController.terminate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parentController Controller who has created this.getClass().getSimpleName() instance (via navigateToView/FXMLLoader).
|
||||
*/
|
||||
public void setParentController(ViewController parentController)
|
||||
{
|
||||
log.trace("Lifecycle: setParentController " + this.getClass().getSimpleName() + " / parent = " + parentController);
|
||||
this.parentController = parentController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param navigationItem NavigationItem to be loaded.
|
||||
* @return The ViewController of the loaded view.
|
||||
*/
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
log.trace("Lifecycle: loadViewAndGetChildController " + this.getClass().getSimpleName() + " / navigationItem = " + navigationItem);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package io.bitsquare.gui.arbitrators.overview;
|
||||
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController;
|
||||
import io.bitsquare.locale.LanguageUtil;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
@ -18,10 +18,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
import javax.inject.Inject;
|
||||
@ -34,7 +32,7 @@ import net.tomp2p.storage.Data;
|
||||
* import net.tomp2p.storage.Data;
|
||||
*/
|
||||
@SuppressWarnings({"ALL", "UnusedParameters"})
|
||||
public class ArbitratorOverviewController implements Initializable, ChildController, NavigationController, ArbitratorListener
|
||||
public class ArbitratorOverviewController extends CachedViewController implements ArbitratorListener
|
||||
{
|
||||
private final Settings settings;
|
||||
private final Persistence persistence;
|
||||
@ -42,16 +40,11 @@ public class ArbitratorOverviewController implements Initializable, ChildControl
|
||||
private final MessageFacade messageFacade;
|
||||
private final List<Arbitrator> allArbitrators = new ArrayList<>();
|
||||
private Arbitrator currentArbitrator;
|
||||
private NavigationController navigationController;
|
||||
private ArbitratorProfileController arbitratorProfileController;
|
||||
private int index = -1;
|
||||
|
||||
@FXML
|
||||
private Button prevButton, nextButton, selectButton, closeButton;
|
||||
@FXML
|
||||
private AnchorPane rootContainer;
|
||||
@FXML
|
||||
private Pane arbitratorProfile;
|
||||
@FXML private Button prevButton, nextButton, selectButton, closeButton;
|
||||
@FXML private Pane arbitratorProfile;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -71,54 +64,57 @@ public class ArbitratorOverviewController implements Initializable, ChildControl
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
navigateToView(NavigationItem.ARBITRATOR_PROFILE);
|
||||
super.initialize(url, rb);
|
||||
|
||||
loadViewAndGetChildController(NavigationItem.ARBITRATOR_PROFILE);
|
||||
checkButtonState();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public void terminate()
|
||||
{
|
||||
this.navigationController = navigationController;
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(ViewController parentController)
|
||||
{
|
||||
super.setParentController(parentController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
if (arbitratorProfileController != null)
|
||||
{
|
||||
arbitratorProfileController.cleanup();
|
||||
}
|
||||
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
||||
try
|
||||
{
|
||||
final Node view = loader.load();
|
||||
arbitratorProfileController = loader.getController();
|
||||
arbitratorProfileController.setNavigationController(this);
|
||||
rootContainer.getChildren().set(0, view);
|
||||
arbitratorProfileController.setParentController(this);
|
||||
((Pane) root).getChildren().set(0, view);
|
||||
|
||||
return arbitratorProfileController;
|
||||
} catch (IOException e)
|
||||
@ -219,7 +215,7 @@ public class ArbitratorOverviewController implements Initializable, ChildControl
|
||||
@FXML
|
||||
public void onClose()
|
||||
{
|
||||
Stage stage = (Stage) rootContainer.getScene().getWindow();
|
||||
Stage stage = (Stage) root.getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="rootContainer" prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"
|
||||
AnchorPane.topAnchor="10.0" xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.arbitrators.overview.ArbitratorOverviewController">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.arbitrators.overview.ArbitratorOverviewController"
|
||||
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<Pane fx:id="arbitratorProfile"/>
|
||||
<Button fx:id="prevButton" text="Previous" onAction="#onPrevious" AnchorPane.bottomAnchor="45.0" AnchorPane.leftAnchor="10.0"/>
|
||||
<Button fx:id="nextButton" text="Next" onAction="#onNext" AnchorPane.bottomAnchor="45.0" AnchorPane.rightAnchor="10.0"/>
|
||||
|
@ -1,7 +1,8 @@
|
||||
package io.bitsquare.gui.arbitrators.profile;
|
||||
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.settings.Settings;
|
||||
import io.bitsquare.storage.Persistence;
|
||||
@ -9,29 +10,24 @@ import io.bitsquare.user.Arbitrator;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public class ArbitratorProfileController implements Initializable, ChildController
|
||||
public class ArbitratorProfileController extends CachedViewController
|
||||
{
|
||||
|
||||
private final Settings settings;
|
||||
|
||||
private final Persistence persistence;
|
||||
private Arbitrator arbitrator;
|
||||
private NavigationController navigationController;
|
||||
|
||||
@FXML
|
||||
private Label nameLabel;
|
||||
@FXML
|
||||
private TextField nameTextField, languagesTextField, reputationTextField, maxTradeVolumeTextField, passiveServiceFeeTextField, arbitrationFeeTextField, methodsTextField,
|
||||
|
||||
@FXML private Label nameLabel;
|
||||
@FXML private TextField nameTextField, languagesTextField, reputationTextField, maxTradeVolumeTextField, passiveServiceFeeTextField, arbitrationFeeTextField, methodsTextField,
|
||||
idVerificationsTextField, webPageTextField;
|
||||
@FXML
|
||||
private TextArea descriptionTextArea;
|
||||
@FXML private TextArea descriptionTextArea;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -49,6 +45,52 @@ public class ArbitratorProfileController implements Initializable, ChildControll
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate()
|
||||
{
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(ViewController parentController)
|
||||
{
|
||||
super.setParentController(parentController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -85,41 +127,5 @@ public class ArbitratorProfileController implements Initializable, ChildControll
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
this.navigationController = navigationController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<GridPane xmlns:fx="http://javafx.com/fxml/1" hgap="5.0" vgap="5.0" AnchorPane.bottomAnchor="80.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||
xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController">
|
||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController"
|
||||
hgap="5.0" vgap="5.0" AnchorPane.bottomAnchor="80.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<Label fx:id="nameLabel" text="Name:"/>
|
||||
<TextField fx:id="nameTextField" editable="false" focusTraversable="false" GridPane.columnIndex="1"/>
|
||||
|
@ -5,8 +5,9 @@ import com.google.bitcoin.script.Script;
|
||||
import de.jensd.fx.fontawesome.AwesomeDude;
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.arbitrators.profile.ArbitratorProfileController;
|
||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
@ -24,11 +25,9 @@ import java.net.URL;
|
||||
import java.util.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.StringConverter;
|
||||
import javax.inject.Inject;
|
||||
@ -36,7 +35,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"ALL", "EmptyMethod", "UnusedParameters"})
|
||||
public class ArbitratorRegistrationController implements Initializable, ChildController
|
||||
public class ArbitratorRegistrationController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ArbitratorRegistrationController.class);
|
||||
|
||||
@ -56,31 +55,18 @@ public class ArbitratorRegistrationController implements Initializable, ChildCon
|
||||
private Arbitrator.ID_TYPE idType;
|
||||
private ConfidenceDisplay confidenceDisplay;
|
||||
|
||||
@FXML
|
||||
private AnchorPane rootContainer;
|
||||
@FXML
|
||||
private Accordion accordion;
|
||||
@FXML
|
||||
private TitledPane profileTitledPane, payCollateralTitledPane;
|
||||
@FXML
|
||||
private Button saveProfileButton, paymentDoneButton;
|
||||
@FXML
|
||||
private Label nameLabel, infoLabel, copyIcon, confirmationLabel;
|
||||
@FXML
|
||||
private ComboBox<Locale> languageComboBox;
|
||||
@FXML
|
||||
private ComboBox<Arbitrator.ID_TYPE> idTypeComboBox;
|
||||
@FXML
|
||||
private ComboBox<Arbitrator.METHOD> methodsComboBox;
|
||||
@FXML
|
||||
private ComboBox<Arbitrator.ID_VERIFICATION> idVerificationsComboBox;
|
||||
@FXML
|
||||
private TextField nameTextField, idTypeTextField, languagesTextField, maxTradeVolumeTextField, passiveServiceFeeTextField, minPassiveServiceFeeTextField, arbitrationFeeTextField,
|
||||
@FXML private Accordion accordion;
|
||||
@FXML private TitledPane profileTitledPane, payCollateralTitledPane;
|
||||
@FXML private Button saveProfileButton, paymentDoneButton;
|
||||
@FXML private Label nameLabel, infoLabel, copyIcon, confirmationLabel;
|
||||
@FXML private ComboBox<Locale> languageComboBox;
|
||||
@FXML private ComboBox<Arbitrator.ID_TYPE> idTypeComboBox;
|
||||
@FXML private ComboBox<Arbitrator.METHOD> methodsComboBox;
|
||||
@FXML private ComboBox<Arbitrator.ID_VERIFICATION> idVerificationsComboBox;
|
||||
@FXML private TextField nameTextField, idTypeTextField, languagesTextField, maxTradeVolumeTextField, passiveServiceFeeTextField, minPassiveServiceFeeTextField, arbitrationFeeTextField,
|
||||
minArbitrationFeeTextField, methodsTextField, idVerificationsTextField, webPageTextField, collateralAddressTextField, balanceTextField;
|
||||
@FXML
|
||||
private TextArea descriptionTextArea;
|
||||
@FXML
|
||||
private ConfidenceProgressIndicator progressIndicator;
|
||||
@FXML private TextArea descriptionTextArea;
|
||||
@FXML private ConfidenceProgressIndicator progressIndicator;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -98,29 +84,14 @@ public class ArbitratorRegistrationController implements Initializable, ChildCon
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setEditMode(@SuppressWarnings("SameParameterValue") boolean isEditMode)
|
||||
{
|
||||
this.isEditMode = isEditMode;
|
||||
|
||||
if (isEditMode)
|
||||
{
|
||||
saveProfileButton.setText("Save");
|
||||
profileTitledPane.setCollapsible(false);
|
||||
payCollateralTitledPane.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
accordion.setExpandedPane(profileTitledPane);
|
||||
|
||||
Arbitrator persistedArbitrator = (Arbitrator) persistence.read(arbitrator);
|
||||
@ -207,19 +178,56 @@ public class ArbitratorRegistrationController implements Initializable, ChildCon
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public void terminate()
|
||||
{
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(ViewController parentController)
|
||||
{
|
||||
super.setParentController(parentController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setEditMode(@SuppressWarnings("SameParameterValue") boolean isEditMode)
|
||||
{
|
||||
this.isEditMode = isEditMode;
|
||||
|
||||
if (isEditMode)
|
||||
{
|
||||
saveProfileButton.setText("Save");
|
||||
profileTitledPane.setCollapsible(false);
|
||||
payCollateralTitledPane.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -506,7 +514,7 @@ public class ArbitratorRegistrationController implements Initializable, ChildCon
|
||||
|
||||
private void close()
|
||||
{
|
||||
Stage stage = (Stage) rootContainer.getScene().getWindow();
|
||||
Stage stage = (Stage) root.getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,9 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="rootContainer" prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"
|
||||
AnchorPane.topAnchor="10.0" xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.arbitrators.registration.ArbitratorRegistrationController">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.arbitrators.registration.ArbitratorRegistrationController"
|
||||
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<Accordion fx:id="accordion" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
|
||||
<panes>
|
||||
|
@ -1,9 +1,7 @@
|
||||
package io.bitsquare.gui.components;
|
||||
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.storage.Persistence;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -17,109 +15,100 @@ import org.slf4j.LoggerFactory;
|
||||
* That class caches the already created views in a tab pane.
|
||||
* 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
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CachingTabPane.class);
|
||||
|
||||
private final List<TabInfo> tabInfoList = new ArrayList<>();
|
||||
private NavigationController navigationController;
|
||||
private ViewController parentController;
|
||||
private Persistence persistence;
|
||||
private int selectedTabIndex;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public CachingTabPane()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public void initialize(NavigationController navigationController, Persistence persistence, String... tabContentFXMLUrls)
|
||||
public void initialize(ViewController parentController, Persistence persistence, String... tabContentFXMLUrls)
|
||||
{
|
||||
if (tabContentFXMLUrls.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("No tabContentFXMLUrls defined");
|
||||
}
|
||||
|
||||
this.navigationController = navigationController;
|
||||
this.parentController = parentController;
|
||||
this.persistence = persistence;
|
||||
|
||||
for (String tabContentFXMLUrl : tabContentFXMLUrls) tabInfoList.add(new TabInfo(tabContentFXMLUrl));
|
||||
|
||||
getSelectionModel().selectedItemProperty().addListener((observableValue, oldTab, newTab) -> onTabSelectedIndexChanged());
|
||||
getSelectionModel().selectedItemProperty().addListener((observableValue, oldTab, newTab) -> loadView());
|
||||
|
||||
// use parent to read selectedTabIndex
|
||||
Object indexObject = persistence.read(navigationController, "selectedTabIndex");
|
||||
Object indexObject = persistence.read(parentController, "selectedTabIndex");
|
||||
selectedTabIndex = (indexObject == null) ? 0 : (int) indexObject;
|
||||
if (selectedTabIndex == 0) onTabSelectedIndexChanged();
|
||||
|
||||
getSelectionModel().select(selectedTabIndex);
|
||||
// if selectedTabIndex = 0 the the change listener will not fire so we load it manually
|
||||
// if (selectedTabIndex == 0) loadView();
|
||||
|
||||
//getSelectionModel().select(selectedTabIndex);
|
||||
}
|
||||
|
||||
public void cleanup()
|
||||
{
|
||||
if (tabInfoList.get(selectedTabIndex).controller != null)
|
||||
tabInfoList.get(selectedTabIndex).controller.cleanup();
|
||||
}
|
||||
|
||||
public ChildController navigateToView(String fxmlView)
|
||||
public ViewController loadViewAndGetChildController(String fxmlView)
|
||||
{
|
||||
for (int i = 0; i < tabInfoList.size(); i++)
|
||||
{
|
||||
if (tabInfoList.get(i).url.equals(fxmlView))
|
||||
{
|
||||
// selection will cause loadView() call
|
||||
getSelectionModel().select(i);
|
||||
return tabInfoList.get(selectedTabIndex).controller;
|
||||
return currentController();
|
||||
}
|
||||
}
|
||||
// if not found
|
||||
throw new IllegalArgumentException("fxmlView not defined in tabContentFXMLUrlMap.");
|
||||
}
|
||||
|
||||
private void onTabSelectedIndexChanged()
|
||||
{
|
||||
selectedTabIndex = getSelectionModel().getSelectedIndex();
|
||||
|
||||
if (tabInfoList.get(selectedTabIndex).controller != null)
|
||||
{
|
||||
// set old one to sleep
|
||||
((Hibernate) tabInfoList.get(selectedTabIndex).controller).sleep();
|
||||
}
|
||||
else
|
||||
{
|
||||
// load for the first time
|
||||
String fxmlView = tabInfoList.get(selectedTabIndex).url;
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(fxmlView));
|
||||
try
|
||||
{
|
||||
tabInfoList.get(selectedTabIndex).view = loader.load();
|
||||
tabInfoList.get(selectedTabIndex).controller = loader.getController();
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
getSelectionModel().getSelectedItem().setContent(tabInfoList.get(selectedTabIndex).view);
|
||||
tabInfoList.get(selectedTabIndex).controller.setNavigationController(navigationController);
|
||||
((Hibernate) tabInfoList.get(selectedTabIndex).controller).awake();
|
||||
|
||||
// use parent to write selectedTabIndex
|
||||
persistence.write(navigationController, "selectedTabIndex", selectedTabIndex);
|
||||
}
|
||||
|
||||
public void setSelectedTabIndex(int selectedTabIndex)
|
||||
{
|
||||
getSelectionModel().select(selectedTabIndex);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void loadView()
|
||||
{
|
||||
selectedTabIndex = getSelectionModel().getSelectedIndex();
|
||||
TabInfo selectedTabInfo = tabInfoList.get(selectedTabIndex);
|
||||
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(selectedTabInfo.url));
|
||||
try
|
||||
{
|
||||
Node view = loader.load();
|
||||
selectedTabInfo.controller = loader.getController();
|
||||
getSelectionModel().getSelectedItem().setContent(view);
|
||||
} catch (IOException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
selectedTabInfo.controller.setParentController(parentController);
|
||||
// use parent to write selectedTabIndex
|
||||
persistence.write(parentController, "selectedTabIndex", selectedTabIndex);
|
||||
}
|
||||
|
||||
private ViewController currentController()
|
||||
{
|
||||
return tabInfoList.get(selectedTabIndex).controller;
|
||||
}
|
||||
}
|
||||
|
||||
class TabInfo
|
||||
{
|
||||
Node view;
|
||||
ChildController controller;
|
||||
ViewController controller;
|
||||
final String url;
|
||||
|
||||
TabInfo(String url)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.bitsquare.gui.popups;
|
||||
package io.bitsquare.gui.components;
|
||||
|
||||
import com.google.bitcoin.store.BlockStoreException;
|
||||
import com.google.common.base.Throwables;
|
@ -1,27 +1,21 @@
|
||||
package io.bitsquare.gui.funds;
|
||||
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.CachingTabPane;
|
||||
import io.bitsquare.storage.Persistence;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FundsController implements Initializable, ChildController, NavigationController, Hibernate
|
||||
public class FundsController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(FundsController.class);
|
||||
private final Persistence persistence;
|
||||
private ChildController childController;
|
||||
|
||||
@FXML
|
||||
private CachingTabPane root;
|
||||
private ViewController childController;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,58 +30,40 @@ public class FundsController implements Initializable, ChildController, Navigati
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
root.initialize(this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(), NavigationItem.WITHDRAWAL.getFxmlUrl(), NavigationItem.TRANSACTIONS.getFxmlUrl());
|
||||
super.initialize(url, rb);
|
||||
|
||||
((CachingTabPane) root).initialize(this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(), NavigationItem.WITHDRAWAL.getFxmlUrl(), NavigationItem.TRANSACTIONS.getFxmlUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
root.cleanup();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
{
|
||||
childController = root.navigateToView(navigationItem.getFxmlUrl());
|
||||
childController = ((CachingTabPane) root).loadViewAndGetChildController(navigationItem.getFxmlUrl());
|
||||
return childController;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
if (childController instanceof Hibernate)
|
||||
((Hibernate) childController).sleep();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
{
|
||||
if (childController instanceof Hibernate)
|
||||
((Hibernate) childController).awake();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
<?import io.bitsquare.gui.components.CachingTabPane?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<CachingTabPane xmlns:fx="http://javafx.com/fxml/1" fx:id="root" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.funds.FundsController">
|
||||
<CachingTabPane fx:id="root" fx:controller="io.bitsquare.gui.funds.FundsController"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<Tab text="Deposit" closable="false"/>
|
||||
<Tab text="Withdrawal" closable="false"/>
|
||||
|
@ -4,9 +4,7 @@ import de.jensd.fx.fontawesome.AwesomeDude;
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
@ -15,24 +13,21 @@ import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DepositController implements Initializable, ChildController, Hibernate
|
||||
public class DepositController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(DepositController.class);
|
||||
|
||||
private final WalletFacade walletFacade;
|
||||
private ObservableList<DepositListItem> addressList;
|
||||
|
||||
@FXML private VBox root;
|
||||
@FXML private TableView<DepositListItem> tableView;
|
||||
@FXML private TableColumn<String, DepositListItem> labelColumn, addressColumn, balanceColumn, copyColumn, confidenceColumn;
|
||||
@FXML private Button addNewAddressButton;
|
||||
@ -50,13 +45,14 @@ public class DepositController implements Initializable, ChildController, Hibern
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
awake();
|
||||
super.initialize(url, rb);
|
||||
|
||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
|
||||
setLabelColumnCellFactory();
|
||||
@ -65,39 +61,20 @@ public class DepositController implements Initializable, ChildController, Hibern
|
||||
setConfidenceColumnCellFactory();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public void deactivate()
|
||||
{
|
||||
}
|
||||
super.deactivate();
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
for (DepositListItem anAddressList : addressList)
|
||||
{
|
||||
anAddressList.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
List<AddressEntry> addressEntryList = walletFacade.getAddressEntryList();
|
||||
addressList = FXCollections.observableArrayList();
|
||||
addressList.addAll(addressEntryList.stream().map(anAddressEntryList -> new DepositListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
|
||||
|
@ -4,8 +4,8 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox fx:id="root" xmlns:fx="http://javafx.com/fxml/1" spacing="10" fx:controller="io.bitsquare.gui.funds.deposit.DepositController"
|
||||
xmlns="http://javafx.com/javafx/8">
|
||||
<VBox fx:id="root" fx:controller="io.bitsquare.gui.funds.deposit.DepositController"
|
||||
spacing="10" xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||
</padding>
|
||||
|
@ -2,9 +2,7 @@ package io.bitsquare.gui.funds.transactions;
|
||||
|
||||
import com.google.bitcoin.core.Transaction;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
@ -13,22 +11,19 @@ import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TransactionsController implements Initializable, ChildController, Hibernate
|
||||
public class TransactionsController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(TransactionsController.class);
|
||||
|
||||
private final WalletFacade walletFacade;
|
||||
private ObservableList<TransactionsListItem> transactionsListItems;
|
||||
|
||||
@FXML private VBox root;
|
||||
@FXML private TableView<TransactionsListItem> tableView;
|
||||
@FXML private TableColumn<String, TransactionsListItem> dateColumn, addressColumn, amountColumn, typeColumn, confidenceColumn;
|
||||
@FXML private Button addNewAddressButton;
|
||||
@ -46,52 +41,34 @@ public class TransactionsController implements Initializable, ChildController, H
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
awake();
|
||||
super.initialize(url, rb);
|
||||
|
||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
|
||||
setAddressColumnCellFactory();
|
||||
setConfidenceColumnCellFactory();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public void deactivate()
|
||||
{
|
||||
}
|
||||
super.deactivate();
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
for (TransactionsListItem transactionsListItem : transactionsListItems)
|
||||
{
|
||||
transactionsListItem.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
List<Transaction> transactions = walletFacade.getWallet().getRecentTransactions(10000, true);
|
||||
transactionsListItems = FXCollections.observableArrayList();
|
||||
transactionsListItems.addAll(transactions.stream().map(transaction -> new TransactionsListItem(transaction, walletFacade)).collect(Collectors.toList()));
|
||||
|
@ -4,8 +4,8 @@
|
||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox fx:id="root" xmlns:fx="http://javafx.com/fxml/1" spacing="10" fx:controller="io.bitsquare.gui.funds.transactions.TransactionsController"
|
||||
xmlns="http://javafx.com/javafx/8">
|
||||
<VBox fx:id="root" fx:controller="io.bitsquare.gui.funds.transactions.TransactionsController"
|
||||
spacing="10" xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||
</padding>
|
||||
|
@ -11,10 +11,8 @@ import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.BtcValidator;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.popups.Popups;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.gui.util.BitSquareValidator;
|
||||
import java.net.URL;
|
||||
@ -25,11 +23,9 @@ import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import javax.inject.Inject;
|
||||
import org.controlsfx.control.action.Action;
|
||||
@ -37,7 +33,7 @@ import org.controlsfx.dialog.Dialog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class WithdrawalController implements Initializable, ChildController, Hibernate
|
||||
public class WithdrawalController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(WithdrawalController.class);
|
||||
|
||||
@ -45,7 +41,6 @@ public class WithdrawalController implements Initializable, ChildController, Hib
|
||||
private final WalletFacade walletFacade;
|
||||
private ObservableList<WithdrawalListItem> addressList;
|
||||
|
||||
@FXML private VBox root;
|
||||
@FXML private TableView<WithdrawalListItem> tableView;
|
||||
@FXML private TableColumn<String, WithdrawalListItem> labelColumn, addressColumn, balanceColumn, copyColumn, confidenceColumn;
|
||||
@FXML private Button addNewAddressButton;
|
||||
@ -62,21 +57,36 @@ public class WithdrawalController implements Initializable, ChildController, Hib
|
||||
this.walletFacade = walletFacade;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
awake();
|
||||
super.initialize(url, rb);
|
||||
|
||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
|
||||
setLabelColumnCellFactory();
|
||||
setBalanceColumnCellFactory();
|
||||
setCopyColumnCellFactory();
|
||||
setConfidenceColumnCellFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
|
||||
for (WithdrawalListItem anAddressList : addressList)
|
||||
anAddressList.cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
tableView.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
if (newValue != null)
|
||||
@ -98,41 +108,7 @@ public class WithdrawalController implements Initializable, ChildController, Hib
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
for (WithdrawalListItem anAddressList : addressList)
|
||||
{
|
||||
anAddressList.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
{
|
||||
List<AddressEntry> addressEntryList = walletFacade.getAddressEntryList();
|
||||
addressList = FXCollections.observableArrayList();
|
||||
addressList.addAll(addressEntryList.stream().map(anAddressEntryList -> new WithdrawalListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList()));
|
||||
|
@ -4,7 +4,8 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<VBox fx:id="root" xmlns:fx="http://javafx.com/fxml/1" spacing="10" fx:controller="io.bitsquare.gui.funds.withdrawal.WithdrawalController" xmlns="http://javafx.com/javafx/8">
|
||||
<VBox fx:id="root" fx:controller="io.bitsquare.gui.funds.withdrawal.WithdrawalController"
|
||||
spacing="10" xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||
</padding>
|
||||
|
@ -2,60 +2,66 @@ package io.bitsquare.gui.home;
|
||||
|
||||
import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.arbitrators.registration.ArbitratorRegistrationController;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HomeController implements Initializable, ChildController, NavigationController
|
||||
public class HomeController extends CachedViewController
|
||||
{
|
||||
private ArbitratorRegistrationController arbitratorRegistrationController;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
// navigateToView(NavigationController.ARBITRATOR_REGISTRATION, "Registration as Arbitrator");
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public void terminate()
|
||||
{
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
public void deactivate()
|
||||
{
|
||||
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
if (arbitratorRegistrationController != null)
|
||||
{
|
||||
arbitratorRegistrationController.cleanup();
|
||||
}
|
||||
|
||||
// dont use caching here, cause exc. -> need to investigate and is rarely called so no caching is better
|
||||
// don't use caching here, cause exc. -> need to investigate and is rarely called so no caching is better
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Parent view = loader.load();
|
||||
arbitratorRegistrationController = loader.getController();
|
||||
arbitratorRegistrationController.setNavigationController(this);
|
||||
arbitratorRegistrationController.setParentController(this);
|
||||
|
||||
final Stage rootStage = BitSquare.getPrimaryStage();
|
||||
final Stage stage = new Stage();
|
||||
@ -80,16 +86,21 @@ public class HomeController implements Initializable, ChildController, Navigatio
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI Handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@FXML
|
||||
public void onArbitratorRegistration()
|
||||
{
|
||||
navigateToView(NavigationItem.ARBITRATOR_REGISTRATION);
|
||||
loadViewAndGetChildController(NavigationItem.ARBITRATOR_REGISTRATION);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onArbitratorEdit()
|
||||
{
|
||||
navigateToView(NavigationItem.ARBITRATOR_REGISTRATION);
|
||||
loadViewAndGetChildController(NavigationItem.ARBITRATOR_REGISTRATION);
|
||||
arbitratorRegistrationController.setEditMode(true);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="io.bitsquare.gui.home.HomeController" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"
|
||||
AnchorPane.topAnchor="10.0">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.home.HomeController"
|
||||
AnchorPane.bottomAnchor="30" AnchorPane.leftAnchor="10" AnchorPane.rightAnchor="10" AnchorPane.topAnchor="10"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<Label id="headline-label" text="Overview"/>
|
||||
<Label text="TODO"/>
|
||||
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<TabPane xmlns:fx="http://javafx.com/fxml/1" fx:id="tabPane" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
fx:controller="io.bitsquare.gui.market.BuyController"/>
|
@ -1,143 +0,0 @@
|
||||
package io.bitsquare.gui.market;
|
||||
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.components.ValidatingTextField;
|
||||
import io.bitsquare.gui.market.orderbook.OrderBookController;
|
||||
import io.bitsquare.trade.Direction;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
public class SellController implements Initializable, NavigationController, ChildController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(SellController.class);
|
||||
|
||||
protected OrderBookController orderBookController;
|
||||
protected GuiceFXMLLoader orderBookLoader;
|
||||
|
||||
@FXML
|
||||
protected TabPane tabPane;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
// TODO find better solution
|
||||
// Textfield focus out triggers validation, use runLater as quick fix...
|
||||
tabPane.getSelectionModel().selectedIndexProperty().addListener((observableValue) -> Platform.runLater(() -> ValidatingTextField.hidePopover()));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
{
|
||||
if (navigationItem == NavigationItem.ORDER_BOOK)
|
||||
{
|
||||
return loadOrderBook();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkArgument(navigationItem.equals(NavigationItem.CREATE_OFFER) || navigationItem.equals(NavigationItem.TAKE_OFFER));
|
||||
|
||||
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times in different graphs
|
||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Parent view = loader.load();
|
||||
ChildController childController = loader.getController();
|
||||
childController.setNavigationController(this);
|
||||
|
||||
String tabLabel = navigationItem.equals(NavigationItem.CREATE_OFFER) ? "Create offer" : "Take offer";
|
||||
final Tab tab = new Tab(tabLabel);
|
||||
tab.setContent(view);
|
||||
tabPane.getTabs().add(tab);
|
||||
tabPane.getSelectionModel().select(tabPane.getTabs().size() - 1);
|
||||
|
||||
return childController;
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
navigateToView(NavigationItem.ORDER_BOOK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
if (orderBookController != null)
|
||||
{
|
||||
orderBookController.cleanup();
|
||||
orderBookController = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
protected void applyDirection()
|
||||
{
|
||||
orderBookController.applyDirection(Direction.SELL);
|
||||
}
|
||||
|
||||
protected ChildController loadOrderBook()
|
||||
{
|
||||
// Orderbook must not be cached by GuiceFXMLLoader as we use 2 instances for sell and buy screens.
|
||||
if (orderBookLoader == null)
|
||||
{
|
||||
orderBookLoader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.ORDER_BOOK.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Parent view = orderBookLoader.load();
|
||||
final Tab tab = new Tab("Orderbook");
|
||||
tab.setClosable(false);
|
||||
tab.setContent(view);
|
||||
tabPane.getTabs().add(tab);
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
orderBookController = orderBookLoader.getController();
|
||||
orderBookController.setNavigationController(this);
|
||||
applyDirection();
|
||||
return orderBookController;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<TabPane xmlns:fx="http://javafx.com/fxml/1" fx:id="tabPane" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
fx:controller="io.bitsquare.gui.market.SellController"/>
|
@ -1,15 +1,15 @@
|
||||
package io.bitsquare.gui.msg;
|
||||
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.Initializable;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MsgController implements Initializable, ChildController
|
||||
public class MsgController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(MsgController.class);
|
||||
|
||||
@ -23,30 +23,46 @@ public class MsgController implements Initializable, ChildController
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate()
|
||||
{
|
||||
super.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GUI Event handlers
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.bitsquare.gui.msg.MsgController" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
|
||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns="http://javafx.com/javafx/8">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.msg.MsgController"
|
||||
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
|
||||
<Label id="headline-label" text="Message"/>
|
||||
|
@ -1,29 +1,21 @@
|
||||
package io.bitsquare.gui.orders;
|
||||
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.CachingTabPane;
|
||||
import io.bitsquare.storage.Persistence;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OrdersController implements Initializable, ChildController, NavigationController, Hibernate
|
||||
public class OrdersController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(OrdersController.class);
|
||||
private static int SELECTED_TAB_INDEX = -1;
|
||||
private static OrdersController INSTANCE;
|
||||
private final Persistence persistence;
|
||||
private ChildController childController;
|
||||
|
||||
@FXML
|
||||
private CachingTabPane tabPane;
|
||||
|
||||
@Inject
|
||||
private OrdersController(Persistence persistence)
|
||||
@ -42,6 +34,43 @@ public class OrdersController implements Initializable, ChildController, Navigat
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
((CachingTabPane) root).initialize(this, persistence, NavigationItem.OFFER.getFxmlUrl(), NavigationItem.PENDING_TRADE.getFxmlUrl(), NavigationItem.CLOSED_TRADE.getFxmlUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
childController = ((CachingTabPane) root).loadViewAndGetChildController(navigationItem.getFxmlUrl());
|
||||
return childController;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -49,68 +78,9 @@ public class OrdersController implements Initializable, ChildController, Navigat
|
||||
public void setSelectedTabIndex(int index)
|
||||
{
|
||||
log.trace("setSelectedTabIndex " + index);
|
||||
tabPane.setSelectedTabIndex(index);
|
||||
((CachingTabPane) root).setSelectedTabIndex(index);
|
||||
persistence.write(this, "selectedTabIndex", index);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
log.trace("initialize ");
|
||||
tabPane.initialize(this, persistence, NavigationItem.OFFER.getFxmlUrl(), NavigationItem.PENDING_TRADE.getFxmlUrl(), NavigationItem.CLOSED_TRADE.getFxmlUrl());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
tabPane.cleanup();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
{
|
||||
childController = tabPane.navigateToView(navigationItem.getFxmlUrl());
|
||||
return childController;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
if (childController instanceof Hibernate)
|
||||
((Hibernate) childController).sleep();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
{
|
||||
if (childController instanceof Hibernate)
|
||||
((Hibernate) childController).awake();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
<?import io.bitsquare.gui.components.CachingTabPane?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<CachingTabPane xmlns:fx="http://javafx.com/fxml/1" fx:id="tabPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.orders.OrdersController">
|
||||
<CachingTabPane fx:id="root" fx:controller="io.bitsquare.gui.orders.OrdersController"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<Tab text="Open offers" closable="false"/>
|
||||
<Tab text="Pending trades" closable="false"/>
|
||||
|
@ -1,16 +1,13 @@
|
||||
package io.bitsquare.gui.orders.closed;
|
||||
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.Initializable;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ClosedTradeController implements Initializable, ChildController, Hibernate
|
||||
public class ClosedTradeController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(ClosedTradeController.class);
|
||||
|
||||
@ -26,45 +23,25 @@ public class ClosedTradeController implements Initializable, ChildController, Hi
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
log.debug("setNavigationController" + this);
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
public void deactivate()
|
||||
{
|
||||
log.debug("cleanup" + this);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.bitsquare.gui.orders.closed.ClosedTradeController" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
|
||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns="http://javafx.com/javafx/8">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.orders.closed.ClosedTradeController"
|
||||
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
|
||||
<Label id="form-header-text" text="Closed"/>
|
||||
|
@ -1,8 +1,6 @@
|
||||
package io.bitsquare.gui.orders.offer;
|
||||
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.trade.Offer;
|
||||
import io.bitsquare.trade.TradeManager;
|
||||
@ -16,7 +14,6 @@ import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.util.Callback;
|
||||
@ -25,15 +22,14 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
public class OfferController implements Initializable, ChildController, Hibernate
|
||||
public class OfferController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(OfferController.class);
|
||||
private final TradeManager tradeManager;
|
||||
private ObservableList<OfferListItem> offerListItems;
|
||||
@FXML
|
||||
private TableColumn<String, OfferListItem> offerIdColumn, dateColumn, amountColumn, priceColumn, volumeColumn, removeColumn;
|
||||
@FXML
|
||||
private TableView<OfferListItem> offerTable;
|
||||
|
||||
@FXML private TableColumn<String, OfferListItem> offerIdColumn, dateColumn, amountColumn, priceColumn, volumeColumn, removeColumn;
|
||||
@FXML private TableView<OfferListItem> offerTable;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -48,47 +44,30 @@ public class OfferController implements Initializable, ChildController, Hibernat
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
awake();
|
||||
super.initialize(url, rb);
|
||||
|
||||
setOfferIdColumnColumnCellFactory();
|
||||
setRemoveColumnCellFactory();
|
||||
offerTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
public void activate()
|
||||
{
|
||||
log.debug("cleanup" + this);
|
||||
}
|
||||
super.activate();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
{
|
||||
offerListItems = FXCollections.observableArrayList();
|
||||
Map<String, Offer> offerMap = tradeManager.getOffers();
|
||||
List<Offer> offerList = new ArrayList<>(offerMap.values());
|
||||
@ -106,14 +85,12 @@ public class OfferController implements Initializable, ChildController, Hibernat
|
||||
// Private Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private void removeOffer(OfferListItem offerListItem)
|
||||
{
|
||||
tradeManager.removeOffer(offerListItem.getOffer());
|
||||
offerListItems.remove(offerListItem);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
private void openOfferDetails(OfferListItem offerListItem)
|
||||
{
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
<?import javafx.scene.control.cell.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml/1" spacing="10" fx:controller="io.bitsquare.gui.orders.offer.OfferController"
|
||||
xmlns="http://javafx.com/javafx/8">
|
||||
<VBox fx:id="root" fx:controller="io.bitsquare.gui.orders.offer.OfferController"
|
||||
spacing="10" xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||
</padding>
|
||||
|
@ -8,9 +8,7 @@ import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.gui.util.ConfidenceDisplay;
|
||||
@ -29,7 +27,6 @@ import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
@ -37,13 +34,12 @@ import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PendingTradeController implements Initializable, ChildController, Hibernate
|
||||
public class PendingTradeController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(PendingTradeController.class);
|
||||
|
||||
@ -51,13 +47,11 @@ public class PendingTradeController implements Initializable, ChildController, H
|
||||
private WalletFacade walletFacade;
|
||||
|
||||
private Trade currentTrade;
|
||||
private NavigationController navigationController;
|
||||
|
||||
private Image buyIcon = ImageUtil.getIconImage(ImageUtil.BUY);
|
||||
private Image sellIcon = ImageUtil.getIconImage(ImageUtil.SELL);
|
||||
private ConfidenceDisplay confidenceDisplay;
|
||||
|
||||
@FXML
|
||||
private VBox rootContainer;
|
||||
@FXML
|
||||
private TableView openTradesTable;
|
||||
@FXML
|
||||
@ -86,43 +80,26 @@ public class PendingTradeController implements Initializable, ChildController, H
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
awake();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
this.navigationController = navigationController;
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
public void deactivate()
|
||||
{
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
Map<String, Trade> trades = tradeManager.getTrades();
|
||||
List<Trade> tradeList = new ArrayList<>(trades.values());
|
||||
ObservableList<PendingTradesListItem> tradeItems = FXCollections.observableArrayList();
|
||||
@ -174,6 +151,7 @@ public class PendingTradeController implements Initializable, ChildController, H
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GUI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -5,10 +5,10 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:id="rootContainer" fx:controller="io.bitsquare.gui.orders.pending.PendingTradeController" spacing="10" AnchorPane.bottomAnchor="0"
|
||||
AnchorPane.leftAnchor="0"
|
||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns="http://javafx.com/javafx/8">
|
||||
<VBox fx:id="root" fx:controller="io.bitsquare.gui.orders.pending.PendingTradeController"
|
||||
spacing="10" AnchorPane.bottomAnchor="0"
|
||||
AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<TableView id="orderbook-table" fx:id="openTradesTable" prefHeight="150.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="amountColumn" minWidth="120" text="Amount (Min.)">
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.bitsquare.gui.orders.pending;
|
||||
|
||||
import io.bitsquare.gui.market.orderbook.OrderBookListItem;
|
||||
import io.bitsquare.gui.trade.orderbook.OrderBookListItem;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -6,9 +6,9 @@ import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.util.BitSquareValidator;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.locale.*;
|
||||
@ -25,7 +25,6 @@ import java.util.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
@ -40,43 +39,29 @@ import javafx.util.StringConverter;
|
||||
import javax.inject.Inject;
|
||||
|
||||
// TODO separate in 2 view/controllers
|
||||
public class SettingsController implements Initializable, ChildController, NavigationController
|
||||
public class SettingsController extends CachedViewController
|
||||
{
|
||||
private final User user;
|
||||
|
||||
private final Settings settings;
|
||||
|
||||
private final Persistence persistence;
|
||||
private final MessageFacade messageFacade;
|
||||
|
||||
private final ObservableList<Locale> languageList;
|
||||
private final ObservableList<Country> countryList;
|
||||
private ChildController childController;
|
||||
private List<String> regionList;
|
||||
private ViewController childController;
|
||||
private ObservableList<Arbitrator> arbitratorList;
|
||||
|
||||
@FXML private TabPane root;
|
||||
@FXML
|
||||
private ListView<Locale> languagesListView;
|
||||
@FXML
|
||||
private ListView<Country> countriesListView;
|
||||
@FXML
|
||||
private ListView<Arbitrator> arbitratorsListView;
|
||||
@FXML
|
||||
private ComboBox<Locale> languageComboBox;
|
||||
@FXML
|
||||
private ComboBox<Region> regionComboBox, bankAccountRegionComboBox;
|
||||
@FXML
|
||||
private ComboBox<Country> countryComboBox, bankAccountCountryComboBox;
|
||||
@FXML
|
||||
private TextField bankAccountTitleTextField, bankAccountHolderNameTextField, bankAccountPrimaryIDTextField, bankAccountSecondaryIDTextField;
|
||||
@FXML
|
||||
private Button saveBankAccountButton, addBankAccountButton;
|
||||
@FXML
|
||||
private ComboBox<BankAccount> bankAccountComboBox;
|
||||
@FXML
|
||||
private ComboBox<BankAccountType> bankAccountTypesComboBox;
|
||||
@FXML
|
||||
private ComboBox<Currency> bankAccountCurrencyComboBox;
|
||||
@FXML private ListView<Locale> languagesListView;
|
||||
@FXML private ListView<Country> countriesListView;
|
||||
@FXML private ListView<Arbitrator> arbitratorsListView;
|
||||
@FXML private ComboBox<Locale> languageComboBox;
|
||||
@FXML private ComboBox<Region> regionComboBox, bankAccountRegionComboBox;
|
||||
@FXML private ComboBox<Country> countryComboBox, bankAccountCountryComboBox;
|
||||
@FXML private TextField bankAccountTitleTextField, bankAccountHolderNameTextField, bankAccountPrimaryIDTextField, bankAccountSecondaryIDTextField;
|
||||
@FXML private Button saveBankAccountButton, addBankAccountButton;
|
||||
@FXML private ComboBox<BankAccount> bankAccountComboBox;
|
||||
@FXML private ComboBox<BankAccountType> bankAccountTypesComboBox;
|
||||
@FXML private ComboBox<Currency> bankAccountCurrencyComboBox;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -110,106 +95,54 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void updateArbitrators()
|
||||
{
|
||||
arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators());
|
||||
initArbitrators();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
setupGeneralSettingsScreen();
|
||||
initBankAccountScreen();
|
||||
addMockArbitrator();
|
||||
}
|
||||
|
||||
private void addMockArbitrator()
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
if (settings.getAcceptedArbitrators().isEmpty())
|
||||
{
|
||||
String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey());
|
||||
String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey());
|
||||
List<Locale> languages = new ArrayList<>();
|
||||
languages.add(LanguageUtil.getDefaultLanguageLocale());
|
||||
List<Arbitrator.METHOD> arbitrationMethods = new ArrayList<>();
|
||||
arbitrationMethods.add(Arbitrator.METHOD.TLS_NOTARY);
|
||||
List<Arbitrator.ID_VERIFICATION> idVerifications = new ArrayList<>();
|
||||
idVerifications.add(Arbitrator.ID_VERIFICATION.PASSPORT);
|
||||
idVerifications.add(Arbitrator.ID_VERIFICATION.GOV_ID);
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
Arbitrator arbitrator = new Arbitrator(pubKeyAsHex,
|
||||
messagePubKeyAsHex,
|
||||
"Manfred Karrer",
|
||||
Arbitrator.ID_TYPE.REAL_LIFE_ID,
|
||||
languages,
|
||||
new Reputation(),
|
||||
1,
|
||||
0.01,
|
||||
0.001,
|
||||
10,
|
||||
0.1,
|
||||
arbitrationMethods,
|
||||
idVerifications,
|
||||
"http://bitsquare.io/",
|
||||
"Bla bla...");
|
||||
|
||||
arbitratorList.add(arbitrator);
|
||||
settings.addAcceptedArbitrator(arbitrator);
|
||||
persistence.write(settings);
|
||||
|
||||
messageFacade.addArbitrator(arbitrator);
|
||||
}
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
|
||||
}
|
||||
/*if (childController instanceof CachedViewController)
|
||||
((CachedViewController) childController).deactivate();
|
||||
else if (childController != null)
|
||||
childController.terminate();*/
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: NavigationController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Override
|
||||
public ChildController navigateToView(NavigationItem navigationItem)
|
||||
{
|
||||
|
||||
if (childController != null)
|
||||
{
|
||||
childController.cleanup();
|
||||
}
|
||||
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
||||
// TODO
|
||||
// caching causes exception
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Node view = loader.load();
|
||||
childController = loader.getController();
|
||||
childController.setNavigationController(this);
|
||||
childController.setParentController(this);
|
||||
|
||||
final Stage rootStage = BitSquare.getPrimaryStage();
|
||||
final Stage stage = new Stage();
|
||||
@ -226,9 +159,7 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||
stage.setScene(scene);
|
||||
stage.setOnHidden(windowEvent -> {
|
||||
if (navigationItem == NavigationItem.ARBITRATOR_OVERVIEW)
|
||||
{
|
||||
updateArbitrators();
|
||||
}
|
||||
});
|
||||
stage.show();
|
||||
|
||||
@ -242,9 +173,19 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
// Public Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void updateArbitrators()
|
||||
{
|
||||
arbitratorList = FXCollections.observableArrayList(settings.getAcceptedArbitrators());
|
||||
initArbitrators();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// General Settings
|
||||
@FXML
|
||||
@ -272,7 +213,7 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||
@FXML
|
||||
public void onAddArbitrator()
|
||||
{
|
||||
navigateToView(NavigationItem.ARBITRATOR_OVERVIEW);
|
||||
loadViewAndGetChildController(NavigationItem.ARBITRATOR_OVERVIEW);
|
||||
}
|
||||
|
||||
|
||||
@ -853,5 +794,49 @@ public class SettingsController implements Initializable, ChildController, Navig
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Arbitrators
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void addMockArbitrator()
|
||||
{
|
||||
if (settings.getAcceptedArbitrators().isEmpty())
|
||||
{
|
||||
String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey());
|
||||
String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey());
|
||||
List<Locale> languages = new ArrayList<>();
|
||||
languages.add(LanguageUtil.getDefaultLanguageLocale());
|
||||
List<Arbitrator.METHOD> arbitrationMethods = new ArrayList<>();
|
||||
arbitrationMethods.add(Arbitrator.METHOD.TLS_NOTARY);
|
||||
List<Arbitrator.ID_VERIFICATION> idVerifications = new ArrayList<>();
|
||||
idVerifications.add(Arbitrator.ID_VERIFICATION.PASSPORT);
|
||||
idVerifications.add(Arbitrator.ID_VERIFICATION.GOV_ID);
|
||||
|
||||
Arbitrator arbitrator = new Arbitrator(pubKeyAsHex,
|
||||
messagePubKeyAsHex,
|
||||
"Manfred Karrer",
|
||||
Arbitrator.ID_TYPE.REAL_LIFE_ID,
|
||||
languages,
|
||||
new Reputation(),
|
||||
1,
|
||||
0.01,
|
||||
0.001,
|
||||
10,
|
||||
0.1,
|
||||
arbitrationMethods,
|
||||
idVerifications,
|
||||
"http://bitsquare.io/",
|
||||
"Bla bla...");
|
||||
|
||||
arbitratorList.add(arbitrator);
|
||||
settings.addAcceptedArbitrator(arbitrator);
|
||||
persistence.write(settings);
|
||||
|
||||
messageFacade.addArbitrator(arbitrator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<TabPane fx:id="root" xmlns:fx="http://javafx.com/fxml/1" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.settings.SettingsController">
|
||||
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.settings.SettingsController"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<Tab text="General" closable="false">
|
||||
<GridPane hgap="5.0" vgap="5.0">
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.bitsquare.gui.market;
|
||||
package io.bitsquare.gui.trade;
|
||||
|
||||
import io.bitsquare.trade.Direction;
|
||||
|
||||
public class BuyController extends SellController
|
||||
public class BuyController extends TradeController
|
||||
{
|
||||
@Override
|
||||
protected void applyDirection()
|
7
src/main/java/io/bitsquare/gui/trade/BuyView.fxml
Normal file
7
src/main/java/io/bitsquare/gui/trade/BuyView.fxml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.trade.BuyController"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml"/>
|
15
src/main/java/io/bitsquare/gui/trade/SellController.java
Normal file
15
src/main/java/io/bitsquare/gui/trade/SellController.java
Normal file
@ -0,0 +1,15 @@
|
||||
package io.bitsquare.gui.trade;
|
||||
|
||||
import io.bitsquare.trade.Direction;
|
||||
|
||||
public class SellController extends TradeController
|
||||
{
|
||||
@Override
|
||||
protected void applyDirection()
|
||||
{
|
||||
orderBookController.applyDirection(Direction.SELL);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
7
src/main/java/io/bitsquare/gui/trade/SellView.fxml
Normal file
7
src/main/java/io/bitsquare/gui/trade/SellView.fxml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.trade.SellController"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml"/>
|
174
src/main/java/io/bitsquare/gui/trade/TradeController.java
Normal file
174
src/main/java/io/bitsquare/gui/trade/TradeController.java
Normal file
@ -0,0 +1,174 @@
|
||||
package io.bitsquare.gui.trade;
|
||||
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.ValidatingTextField;
|
||||
import io.bitsquare.gui.trade.createoffer.CreateOfferController;
|
||||
import io.bitsquare.gui.trade.orderbook.OrderBookController;
|
||||
import io.bitsquare.gui.trade.takeoffer.TakerOfferController;
|
||||
import io.bitsquare.trade.Direction;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
public class TradeController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(TradeController.class);
|
||||
|
||||
protected OrderBookController orderBookController;
|
||||
protected CreateOfferController createOfferController;
|
||||
protected TakerOfferController takerOfferController;
|
||||
protected GuiceFXMLLoader orderBookLoader;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
loadViewAndGetChildController(NavigationItem.ORDER_BOOK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
applyDirection();
|
||||
|
||||
// TODO find better solution
|
||||
// Textfield focus out triggers validation, use runLater as quick fix...
|
||||
((TabPane) root).getSelectionModel().selectedIndexProperty().addListener((observableValue) -> Platform.runLater(() -> ValidatingTextField.hidePopover()));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
TabPane tabPane = (TabPane) root;
|
||||
if (navigationItem == NavigationItem.ORDER_BOOK)
|
||||
{
|
||||
checkArgument(orderBookLoader == null);
|
||||
// Orderbook must not be cached by GuiceFXMLLoader as we use 2 instances for sell and buy screens.
|
||||
orderBookLoader = new GuiceFXMLLoader(getClass().getResource(NavigationItem.ORDER_BOOK.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Parent view = orderBookLoader.load();
|
||||
final Tab tab = new Tab("Orderbook");
|
||||
tab.setClosable(false);
|
||||
tab.setContent(view);
|
||||
tabPane.getTabs().add(tab);
|
||||
} catch (IOException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
orderBookController = orderBookLoader.getController();
|
||||
orderBookController.setParentController(this);
|
||||
return orderBookController;
|
||||
}
|
||||
else if (navigationItem == NavigationItem.CREATE_OFFER)
|
||||
{
|
||||
checkArgument(createOfferController == null);
|
||||
|
||||
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times in different graphs
|
||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Parent view = loader.load();
|
||||
createOfferController = loader.getController();
|
||||
createOfferController.setParentController(this);
|
||||
final Tab tab = new Tab("Create offer");
|
||||
tab.setContent(view);
|
||||
tabPane.getTabs().add(tab);
|
||||
tabPane.getSelectionModel().select(tabPane.getTabs().size() - 1);
|
||||
return createOfferController;
|
||||
} catch (IOException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (navigationItem == NavigationItem.TAKE_OFFER)
|
||||
{
|
||||
checkArgument(takerOfferController == null);
|
||||
|
||||
// CreateOffer and TakeOffer must not be cached by GuiceFXMLLoader as we cannot use a view multiple times in different graphs
|
||||
GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
try
|
||||
{
|
||||
final Parent view = loader.load();
|
||||
takerOfferController = loader.getController();
|
||||
takerOfferController.setParentController(this);
|
||||
final Tab tab = new Tab("Take offer");
|
||||
tab.setContent(view);
|
||||
tabPane.getTabs().add(tab);
|
||||
tabPane.getSelectionModel().select(tabPane.getTabs().size() - 1);
|
||||
return takerOfferController;
|
||||
} catch (IOException e)
|
||||
{
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.error("navigationItem not supported: " + navigationItem);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void onCreateOfferViewRemoved()
|
||||
{
|
||||
createOfferController = null;
|
||||
|
||||
orderBookController.onCreateOfferViewRemoved();
|
||||
}
|
||||
|
||||
public void onTakeOfferViewRemoved()
|
||||
{
|
||||
takerOfferController = null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Template method to be overwritten by sub class.
|
||||
protected void applyDirection()
|
||||
{
|
||||
orderBookController.applyDirection(Direction.SELL);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,17 @@
|
||||
package io.bitsquare.gui.market.createOffer;
|
||||
package io.bitsquare.gui.trade.createoffer;
|
||||
|
||||
import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.Hibernate;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.components.ValidatingTextField;
|
||||
import io.bitsquare.gui.components.btc.AddressTextField;
|
||||
import io.bitsquare.gui.components.btc.BalanceTextField;
|
||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||
import io.bitsquare.gui.popups.Popups;
|
||||
import io.bitsquare.gui.trade.TradeController;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.gui.util.BtcValidator;
|
||||
import io.bitsquare.gui.util.FiatValidator;
|
||||
@ -32,7 +30,6 @@ import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TabPane;
|
||||
@ -43,35 +40,11 @@ import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Represents the visible state of the view
|
||||
*/
|
||||
class ViewModel
|
||||
{
|
||||
final StringProperty amount = new SimpleStringProperty();
|
||||
final StringProperty minAmount = new SimpleStringProperty();
|
||||
final StringProperty price = new SimpleStringProperty();
|
||||
final StringProperty volume = new SimpleStringProperty();
|
||||
final StringProperty collateral = new SimpleStringProperty();
|
||||
final StringProperty totals = new SimpleStringProperty();
|
||||
final StringProperty directionLabel = new SimpleStringProperty();
|
||||
final StringProperty collateralLabel = new SimpleStringProperty();
|
||||
final StringProperty feeLabel = new SimpleStringProperty();
|
||||
final StringProperty bankAccountType = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCurrency = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCounty = new SimpleStringProperty();
|
||||
final StringProperty acceptedCountries = new SimpleStringProperty();
|
||||
final StringProperty acceptedLanguages = new SimpleStringProperty();
|
||||
final StringProperty transactionId = new SimpleStringProperty();
|
||||
final BooleanProperty isOfferPlacedScreen = new SimpleBooleanProperty();
|
||||
final BooleanProperty isPlaceOfferButtonDisabled = new SimpleBooleanProperty(false);
|
||||
}
|
||||
|
||||
public class CreateOfferController implements Initializable, ChildController, Hibernate
|
||||
public class CreateOfferController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateOfferController.class);
|
||||
|
||||
private NavigationController navigationController;
|
||||
|
||||
private final TradeManager tradeManager;
|
||||
private final WalletFacade walletFacade;
|
||||
final ViewModel viewModel = new ViewModel();
|
||||
@ -90,6 +63,7 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
@FXML private AddressTextField addressTextField;
|
||||
@FXML private BalanceTextField balanceTextField;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -117,27 +91,14 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setOrderBookFilter(OrderBookFilter orderBookFilter)
|
||||
{
|
||||
direction = orderBookFilter.getDirection();
|
||||
|
||||
viewModel.directionLabel.set(BitSquareFormatter.formatDirection(direction, false) + ":");
|
||||
viewModel.amount.set(BitSquareFormatter.formatCoin(orderBookFilter.getAmount()));
|
||||
viewModel.minAmount.set(BitSquareFormatter.formatCoin(orderBookFilter.getAmount()));
|
||||
viewModel.price.set(BitSquareFormatter.formatPrice(orderBookFilter.getPrice()));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
//TODO just for dev testing
|
||||
if (BitSquare.fillFormsWithDummyData)
|
||||
{
|
||||
@ -145,7 +106,7 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
minAmountTextField.setText("0.1");
|
||||
priceTextField.setText("" + (int) (499 - new Random().nextDouble() * 1000 / 100));
|
||||
}
|
||||
|
||||
|
||||
setupBindings();
|
||||
setupValidation();
|
||||
|
||||
@ -160,6 +121,79 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
((TradeController) parentController).onCreateOfferViewRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setOrderBookFilter(OrderBookFilter orderBookFilter)
|
||||
{
|
||||
direction = orderBookFilter.getDirection();
|
||||
|
||||
viewModel.directionLabel.set(BitSquareFormatter.formatDirection(direction, false) + ":");
|
||||
viewModel.amount.set(BitSquareFormatter.formatCoin(orderBookFilter.getAmount()));
|
||||
viewModel.minAmount.set(BitSquareFormatter.formatCoin(orderBookFilter.getAmount()));
|
||||
viewModel.price.set(BitSquareFormatter.formatPrice(orderBookFilter.getPrice()));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI Handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@FXML
|
||||
public void onPlaceOffer()
|
||||
{
|
||||
amountTextField.reValidate();
|
||||
minAmountTextField.reValidate();
|
||||
volumeTextField.reValidate();
|
||||
priceTextField.reValidate();
|
||||
|
||||
//balanceTextField.getBalance()
|
||||
|
||||
if (amountTextField.getIsValid() && minAmountTextField.getIsValid() && volumeTextField.getIsValid() && amountTextField.getIsValid())
|
||||
{
|
||||
viewModel.isPlaceOfferButtonDisabled.set(true);
|
||||
|
||||
tradeManager.requestPlaceOffer(direction,
|
||||
BitSquareFormatter.parseToDouble(viewModel.price.get()),
|
||||
BitSquareFormatter.parseToCoin(viewModel.amount.get()),
|
||||
BitSquareFormatter.parseToCoin(viewModel.minAmount.get()),
|
||||
(transaction) -> {
|
||||
viewModel.isOfferPlacedScreen.set(true);
|
||||
viewModel.transactionId.set(transaction.getHashAsString());
|
||||
},
|
||||
errorMessage -> {
|
||||
Popups.openErrorPopup("An error occurred", errorMessage);
|
||||
viewModel.isPlaceOfferButtonDisabled.set(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onClose()
|
||||
{
|
||||
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
||||
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private Methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void setupBindings()
|
||||
{
|
||||
viewModel.amount.addListener((ov, oldValue, newValue) -> {
|
||||
@ -264,80 +298,28 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
volumeTextField.reValidate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
this.navigationController = navigationController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Hibernate
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void sleep()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awake()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI Handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@FXML
|
||||
public void onPlaceOffer()
|
||||
{
|
||||
amountTextField.reValidate();
|
||||
minAmountTextField.reValidate();
|
||||
volumeTextField.reValidate();
|
||||
priceTextField.reValidate();
|
||||
|
||||
//balanceTextField.getBalance()
|
||||
|
||||
if (amountTextField.getIsValid() && minAmountTextField.getIsValid() && volumeTextField.getIsValid() && amountTextField.getIsValid())
|
||||
{
|
||||
viewModel.isPlaceOfferButtonDisabled.set(true);
|
||||
|
||||
tradeManager.requestPlaceOffer(direction,
|
||||
BitSquareFormatter.parseToDouble(viewModel.price.get()),
|
||||
BitSquareFormatter.parseToCoin(viewModel.amount.get()),
|
||||
BitSquareFormatter.parseToCoin(viewModel.minAmount.get()),
|
||||
(transaction) -> {
|
||||
viewModel.isOfferPlacedScreen.set(true);
|
||||
viewModel.transactionId.set(transaction.getHashAsString());
|
||||
},
|
||||
errorMessage -> {
|
||||
Popups.openErrorPopup("An error occurred", errorMessage);
|
||||
viewModel.isPlaceOfferButtonDisabled.set(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onClose()
|
||||
{
|
||||
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
||||
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
||||
|
||||
navigationController.navigateToView(NavigationItem.ORDER_BOOK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the visible state of the view
|
||||
*/
|
||||
class ViewModel
|
||||
{
|
||||
final StringProperty amount = new SimpleStringProperty();
|
||||
final StringProperty minAmount = new SimpleStringProperty();
|
||||
final StringProperty price = new SimpleStringProperty();
|
||||
final StringProperty volume = new SimpleStringProperty();
|
||||
final StringProperty collateral = new SimpleStringProperty();
|
||||
final StringProperty totals = new SimpleStringProperty();
|
||||
final StringProperty directionLabel = new SimpleStringProperty();
|
||||
final StringProperty collateralLabel = new SimpleStringProperty();
|
||||
final StringProperty feeLabel = new SimpleStringProperty();
|
||||
final StringProperty bankAccountType = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCurrency = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCounty = new SimpleStringProperty();
|
||||
final StringProperty acceptedCountries = new SimpleStringProperty();
|
||||
final StringProperty acceptedLanguages = new SimpleStringProperty();
|
||||
final StringProperty transactionId = new SimpleStringProperty();
|
||||
final BooleanProperty isOfferPlacedScreen = new SimpleBooleanProperty();
|
||||
final BooleanProperty isPlaceOfferButtonDisabled = new SimpleBooleanProperty(false);
|
||||
}
|
@ -7,8 +7,9 @@
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane fx:id="rootContainer" prefHeight="500" prefWidth="800" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"
|
||||
AnchorPane.topAnchor="10.0" xmlns="http://javafx.com/javafx/8" fx:controller="io.bitsquare.gui.market.createOffer.CreateOfferController" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.trade.createoffer.CreateOfferController"
|
||||
prefHeight="500" prefWidth="800" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<GridPane hgap="5.0" vgap="5.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.bitsquare.gui.market.orderbook;
|
||||
package io.bitsquare.gui.trade.orderbook;
|
||||
|
||||
import com.google.bitcoin.core.Coin;
|
||||
import com.google.bitcoin.core.InsufficientMoneyException;
|
||||
@ -7,13 +7,13 @@ import com.google.common.util.concurrent.FutureCallback;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.MainController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.market.createOffer.CreateOfferController;
|
||||
import io.bitsquare.gui.market.trade.TakerOfferController;
|
||||
import io.bitsquare.gui.popups.Popups;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.trade.createoffer.CreateOfferController;
|
||||
import io.bitsquare.gui.trade.takeoffer.TakerOfferController;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.locale.Country;
|
||||
@ -39,12 +39,10 @@ import javafx.animation.AnimationTimer;
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.collections.transformation.SortedList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.util.Callback;
|
||||
import javax.inject.Inject;
|
||||
@ -54,9 +52,10 @@ import org.controlsfx.dialog.Dialogs;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OrderBookController implements Initializable, ChildController
|
||||
public class OrderBookController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderBookController.class);
|
||||
|
||||
private final OrderBook orderBook;
|
||||
private final OrderBookFilter orderBookFilter;
|
||||
private final User user;
|
||||
@ -65,26 +64,18 @@ public class OrderBookController implements Initializable, ChildController
|
||||
private final Settings settings;
|
||||
private final Persistence persistence;
|
||||
|
||||
private SortedList<OrderBookListItem> offerList;
|
||||
private AnimationTimer pollingTimer;
|
||||
|
||||
private final Image buyIcon = ImageUtil.getIconImage(ImageUtil.BUY);
|
||||
private final Image sellIcon = ImageUtil.getIconImage(ImageUtil.SELL);
|
||||
@FXML
|
||||
public AnchorPane holderPane;
|
||||
@FXML
|
||||
public HBox topHBox;
|
||||
@FXML
|
||||
public TextField volume, amount, price;
|
||||
@FXML
|
||||
public TableView<OrderBookListItem> orderBookTable;
|
||||
@FXML
|
||||
public TableColumn<OrderBookListItem, String> priceColumn, amountColumn, volumeColumn;
|
||||
@FXML
|
||||
public Button createOfferButton;
|
||||
private NavigationController navigationController;
|
||||
private SortedList<OrderBookListItem> offerList;
|
||||
|
||||
private AnimationTimer pollingTimer;
|
||||
@FXML
|
||||
private TableColumn<String, OrderBookListItem> directionColumn, countryColumn, bankAccountTypeColumn;
|
||||
@FXML public HBox topHBox;
|
||||
@FXML public TextField volume, amount, price;
|
||||
@FXML public TableView<OrderBookListItem> orderBookTable;
|
||||
@FXML public TableColumn<OrderBookListItem, String> priceColumn, amountColumn, volumeColumn;
|
||||
@FXML public Button createOfferButton;
|
||||
@FXML private TableColumn<String, OrderBookListItem> directionColumn, countryColumn, bankAccountTypeColumn;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -106,18 +97,66 @@ public class OrderBookController implements Initializable, ChildController
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
// init table
|
||||
setCountryColumnCellFactory();
|
||||
setBankAccountTypeColumnCellFactory();
|
||||
setDirectionColumnCellFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
|
||||
orderBook.cleanup();
|
||||
|
||||
orderBookTable.setItems(null);
|
||||
orderBookTable.getSortOrder().clear();
|
||||
offerList.comparatorProperty().unbind();
|
||||
|
||||
if (pollingTimer != null)
|
||||
{
|
||||
pollingTimer.stop();
|
||||
pollingTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Navigation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(ViewController parentController)
|
||||
{
|
||||
super.setParentController(parentController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void init()
|
||||
{
|
||||
orderBook.init();
|
||||
@ -151,33 +190,6 @@ public class OrderBookController implements Initializable, ChildController
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
this.navigationController = navigationController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
orderBook.cleanup();
|
||||
|
||||
orderBookTable.setItems(null);
|
||||
orderBookTable.getSortOrder().clear();
|
||||
offerList.comparatorProperty().unbind();
|
||||
|
||||
if (pollingTimer != null)
|
||||
{
|
||||
pollingTimer.stop();
|
||||
pollingTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -191,6 +203,35 @@ public class OrderBookController implements Initializable, ChildController
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@FXML
|
||||
public void createOffer()
|
||||
{
|
||||
if (isRegistered())
|
||||
{
|
||||
createOfferButton.setDisable(true);
|
||||
/* if (walletFacade.isUnusedTradeAddressBalanceAboveCreationFee())
|
||||
{ */
|
||||
ViewController nextController = parentController.loadViewAndGetChildController(NavigationItem.CREATE_OFFER);
|
||||
if (nextController != null)
|
||||
((CreateOfferController) nextController).setOrderBookFilter(orderBookFilter);
|
||||
/* }
|
||||
else
|
||||
{
|
||||
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)
|
||||
MainController.GET_INSTANCE().navigateToView(NavigationItem.FUNDS);
|
||||
} */
|
||||
}
|
||||
else
|
||||
{
|
||||
showRegistrationDialog();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -227,7 +268,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||
"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)
|
||||
{
|
||||
MainController.GET_INSTANCE().navigateToView(NavigationItem.FUNDS);
|
||||
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.FUNDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,7 +278,7 @@ public class OrderBookController implements Initializable, ChildController
|
||||
"You have not funded the full registration fee of " + BitSquareFormatter.formatCoinWithCode(FeePolicy.ACCOUNT_REGISTRATION_FEE) + " BTC.");
|
||||
if (response == Dialog.Actions.OK)
|
||||
{
|
||||
MainController.GET_INSTANCE().navigateToView(NavigationItem.FUNDS);
|
||||
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.FUNDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -267,11 +308,11 @@ public class OrderBookController implements Initializable, ChildController
|
||||
selectedIndex);
|
||||
if (registrationMissingAction == settingsCommandLink)
|
||||
{
|
||||
MainController.GET_INSTANCE().navigateToView(NavigationItem.SETTINGS);
|
||||
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.SETTINGS);
|
||||
}
|
||||
else if (registrationMissingAction == depositFeeCommandLink)
|
||||
{
|
||||
MainController.GET_INSTANCE().navigateToView(NavigationItem.FUNDS);
|
||||
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.FUNDS);
|
||||
}
|
||||
else if (registrationMissingAction == sendRegistrationCommandLink)
|
||||
{
|
||||
@ -315,35 +356,11 @@ public class OrderBookController implements Initializable, ChildController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createOffer()
|
||||
{
|
||||
if (isRegistered())
|
||||
{
|
||||
/* if (walletFacade.isUnusedTradeAddressBalanceAboveCreationFee())
|
||||
{ */
|
||||
ChildController nextController = navigationController.navigateToView(NavigationItem.CREATE_OFFER);
|
||||
if (nextController != null)
|
||||
((CreateOfferController) nextController).setOrderBookFilter(orderBookFilter);
|
||||
/* }
|
||||
else
|
||||
{
|
||||
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)
|
||||
MainController.GET_INSTANCE().navigateToView(NavigationItem.FUNDS);
|
||||
} */
|
||||
}
|
||||
else
|
||||
{
|
||||
showRegistrationDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void takeOffer(Offer offer)
|
||||
{
|
||||
if (isRegistered())
|
||||
{
|
||||
TakerOfferController takerOfferController = (TakerOfferController) navigationController.navigateToView(NavigationItem.TAKE_OFFER);
|
||||
TakerOfferController takerOfferController = (TakerOfferController) parentController.loadViewAndGetChildController(NavigationItem.TAKE_OFFER);
|
||||
|
||||
Coin requestedAmount;
|
||||
if (!"".equals(amount.getText()))
|
||||
@ -580,5 +597,13 @@ public class OrderBookController implements Initializable, ChildController
|
||||
double p = textInputToNumber(price.getText(), price.getText());
|
||||
volume.setText(BitSquareFormatter.formatPrice(a * p));
|
||||
}
|
||||
|
||||
|
||||
public void onCreateOfferViewRemoved()
|
||||
{
|
||||
createOfferButton.setDisable(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.bitsquare.gui.market.orderbook;
|
||||
package io.bitsquare.gui.trade.orderbook;
|
||||
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.trade.Offer;
|
@ -4,9 +4,9 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="holderPane" AnchorPane.bottomAnchor="0.0"
|
||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
fx:controller="io.bitsquare.gui.market.orderbook.OrderBookController">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.trade.orderbook.OrderBookController"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
|
||||
<HBox fx:id="topHBox" prefHeight="22.0" AnchorPane.topAnchor="10.0" AnchorPane.leftAnchor="10.0"
|
||||
AnchorPane.rightAnchor="10.0">
|
||||
@ -37,8 +37,7 @@
|
||||
</Label>
|
||||
</HBox>
|
||||
|
||||
<Button fx:id="createOfferButton" text="Create new offer" AnchorPane.topAnchor="10.0"
|
||||
AnchorPane.rightAnchor="10.0"/>
|
||||
<Button fx:id="createOfferButton" text="Create new offer" onAction="#createOffer" AnchorPane.topAnchor="10.0" AnchorPane.rightAnchor="10.0"/>
|
||||
|
||||
<TableView fx:id="orderBookTable" AnchorPane.leftAnchor="10.0"
|
||||
AnchorPane.topAnchor="45.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
|
@ -4,8 +4,7 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:id="rootContainer"
|
||||
fx:controller="io.bitsquare.gui.market.trade.TakerOfferController">
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.trade.takeoffer.TakerOfferController" xmlns:fx="http://javafx.com/fxml">
|
||||
<Accordion fx:id="accordion" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
|
||||
<panes>
|
||||
|
@ -1,17 +1,15 @@
|
||||
package io.bitsquare.gui.market.trade;
|
||||
package io.bitsquare.gui.trade.takeoffer;
|
||||
|
||||
import com.google.bitcoin.core.Coin;
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.ChildController;
|
||||
import io.bitsquare.gui.NavigationController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.components.ValidatedTextField;
|
||||
import io.bitsquare.gui.popups.Popups;
|
||||
import io.bitsquare.gui.trade.TradeController;
|
||||
import io.bitsquare.gui.util.BitSquareFormatter;
|
||||
import io.bitsquare.gui.util.BitSquareValidator;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.trade.Offer;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.TradeManager;
|
||||
@ -20,31 +18,24 @@ import io.bitsquare.trade.protocol.taker.ProtocolForTakerAsSellerListener;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
public class TakerOfferController implements Initializable, ChildController
|
||||
public class TakerOfferController extends CachedViewController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(TakerOfferController.class);
|
||||
|
||||
private final TradeManager tradeManager;
|
||||
private final WalletFacade walletFacade;
|
||||
private final MessageFacade messageFacade;
|
||||
|
||||
|
||||
private NavigationController navigationController;
|
||||
private Offer offer;
|
||||
private Coin requestedAmount;
|
||||
private String tradeId;
|
||||
private String depositTxId;
|
||||
|
||||
@FXML
|
||||
private AnchorPane rootContainer;
|
||||
@FXML
|
||||
private Accordion accordion;
|
||||
@FXML
|
||||
@ -65,11 +56,36 @@ public class TakerOfferController implements Initializable, ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
private TakerOfferController(TradeManager tradeManager, WalletFacade walletFacade, MessageFacade messageFacade)
|
||||
private TakerOfferController(TradeManager tradeManager, WalletFacade walletFacade)
|
||||
{
|
||||
this.tradeManager = tradeManager;
|
||||
this.walletFacade = walletFacade;
|
||||
this.messageFacade = messageFacade;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Lifecycle
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
accordion.setExpandedPane(takeOfferTitledPane);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
super.deactivate();
|
||||
((TradeController) parentController).onTakeOfferViewRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
}
|
||||
|
||||
|
||||
@ -88,16 +104,6 @@ public class TakerOfferController implements Initializable, ChildController
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: Initializable
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
accordion.setExpandedPane(takeOfferTitledPane);
|
||||
}
|
||||
|
||||
public void applyData()
|
||||
{
|
||||
amountTextField.setText(requestedAmount.toPlainString());
|
||||
@ -127,22 +133,6 @@ public class TakerOfferController implements Initializable, ChildController
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface implementation: ChildController
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setNavigationController(NavigationController navigationController)
|
||||
{
|
||||
this.navigationController = navigationController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GUI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -248,10 +238,8 @@ public class TakerOfferController implements Initializable, ChildController
|
||||
@FXML
|
||||
public void onClose()
|
||||
{
|
||||
TabPane tabPane = ((TabPane) (rootContainer.getParent().getParent()));
|
||||
TabPane tabPane = ((TabPane) (root.getParent().getParent()));
|
||||
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
|
||||
|
||||
navigationController.navigateToView(NavigationItem.ORDER_BOOK);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
@ -7,7 +7,7 @@ import com.google.bitcoin.core.Utils;
|
||||
import io.bitsquare.btc.BlockChainFacade;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.crypto.CryptoFacade;
|
||||
import io.bitsquare.gui.popups.Popups;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.msg.listeners.TakeOfferRequestListener;
|
||||
import io.bitsquare.settings.Settings;
|
||||
@ -193,7 +193,7 @@ public class TradeManager
|
||||
}
|
||||
|
||||
public void removeOffer(Offer offer)
|
||||
{
|
||||
{
|
||||
if (!offers.containsKey(offer.getId()))
|
||||
{
|
||||
throw new IllegalStateException("offers does not contain the offer with the ID " + offer.getId());
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.bitsquare.trade.orderbook;
|
||||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.gui.market.orderbook.OrderBookListItem;
|
||||
import io.bitsquare.gui.trade.orderbook.OrderBookListItem;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
|
@ -1,35 +0,0 @@
|
||||
package io.bitsquare.util;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Menu;
|
||||
import javafx.scene.control.MenuBar;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
public class Controller implements Initializable
|
||||
{
|
||||
|
||||
public GridPane root;
|
||||
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
BorderPane borderPane = new BorderPane();
|
||||
Text text = new Text("BEFORE");
|
||||
borderPane.setCenter(text);
|
||||
|
||||
MenuBar menuBar = new MenuBar();
|
||||
Menu mainMenu = new Menu("File");
|
||||
MenuItem exitCmd = new MenuItem("Exit");
|
||||
MenuItem textCmd = new MenuItem("Colour Text");
|
||||
mainMenu.getItems().addAll(textCmd, exitCmd);
|
||||
// borderPane.setTop(menuBar);
|
||||
|
||||
root.getChildren().addAll(menuBar);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user