meerkat-java/voting-booth-gui/src/main/welcome_splash/WelcomeSplashLoader.java

44 lines
1.2 KiB
Java
Raw Normal View History

package main.welcome_splash;
import javafx.concurrent.Task;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import main.TwoWayNode;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
* WelcomeSplashLoader creates welcome spalash object and sets its controller
*/
public class WelcomeSplashLoader {
private static final String WELCOME_SPLASH_FXML_PATH = "welcome_splash_screen.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
public WelcomeSplashLoader(Stage primaryStage) throws IOException
{
fxmlLoader = new FXMLLoader(getClass().getResource(WELCOME_SPLASH_FXML_PATH));
currentStage = primaryStage;
}
/**
* Creates welcome splash parent node and sets it to the controller
* @return TwoWayNode
* @throws IOException
*/
public TwoWayNode GetWelcomeSplash() throws IOException {
Parent welcomeSplash = fxmlLoader.load();
WelcomeSplashController controller = fxmlLoader.getController();
// set the controller to be functional TwoWayNode
controller.SetParent(welcomeSplash);
controller.SetStage(currentStage);
return controller;
}
}