Search in sources :

Example 1 with ViewLoader

use of bisq.desktop.common.view.ViewLoader in project bisq-desktop by bisq-network.

the class BisqApp method showDebugWindow.

// Used for debugging trade process
private void showDebugWindow() {
    ViewLoader viewLoader = injector.getInstance(ViewLoader.class);
    View debugView = viewLoader.load(DebugView.class);
    Parent parent = (Parent) debugView.getRoot();
    Stage stage = new Stage();
    stage.setScene(new Scene(parent));
    // Don't translate, just for dev
    stage.setTitle("Debug window");
    stage.initModality(Modality.NONE);
    stage.initStyle(StageStyle.UTILITY);
    stage.initOwner(scene.getWindow());
    stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
    stage.setY(primaryStage.getY());
    stage.show();
}
Also used : Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) ViewLoader(bisq.desktop.common.view.ViewLoader) CachingViewLoader(bisq.desktop.common.view.CachingViewLoader) Scene(javafx.scene.Scene) DebugView(bisq.desktop.main.debug.DebugView) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView)

Example 2 with ViewLoader

use of bisq.desktop.common.view.ViewLoader in project bisq-desktop by bisq-network.

the class CachingViewLoaderTests method test.

@Test
public void test() {
    ViewLoader delegateViewLoader = mock(ViewLoader.class);
    ViewLoader cachingViewLoader = new CachingViewLoader(delegateViewLoader);
    cachingViewLoader.load(TestView1.class);
    cachingViewLoader.load(TestView1.class);
    cachingViewLoader.load(TestView2.class);
    then(delegateViewLoader).should(times(1)).load(TestView1.class);
    then(delegateViewLoader).should(times(1)).load(TestView2.class);
    then(delegateViewLoader).should(times(0)).load(TestView3.class);
}
Also used : ViewLoader(bisq.desktop.common.view.ViewLoader) CachingViewLoader(bisq.desktop.common.view.CachingViewLoader) CachingViewLoader(bisq.desktop.common.view.CachingViewLoader) Test(org.junit.Test)

Aggregations

CachingViewLoader (bisq.desktop.common.view.CachingViewLoader)2 ViewLoader (bisq.desktop.common.view.ViewLoader)2 View (bisq.desktop.common.view.View)1 MainView (bisq.desktop.main.MainView)1 DebugView (bisq.desktop.main.debug.DebugView)1 Parent (javafx.scene.Parent)1 Scene (javafx.scene.Scene)1 Stage (javafx.stage.Stage)1 Test (org.junit.Test)1