mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
changed return type in loadViewAndGetChildController to support new ui base classes
This commit is contained in:
parent
b7c1fa58d7
commit
8089f40601
@ -31,6 +31,9 @@ import org.slf4j.LoggerFactory;
|
||||
public abstract class CachedViewController extends ViewController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CachedViewController.class);
|
||||
|
||||
public CachedViewController() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get called form GUI framework when the UI is ready.
|
||||
* In caching controllers the initialize is only used for static UI setup.
|
||||
|
@ -23,6 +23,9 @@ public class CodeBehind<T extends PresentationModel> implements Initializable {
|
||||
this.pm = pm;
|
||||
}
|
||||
|
||||
public CodeBehind() {
|
||||
}
|
||||
|
||||
public T pm() {
|
||||
return (T) pm;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ import javax.inject.Inject;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.*;
|
||||
@ -137,7 +138,7 @@ public class MainController extends ViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
switch (navigationItem) {
|
||||
case HOME:
|
||||
homeButton.fire();
|
||||
|
@ -78,7 +78,7 @@ public abstract class ViewController implements Initializable {
|
||||
* @param navigationItem NavigationItem to be loaded.
|
||||
* @return The ViewController of the loaded view.
|
||||
*/
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
log.trace("Lifecycle: loadViewAndGetChildController " + this.getClass().getSimpleName() + " / navigationItem " +
|
||||
"= " + navigationItem);
|
||||
return null;
|
||||
|
@ -41,6 +41,7 @@ import java.util.ResourceBundle;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
@ -123,7 +124,7 @@ public class ArbitratorBrowserController extends CachedViewController implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
|
||||
try {
|
||||
final Node view = loader.load();
|
||||
|
@ -32,6 +32,7 @@ import java.util.ResourceBundle;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
// Arbitration is not much developed yet
|
||||
@ -99,7 +100,7 @@ public class ArbitratorProfileController extends CachedViewController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ import javax.inject.Inject;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.stage.Stage;
|
||||
@ -224,7 +225,7 @@ public class ArbitratorRegistrationController extends CachedViewController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ import java.util.ResourceBundle;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -77,7 +79,7 @@ public class FundsController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
childController = ((CachingTabPane) root).loadViewAndGetChildController(navigationItem.getFxmlUrl());
|
||||
return childController;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.di.GuiceFXMLLoader;
|
||||
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;
|
||||
@ -31,6 +30,7 @@ import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.*;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
@ -70,7 +70,7 @@ public class HomeController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
// 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 {
|
||||
|
@ -19,7 +19,6 @@ package io.bitsquare.gui.msg;
|
||||
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@ -27,6 +26,8 @@ import java.util.ResourceBundle;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -75,7 +76,7 @@ public class MsgController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ package io.bitsquare.gui.orders;
|
||||
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.CachingTabPane;
|
||||
import io.bitsquare.persistence.Persistence;
|
||||
|
||||
@ -29,6 +28,8 @@ import java.util.ResourceBundle;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -80,7 +81,7 @@ public class OrdersController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
childController = ((CachingTabPane) root).loadViewAndGetChildController(navigationItem.getFxmlUrl());
|
||||
return childController;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ import javax.inject.Inject;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.control.*;
|
||||
@ -164,7 +165,7 @@ public class SettingsController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
// TODO caching causes exception
|
||||
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
try {
|
||||
|
@ -20,7 +20,6 @@ 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.CreateOfferCB;
|
||||
import io.bitsquare.gui.trade.orderbook.OrderBookController;
|
||||
@ -34,6 +33,7 @@ import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
@ -87,7 +87,7 @@ public class TradeController extends CachedViewController {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
TabPane tabPane = (TabPane) root;
|
||||
if (navigationItem == NavigationItem.ORDER_BOOK) {
|
||||
checkArgument(orderBookLoader == null);
|
||||
|
@ -64,6 +64,7 @@ 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.*;
|
||||
@ -166,7 +167,7 @@ public class OrderBookController extends CachedViewController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewController loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
public Initializable loadViewAndGetChildController(NavigationItem navigationItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -227,7 +228,7 @@ public class OrderBookController extends CachedViewController {
|
||||
public void createOffer() {
|
||||
if (isRegistered()) {
|
||||
createOfferButton.setDisable(true);
|
||||
ViewController nextController = parentController.loadViewAndGetChildController(NavigationItem.CREATE_OFFER);
|
||||
Initializable nextController = parentController.loadViewAndGetChildController(NavigationItem.CREATE_OFFER);
|
||||
if (nextController != null)
|
||||
((CreateOfferCB) nextController).setOrderBookFilter(orderBookFilter);
|
||||
}
|
||||
|
@ -48,14 +48,12 @@ public class CreateOfferPMTest {
|
||||
BSFormatter.setFiatCurrencyCode("USD");
|
||||
|
||||
presenter = new CreateOfferPM(model);
|
||||
presenter.onViewInitialized();
|
||||
presenter.initialized();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testBindings() {
|
||||
|
||||
|
||||
model.collateralAsLong.set(100);
|
||||
presenter.price.set("500");
|
||||
presenter.amount.set("1");
|
||||
|
Loading…
Reference in New Issue
Block a user