Added the Select Candidate name into the flaw

android-scanner
Vladimir Eliezer Tokarev 2016-08-27 16:05:18 +03:00
parent 01cda996f9
commit 36d9276ad8
16 changed files with 117 additions and 14 deletions

View File

@ -6,7 +6,7 @@
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.select_candidate_name.SelectCandidateNameController">
<children>
<GridPane GridPane.columnIndex="1">
<children>
@ -204,7 +204,7 @@
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<left>
<Button mnemonicParsing="false" text="Back" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#GetToSelectChannel" text="Back" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>

View File

@ -309,7 +309,7 @@
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
<center>
<Button mnemonicParsing="false" prefHeight="39.0" prefWidth="128.0" text="Next" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#ProceedToNameSelection" prefHeight="39.0" prefWidth="128.0" text="Next" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>

View File

@ -2,6 +2,7 @@ package main;
import javafx.scene.Scene;
import javafx.stage.Stage;
import main.select_candidate_name.SelectCandidateNameLoader;
import main.straight_channel_section.StraightChannelSectionLoader;
import main.welcome_splash.WelcomeSplashLoader;
@ -16,6 +17,24 @@ public class ChainBuilder {
/**
* Creates all the twoWayNodes and connects between them
*
* The flow of Voting booth gui is next
* Welcome Splash screen
* \/
* Channel selection screen
* \/
* Select Candidate Name screen
* \/ /\
* Select candidate by picture screen
* \/ /\
* Ballot summary no pictures
* \/
* Cast Or audit screen
* \/
* thank you for screen
* In order to maintain this order next technique was implemented every "screen" will have the next screen
* and the previous this way the flow between will be easy .
* The Build method creates all the screens and connect between them
*/
public static void Build(Stage primaryStage) throws IOException {
WelcomeSplashLoader welcomeSplashLoader = new WelcomeSplashLoader(primaryStage);
@ -26,10 +45,17 @@ public class ChainBuilder {
welcomeSplashController.SetNext(straightChannelSectionController);
straightChannelSectionController.SetPrevious(welcomeSplashController);
SelectCandidateNameLoader selectCandidateNameLoader = new SelectCandidateNameLoader(primaryStage);
TwoWayNode selectCandidateNameController = selectCandidateNameLoader.GetSelectCandidateName();
selectCandidateNameController.SetPrevious(straightChannelSectionController);
straightChannelSectionController.SetNext(selectCandidateNameController);
/**
* all other two way nodes initialized
*/
primaryStage.setScene(new Scene(welcomeSplashController.GetNode()));
primaryStage.setScene(welcomeSplashController.GetNode());
}
}

View File

@ -1,6 +1,7 @@
package main;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
@ -9,10 +10,10 @@ import javafx.stage.Stage;
*/
public abstract class TwoWayNode {
protected Parent next;
protected Parent previous;
protected Scene next;
protected Scene previous;
protected Stage currentStage;
protected Parent currentNode;
protected Scene currentNode;
/**
* Sets which next TwoWayNode
@ -43,14 +44,14 @@ public abstract class TwoWayNode {
* @param parent
*/
public void SetParent(Parent parent) {
this.currentNode = parent;
this.currentNode = new Scene(parent);
}
/**
* GetNode return the paren node that represents current object
* @return Paren object
*/
public Parent GetNode() {
public Scene GetNode() {
return this.currentNode;
}
}

View File

@ -0,0 +1,20 @@
package main.select_candidate_name;
import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import main.TwoWayNode;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
* SelectCandidateNameController handle the behavior of welcome splash class
*/
public class SelectCandidateNameController extends TwoWayNode {
@FXML
private void GetToSelectChannel(MouseEvent mousePressed){
this.currentStage.close();
this.currentStage.setScene(this.previous);
this.currentStage.show();
}
}

View File

@ -0,0 +1,45 @@
package main.select_candidate_name;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import main.TwoWayNode;
import main.straight_channel_section.StraightChannelSectionController;
import java.io.Console;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
* SelectCandidateNameLoader creates starlight channel section object and sets its controller
*/
public class SelectCandidateNameLoader {
private static final String SELECT_CANDIDATE_NAME_FXML_PATH = "select_candidate_name.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
public SelectCandidateNameLoader(Stage primaryStage) throws IOException
{
fxmlLoader = new FXMLLoader(getClass().getResource(SELECT_CANDIDATE_NAME_FXML_PATH));
System.out.println(fxmlLoader);
currentStage = primaryStage;
}
/**
* Creates welcome splash parent node and sets it to the controller
* @return TwoWayNode
* @throws IOException
*/
public TwoWayNode GetSelectCandidateName() throws IOException {
Parent selectCandidateName = fxmlLoader.load();
SelectCandidateNameController controller = fxmlLoader.getController();
// set the controller to be functional TwoWayNode
controller.SetParent(selectCandidateName);
controller.SetStage(currentStage);
return controller;
}
}

View File

@ -6,7 +6,7 @@
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.select_candidate_name.SelectCandidateNameController">
<children>
<GridPane GridPane.columnIndex="1">
<children>
@ -204,7 +204,7 @@
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<left>
<Button mnemonicParsing="false" text="Back" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#GetToSelectChannel" text="Back" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>

View File

@ -1,6 +1,9 @@
package main.straight_channel_section;
import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import main.TwoWayNode;
@ -10,4 +13,10 @@ import main.TwoWayNode;
*/
public class StraightChannelSectionController extends TwoWayNode {
@FXML
private void ProceedToNameSelection(MouseEvent boutonPressed) {
this.currentStage.close();
this.currentStage.setScene(this.next);
this.currentStage.show();
}
}

View File

@ -140,7 +140,7 @@
<font>
<Font size="30.0" />
</font>
</TextField>
</TextField>
</center>
</BorderPane>
<BorderPane prefHeight="55.0" prefWidth="70.0" GridPane.columnIndex="3">
@ -309,7 +309,7 @@
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
<center>
<Button mnemonicParsing="false" prefHeight="39.0" prefWidth="128.0" text="Next" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#ProceedToNameSelection" prefHeight="39.0" prefWidth="128.0" text="Next" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>

View File

@ -13,6 +13,8 @@ public class WelcomeSplashController extends TwoWayNode {
@FXML
private void StartVotingProcess(MouseEvent mousePressed) {
this.currentStage.setScene(new Scene(this.next));
this.currentStage.close();
this.currentStage.setScene(this.next);
this.currentStage.show();
}
}