Converted WelcomeSplash into two way link
Welcome Splash should be the first object to displayed and when the next button pressed it shoud jump to already created straight channel section.android-scanner
parent
e605089666
commit
9b636f2d2e
|
@ -1,5 +1,10 @@
|
|||
package main;
|
||||
|
||||
import javafx.stage.Stage;
|
||||
import main.welcome_splash.WelcomeSplashLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
|
||||
* ChainBuilder builds all the two way nodes that are in current project (voting-booth-gui)
|
||||
|
@ -10,7 +15,10 @@ public class ChainBuilder {
|
|||
/**
|
||||
* Creates all the twoWayNodes and connects between them
|
||||
*/
|
||||
public static void Build() {
|
||||
public static void Build(Stage primaryStage) throws IOException {
|
||||
WelcomeSplashLoader welcomeSplashLoader = new WelcomeSplashLoader(primaryStage);
|
||||
TwoWayNode welcomeSplashController = welcomeSplashLoader.GetWelcomeSplash();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package main.welcome_splash;
|
||||
package main;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
import main.welcome_splash.WelcomeSplashLoader;
|
||||
|
||||
/**
|
||||
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
|
|
@ -1,5 +1,6 @@
|
|||
package main;
|
||||
|
||||
import javafx.scene.Parent;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
|
@ -8,7 +9,33 @@ import javafx.stage.Stage;
|
|||
*/
|
||||
public interface TwoWayNode {
|
||||
|
||||
/**
|
||||
* GetNode return the paren node that represents current object
|
||||
* @return Paren object
|
||||
*/
|
||||
Parent GetNode();
|
||||
|
||||
/**
|
||||
* Sets which next TwoWayNode
|
||||
* @param nextObject
|
||||
*/
|
||||
void SetNext(TwoWayNode nextObject);
|
||||
|
||||
/**
|
||||
* Sets which previous TwoWayNode
|
||||
* @param previousObject
|
||||
*/
|
||||
void SetPrevious(TwoWayNode previousObject);
|
||||
|
||||
/**
|
||||
* Sets the stage of current object
|
||||
* @param primaryStage
|
||||
*/
|
||||
void SetStage(Stage primaryStage);
|
||||
|
||||
/**
|
||||
* Sets the current parent node
|
||||
* @param parent
|
||||
*/
|
||||
void SetParent(Parent parent);
|
||||
}
|
||||
|
|
|
@ -10,22 +10,36 @@ import main.TwoWayNode;
|
|||
*/
|
||||
public class WelcomeSplashController implements TwoWayNode {
|
||||
|
||||
private Parent Next;
|
||||
private Parent Previous;
|
||||
private Parent next;
|
||||
private Parent previous;
|
||||
private Stage currentSrage;
|
||||
private Parent currentNode;
|
||||
|
||||
|
||||
@Override
|
||||
public void SetNext(TwoWayNode nextObject) {
|
||||
|
||||
this.next = nextObject.GetNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetPrevious(TwoWayNode previousObject) {
|
||||
|
||||
this.previous = previousObject.GetNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetStage(Stage primaryStage) {
|
||||
|
||||
this.currentSrage = primaryStage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetParent(Parent parent) {
|
||||
this.currentNode = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parent GetNode() {
|
||||
return this.currentNode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,21 +5,41 @@ 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));
|
||||
// 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, 565, 365));
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue