Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(refactor) Framework: Extract ToolkitApplication. #153

Merged
merged 1 commit into from
Oct 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.loadui.testfx.framework.app.AppSetup;
import org.loadui.testfx.framework.app.AppLauncher;
import org.loadui.testfx.utils.StageFuture;
import org.loadui.testfx.framework.launch.StageFuture;

/**
* Class that launches an application class and retrieves its primary stage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,11 @@
*/
package org.loadui.testfx.framework.app.impl;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import org.loadui.testfx.framework.app.AppSetup;
import org.loadui.testfx.utils.StageFuture;
import org.loadui.testfx.framework.launch.ToolkitApplication;

public class ToolkitAppSetupFactory {

//---------------------------------------------------------------------------------------------
// STATIC FIELDS.
//---------------------------------------------------------------------------------------------

public static final StageFuture primaryStageFuture = StageFuture.create();

//---------------------------------------------------------------------------------------------
// STATIC CLASSES.
//---------------------------------------------------------------------------------------------

public static class ToolkitApplication extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setTitle("DefaultApplication: primaryStage");
primaryStageFuture.set(primaryStage);
}
}

//---------------------------------------------------------------------------------------------
// STATIC METHODS.
//---------------------------------------------------------------------------------------------
Expand All @@ -51,7 +28,7 @@ public static AppSetup build() {
AppSetupImpl appSetup = new AppSetupImpl();
appSetup.setAppClass(ToolkitApplication.class);
appSetup.setAppLauncher(new ToolkitAppLauncher());
appSetup.setStageFuture(primaryStageFuture);
appSetup.setStageFuture(ToolkitApplication.primaryStageFuture);
return appSetup;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* either express or implied. See the Licence for the specific language governing permissions
* and limitations under the Licence.
*/
package org.loadui.testfx.utils;
package org.loadui.testfx.framework.launch;

import javafx.stage.Stage;

import com.google.common.util.concurrent.AbstractFuture;

public class StageFuture extends AbstractFuture<Stage> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2013-2014 SmartBear Software
*
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European
* Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work
* except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the Licence for the specific language governing permissions
* and limitations under the Licence.
*/
package org.loadui.testfx.framework.launch;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class ToolkitApplication extends Application {

//---------------------------------------------------------------------------------------------
// STATIC FIELDS.
//---------------------------------------------------------------------------------------------

public static final StageFuture primaryStageFuture = StageFuture.create();

//---------------------------------------------------------------------------------------------
// METHODS.
//---------------------------------------------------------------------------------------------

@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setTitle(getClass().getSimpleName());
primaryStageFuture.set(primaryStage);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.junit.Before;
import org.junit.Test;
import org.loadui.testfx.framework.app.AppLauncher;
import org.loadui.testfx.framework.launch.StageFuture;
import org.loadui.testfx.utils.FXTestUtils;
import org.loadui.testfx.utils.StageFuture;

import org.hamcrest.Matchers;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down