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

46 lines
1.4 KiB
Java

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 SPLASH_SCREEN_ON_BOOT_FXML_PATH = "welcome_splash_screen.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
public WelcomeSplashLoader(Stage primaryStage) throws IOException
{
// Parent splashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPLASH_SCREEN_ON_BOOT_FXML_PATH));
fxmlLoader = new FXMLLoader(getClass().getResource(SPLASH_SCREEN_ON_BOOT_FXML_PATH));
currentStage = primaryStage;
// currentStage.setScene(new Scene(splashScreenOnBootRoot));
}
/**
* 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;
}
}