mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-13 11:09:10 +01:00
Move arbitration screens to new account tab
This commit is contained in:
parent
9ea6fb9b55
commit
87d89f2dc6
16 changed files with 266 additions and 107 deletions
|
@ -125,8 +125,14 @@ public class BitSquare extends Application {
|
||||||
setupCloseHandlers(primaryStage, scene);
|
setupCloseHandlers(primaryStage, scene);
|
||||||
|
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
|
|
||||||
|
// TODO resizing not fully supported yet
|
||||||
|
/*
|
||||||
primaryStage.setMinWidth(750);
|
primaryStage.setMinWidth(750);
|
||||||
primaryStage.setMinHeight(500);
|
primaryStage.setMinHeight(500);*/
|
||||||
|
|
||||||
|
primaryStage.setMinWidth(1000);
|
||||||
|
primaryStage.setMinHeight(750);
|
||||||
|
|
||||||
Profiler.initScene(primaryStage.getScene());
|
Profiler.initScene(primaryStage.getScene());
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,7 @@ public class Navigation {
|
||||||
// account
|
// account
|
||||||
ACCOUNT_SETUP("/io/bitsquare/gui/main/account/setup/AccountSetupView.fxml"),
|
ACCOUNT_SETUP("/io/bitsquare/gui/main/account/setup/AccountSetupView.fxml"),
|
||||||
ACCOUNT_SETTINGS("/io/bitsquare/gui/main/account/settings/AccountSettingsView.fxml"),
|
ACCOUNT_SETTINGS("/io/bitsquare/gui/main/account/settings/AccountSettingsView.fxml"),
|
||||||
|
ARBITRATOR_SETTINGS("/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsView.fxml"),
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -206,9 +207,11 @@ public class Navigation {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// arbitrator
|
// arbitrator
|
||||||
ARBITRATOR_PROFILE("/io/bitsquare/gui/main/arbitrators/profile/ArbitratorProfileView.fxml"),
|
|
||||||
ARBITRATOR_BROWSER("/io/bitsquare/gui/main/arbitrators/browser/ArbitratorBrowserView.fxml"),
|
ARBITRATOR_PROFILE("/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileView.fxml"),
|
||||||
ARBITRATOR_REGISTRATION("/io/bitsquare/gui/main/arbitrators/registration/ArbitratorRegistrationView.fxml");
|
ARBITRATOR_BROWSER("/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserView.fxml"),
|
||||||
|
ARBITRATOR_REGISTRATION("/io/bitsquare/gui/main/account/arbitrator/registration/ArbitratorRegistrationView" +
|
||||||
|
".fxml");
|
||||||
|
|
||||||
|
|
||||||
private final String fxmlUrl;
|
private final String fxmlUrl;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
|
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
|
||||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
||||||
<Tab fx:id="tab" closable="false">
|
<Tab fx:id="accountSettingsTab" closable="false"/>
|
||||||
|
<Tab fx:id="arbitratorSettingsTab" text="Arbitrator settings" closable="false"/>
|
||||||
|
|
||||||
</Tab>
|
|
||||||
</TabPane>
|
</TabPane>
|
|
@ -30,10 +30,11 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.*;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.*;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -43,9 +44,11 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(AccountViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(AccountViewCB.class);
|
||||||
|
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
private Navigation.Listener listener;
|
private Navigation.Listener navigationListener;
|
||||||
|
|
||||||
@FXML Tab tab;
|
private ChangeListener<Tab> tabChangeListener;
|
||||||
|
|
||||||
|
@FXML Tab accountSettingsTab, arbitratorSettingsTab;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -66,13 +69,23 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
listener = navigationItems -> {
|
navigationListener = navigationItems -> {
|
||||||
if (navigationItems != null &&
|
if (navigationItems != null &&
|
||||||
navigationItems.length == 3 &&
|
navigationItems.length == 3 &&
|
||||||
navigationItems[1] == Navigation.Item.ACCOUNT)
|
navigationItems[1] == Navigation.Item.ACCOUNT)
|
||||||
loadView(navigationItems[2]);
|
loadView(navigationItems[2]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||||
|
if (newValue == accountSettingsTab)
|
||||||
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
||||||
|
Navigation.Item.ACCOUNT_SETTINGS);
|
||||||
|
else
|
||||||
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
||||||
|
Navigation.Item.ARBITRATOR_SETTINGS);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
super.initialize(url, rb);
|
super.initialize(url, rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,16 +93,23 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
|
||||||
public void activate() {
|
public void activate() {
|
||||||
super.activate();
|
super.activate();
|
||||||
|
|
||||||
navigation.addListener(listener);
|
navigation.addListener(navigationListener);
|
||||||
|
((TabPane) root).getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||||
|
|
||||||
if (navigation.getCurrentItems().length == 2 &&
|
if (navigation.getCurrentItems().length == 2 &&
|
||||||
navigation.getCurrentItems()[1] == Navigation.Item.ACCOUNT) {
|
navigation.getCurrentItems()[1] == Navigation.Item.ACCOUNT) {
|
||||||
if (presentationModel.getNeedRegistration())
|
if (presentationModel.getNeedRegistration()) {
|
||||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
||||||
Navigation.Item.ACCOUNT_SETUP);
|
Navigation.Item.ACCOUNT_SETUP);
|
||||||
else
|
}
|
||||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
else {
|
||||||
Navigation.Item.ACCOUNT_SETTINGS);
|
if (((TabPane) root).getSelectionModel().getSelectedItem() == accountSettingsTab)
|
||||||
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
||||||
|
Navigation.Item.ACCOUNT_SETTINGS);
|
||||||
|
else
|
||||||
|
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ACCOUNT,
|
||||||
|
Navigation.Item.ARBITRATOR_SETTINGS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +117,8 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
|
||||||
public void deactivate() {
|
public void deactivate() {
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
|
|
||||||
navigation.removeListener(listener);
|
navigation.removeListener(navigationListener);
|
||||||
|
((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("EmptyMethod")
|
@SuppressWarnings("EmptyMethod")
|
||||||
|
@ -115,11 +136,25 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
|
||||||
protected Initializable loadView(Navigation.Item navigationItem) {
|
protected Initializable loadView(Navigation.Item navigationItem) {
|
||||||
super.loadView(navigationItem);
|
super.loadView(navigationItem);
|
||||||
|
|
||||||
tab.setText((navigationItem == Navigation.Item.ACCOUNT_SETUP) ? "Account setup" : "Account settings");
|
|
||||||
final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
||||||
try {
|
try {
|
||||||
AnchorPane view = loader.load();
|
Node view = loader.load();
|
||||||
|
Tab tab = null;
|
||||||
|
switch (navigationItem) {
|
||||||
|
case ACCOUNT_SETTINGS:
|
||||||
|
tab = accountSettingsTab;
|
||||||
|
tab.setText("Account settings");
|
||||||
|
case ACCOUNT_SETUP:
|
||||||
|
tab = accountSettingsTab;
|
||||||
|
tab.setText("Account setup");
|
||||||
|
break;
|
||||||
|
case ARBITRATOR_SETTINGS:
|
||||||
|
tab = arbitratorSettingsTab;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
tab.setContent(view);
|
tab.setContent(view);
|
||||||
|
((TabPane) root).getSelectionModel().select(tab);
|
||||||
Initializable childController = loader.getController();
|
Initializable childController = loader.getController();
|
||||||
((ViewCB) childController).setParent(this);
|
((ViewCB) childController).setParent(this);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ This file is part of Bitsquare.
|
||||||
|
~
|
||||||
|
~ Bitsquare is free software: you can redistribute it and/or modify it
|
||||||
|
~ under the terms of the GNU Affero General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
~ your option) any later version.
|
||||||
|
~
|
||||||
|
~ Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||||
|
~ License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU Affero General Public License
|
||||||
|
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.main.account.arbitrator.ArbitratorSettingsViewCB"
|
||||||
|
prefHeight="660.0" prefWidth="1000.0"
|
||||||
|
xmlns:fx="http://javafx.com/fxml">
|
||||||
|
<VBox spacing="20">
|
||||||
|
<padding>
|
||||||
|
<Insets left="10" top="10" right="10"/>
|
||||||
|
</padding>
|
||||||
|
<Label text="TODO: Just very basic prototype yet..."/>
|
||||||
|
<Button text="Register yourself as an arbitrator" onAction="#onArbitratorRegistration"/>
|
||||||
|
<Button text="Edit my arbitrator details" onAction="#onArbitratorEdit"/>
|
||||||
|
</VBox>
|
||||||
|
</AnchorPane>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Bitsquare.
|
||||||
|
*
|
||||||
|
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.bitsquare.gui.main.account.arbitrator;
|
||||||
|
|
||||||
|
import io.bitsquare.BitSquare;
|
||||||
|
import io.bitsquare.gui.CachedViewCB;
|
||||||
|
import io.bitsquare.gui.Navigation;
|
||||||
|
import io.bitsquare.gui.main.account.arbitrator.registration.ArbitratorRegistrationViewCB;
|
||||||
|
import io.bitsquare.util.ViewLoader;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.*;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
// TODO Arbitration is very basic yet
|
||||||
|
public class ArbitratorSettingsViewCB extends CachedViewCB {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ArbitratorSettingsViewCB.class);
|
||||||
|
|
||||||
|
private Navigation navigation;
|
||||||
|
|
||||||
|
private ArbitratorRegistrationViewCB arbitratorRegistrationViewCB;
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Constructor
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ArbitratorSettingsViewCB(Navigation navigation) {
|
||||||
|
super();
|
||||||
|
this.navigation = navigation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Lifecycle
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@SuppressWarnings("EmptyMethod")
|
||||||
|
@Override
|
||||||
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
|
super.initialize(url, rb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("EmptyMethod")
|
||||||
|
@Override
|
||||||
|
public void deactivate() {
|
||||||
|
super.deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("EmptyMethod")
|
||||||
|
@Override
|
||||||
|
public void activate() {
|
||||||
|
super.activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("EmptyMethod")
|
||||||
|
@Override
|
||||||
|
public void terminate() {
|
||||||
|
super.terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Navigation
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Initializable loadView(Navigation.Item navigationItem) {
|
||||||
|
// don't use caching here, cause exc. -> need to investigate and is rarely called so no caching is better
|
||||||
|
final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||||
|
try {
|
||||||
|
final Parent view = loader.load();
|
||||||
|
arbitratorRegistrationViewCB = loader.getController();
|
||||||
|
|
||||||
|
final Stage rootStage = BitSquare.getPrimaryStage();
|
||||||
|
final Stage stage = new Stage();
|
||||||
|
stage.setTitle("Arbitrator");
|
||||||
|
stage.setMinWidth(800);
|
||||||
|
stage.setMinHeight(400);
|
||||||
|
stage.setWidth(800);
|
||||||
|
stage.setHeight(600);
|
||||||
|
stage.setX(rootStage.getX() + 50);
|
||||||
|
stage.setY(rootStage.getY() + 50);
|
||||||
|
stage.initModality(Modality.WINDOW_MODAL);
|
||||||
|
stage.initOwner(rootStage);
|
||||||
|
Scene scene = new Scene(view, 800, 600);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
|
||||||
|
return arbitratorRegistrationViewCB;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// UI Handlers
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onArbitratorRegistration() {
|
||||||
|
loadView(Navigation.Item.ARBITRATOR_REGISTRATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onArbitratorEdit() {
|
||||||
|
loadView(Navigation.Item.ARBITRATOR_REGISTRATION);
|
||||||
|
arbitratorRegistrationViewCB.setEditMode(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.main.arbitrators.browser.ArbitratorBrowserViewCB"
|
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.main.account.arbitrator.browser.ArbitratorBrowserViewCB"
|
||||||
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
||||||
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
|
@ -15,13 +15,13 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.main.arbitrators.browser;
|
package io.bitsquare.gui.main.account.arbitrator.browser;
|
||||||
|
|
||||||
import io.bitsquare.arbitrator.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.gui.CachedViewCB;
|
import io.bitsquare.gui.CachedViewCB;
|
||||||
import io.bitsquare.gui.Navigation;
|
import io.bitsquare.gui.Navigation;
|
||||||
import io.bitsquare.gui.ViewCB;
|
import io.bitsquare.gui.ViewCB;
|
||||||
import io.bitsquare.gui.main.arbitrators.profile.ArbitratorProfileViewCB;
|
import io.bitsquare.gui.main.account.arbitrator.profile.ArbitratorProfileViewCB;
|
||||||
import io.bitsquare.locale.LanguageUtil;
|
import io.bitsquare.locale.LanguageUtil;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.msg.listeners.ArbitratorListener;
|
import io.bitsquare.msg.listeners.ArbitratorListener;
|
||||||
|
@ -49,14 +49,13 @@ import javafx.stage.Stage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
// TODO Arbitration is very basic yet
|
||||||
* Arbitration is not much developed yet
|
|
||||||
*/
|
|
||||||
public class ArbitratorBrowserViewCB extends CachedViewCB implements ArbitratorListener {
|
public class ArbitratorBrowserViewCB extends CachedViewCB implements ArbitratorListener {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ArbitratorBrowserViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(ArbitratorBrowserViewCB.class);
|
||||||
|
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
private final Persistence persistence;
|
private final Persistence persistence;
|
||||||
|
private MessageFacade messageFacade;
|
||||||
|
|
||||||
private final List<Arbitrator> allArbitrators = new ArrayList<>();
|
private final List<Arbitrator> allArbitrators = new ArrayList<>();
|
||||||
private Arbitrator currentArbitrator;
|
private Arbitrator currentArbitrator;
|
||||||
|
@ -72,12 +71,9 @@ public class ArbitratorBrowserViewCB extends CachedViewCB implements ArbitratorL
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ArbitratorBrowserViewCB(Settings settings, Persistence persistence, MessageFacade messageFacade) {
|
public ArbitratorBrowserViewCB(Settings settings, Persistence persistence, MessageFacade messageFacade) {
|
||||||
|
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.persistence = persistence;
|
this.persistence = persistence;
|
||||||
|
this.messageFacade = messageFacade;
|
||||||
messageFacade.addArbitratorListener(this);
|
|
||||||
messageFacade.getArbitrators(LanguageUtil.getDefaultLanguageLocale());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,10 +83,14 @@ public class ArbitratorBrowserViewCB extends CachedViewCB implements ArbitratorL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
super.initialize(url, rb);
|
messageFacade.addArbitratorListener(this);
|
||||||
|
messageFacade.getArbitrators(LanguageUtil.getDefaultLanguageLocale());
|
||||||
|
|
||||||
loadView(Navigation.Item.ARBITRATOR_PROFILE);
|
loadView(Navigation.Item.ARBITRATOR_PROFILE);
|
||||||
checkButtonState();
|
checkButtonState();
|
||||||
|
|
||||||
|
super.initialize(url, rb);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("EmptyMethod")
|
@SuppressWarnings("EmptyMethod")
|
|
@ -19,7 +19,7 @@
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.arbitrators.profile.ArbitratorProfileViewCB"
|
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.account.arbitrator.profile.ArbitratorProfileViewCB"
|
||||||
hgap="5.0" vgap="5.0" AnchorPane.bottomAnchor="80.0" AnchorPane.leftAnchor="10.0"
|
hgap="5.0" vgap="5.0" AnchorPane.bottomAnchor="80.0" AnchorPane.leftAnchor="10.0"
|
||||||
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.main.arbitrators.profile;
|
package io.bitsquare.gui.main.account.arbitrator.profile;
|
||||||
|
|
||||||
import io.bitsquare.arbitrator.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.gui.CachedViewCB;
|
import io.bitsquare.gui.CachedViewCB;
|
||||||
|
@ -32,7 +32,7 @@ import javax.inject.Inject;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
// Arbitration is not much developed yet
|
// TODO Arbitration is very basic yet
|
||||||
public class ArbitratorProfileViewCB extends CachedViewCB {
|
public class ArbitratorProfileViewCB extends CachedViewCB {
|
||||||
|
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
|
@ -98,7 +98,7 @@ public class ArbitratorProfileViewCB extends CachedViewCB {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public void applyArbitrator(Arbitrator arbitrator) {
|
public void applyArbitrator(Arbitrator arbitrator) {
|
||||||
if (arbitrator != null) {
|
if (arbitrator != null && arbitrator.getIdType() != null) {
|
||||||
String name = "";
|
String name = "";
|
||||||
switch (arbitrator.getIdType()) {
|
switch (arbitrator.getIdType()) {
|
||||||
case REAL_LIFE_ID:
|
case REAL_LIFE_ID:
|
|
@ -20,7 +20,8 @@
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.main.arbitrators.registration.ArbitratorRegistrationViewCB"
|
<AnchorPane fx:id="root"
|
||||||
|
fx:controller="io.bitsquare.gui.main.account.arbitrator.registration.ArbitratorRegistrationViewCB"
|
||||||
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
prefHeight="600" prefWidth="800" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="10.0"
|
||||||
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||||
xmlns:fx="http://javafx.com/fxml">
|
xmlns:fx="http://javafx.com/fxml">
|
|
@ -15,14 +15,14 @@
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.bitsquare.gui.main.arbitrators.registration;
|
package io.bitsquare.gui.main.account.arbitrator.registration;
|
||||||
|
|
||||||
import io.bitsquare.arbitrator.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.arbitrator.Reputation;
|
import io.bitsquare.arbitrator.Reputation;
|
||||||
import io.bitsquare.btc.WalletFacade;
|
import io.bitsquare.btc.WalletFacade;
|
||||||
import io.bitsquare.gui.CachedViewCB;
|
import io.bitsquare.gui.CachedViewCB;
|
||||||
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
|
||||||
import io.bitsquare.gui.main.arbitrators.profile.ArbitratorProfileViewCB;
|
import io.bitsquare.gui.main.account.arbitrator.profile.ArbitratorProfileViewCB;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.locale.BSResources;
|
import io.bitsquare.locale.BSResources;
|
||||||
import io.bitsquare.locale.LanguageUtil;
|
import io.bitsquare.locale.LanguageUtil;
|
||||||
|
@ -61,7 +61,7 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
// Arbitration is not much developed yet
|
// TODO Arbitration is very basic yet
|
||||||
public class ArbitratorRegistrationViewCB extends CachedViewCB {
|
public class ArbitratorRegistrationViewCB extends CachedViewCB {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ArbitratorRegistrationViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(ArbitratorRegistrationViewCB.class);
|
||||||
|
|
|
@ -29,10 +29,7 @@
|
||||||
<padding>
|
<padding>
|
||||||
<Insets left="10" top="10" right="10"/>
|
<Insets left="10" top="10" right="10"/>
|
||||||
</padding>
|
</padding>
|
||||||
<Label
|
<Label text="TODO: Overview"/>
|
||||||
text="TODO: Overview section. The buttons here are just temporary for accessing the arbitration management system."/>
|
|
||||||
<Button text="Register yourself as an arbitrator" onAction="#onArbitratorRegistration"/>
|
|
||||||
<Button text="Edit my arbitrator details" onAction="#onArbitratorEdit"/>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
</Tab>
|
</Tab>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
|
|
@ -17,24 +17,12 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.home;
|
package io.bitsquare.gui.main.home;
|
||||||
|
|
||||||
import io.bitsquare.BitSquare;
|
|
||||||
import io.bitsquare.gui.CachedViewCB;
|
import io.bitsquare.gui.CachedViewCB;
|
||||||
import io.bitsquare.gui.Navigation;
|
|
||||||
import io.bitsquare.gui.main.arbitrators.registration.ArbitratorRegistrationViewCB;
|
|
||||||
import io.bitsquare.util.ViewLoader;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.Initializable;
|
|
||||||
import javafx.scene.*;
|
|
||||||
import javafx.stage.Modality;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -43,8 +31,6 @@ import org.slf4j.LoggerFactory;
|
||||||
public class HomeViewCB extends CachedViewCB {
|
public class HomeViewCB extends CachedViewCB {
|
||||||
private static final Logger log = LoggerFactory.getLogger(HomeViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(HomeViewCB.class);
|
||||||
|
|
||||||
private ArbitratorRegistrationViewCB arbitratorRegistrationViewCB;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -74,56 +60,5 @@ public class HomeViewCB extends CachedViewCB {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Navigation
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Initializable loadView(Navigation.Item navigationItem) {
|
|
||||||
// don't use caching here, cause exc. -> need to investigate and is rarely called so no caching is better
|
|
||||||
final ViewLoader loader = new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
|
||||||
try {
|
|
||||||
final Parent view = loader.load();
|
|
||||||
arbitratorRegistrationViewCB = loader.getController();
|
|
||||||
|
|
||||||
final Stage rootStage = BitSquare.getPrimaryStage();
|
|
||||||
final Stage stage = new Stage();
|
|
||||||
stage.setTitle("Arbitrator");
|
|
||||||
stage.setMinWidth(800);
|
|
||||||
stage.setMinHeight(400);
|
|
||||||
stage.setWidth(800);
|
|
||||||
stage.setHeight(600);
|
|
||||||
stage.setX(rootStage.getX() + 50);
|
|
||||||
stage.setY(rootStage.getY() + 50);
|
|
||||||
stage.initModality(Modality.WINDOW_MODAL);
|
|
||||||
stage.initOwner(rootStage);
|
|
||||||
Scene scene = new Scene(view, 800, 600);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
|
|
||||||
return arbitratorRegistrationViewCB;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// UI Handlers
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void onArbitratorRegistration() {
|
|
||||||
loadView(Navigation.Item.ARBITRATOR_REGISTRATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void onArbitratorEdit() {
|
|
||||||
loadView(Navigation.Item.ARBITRATOR_REGISTRATION);
|
|
||||||
arbitratorRegistrationViewCB.setEditMode(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<padding>
|
<padding>
|
||||||
<Insets left="10" top="10" right="10"/>
|
<Insets left="10" top="10" right="10"/>
|
||||||
</padding>
|
</padding>
|
||||||
<Label text="TODO: Communication tools with arbitrators..."/>
|
<Label text="TODO: Communication tools with arbitrators, Mailbox for trade messages if client was offline"/>
|
||||||
</VBox>
|
</VBox>
|
||||||
</Tab>
|
</Tab>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
|
|
@ -424,6 +424,7 @@ public class MessageFacade implements MessageBroker {
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException | IOException e) {
|
} catch (ClassNotFoundException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
log.error("Get arbitrators from DHT failed with exception:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue