Added the ballot summary to the flow

android-scanner
Vladimir Eliezer Tokarev 2016-08-27 16:48:50 +03:00
parent 4591c4e2e8
commit b687782f5c
17 changed files with 80 additions and 13 deletions

View File

@ -7,7 +7,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<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.ballot_summary.BallotSummaryController">
<children>
<GridPane>
<children>
@ -50,7 +50,7 @@
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<left>
<Button mnemonicParsing="false" text="Back" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#GetToSelectByPicture" text="Back" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>

View File

@ -41,7 +41,7 @@
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
<right>
<Button mnemonicParsing="false" prefHeight="39.0" prefWidth="128.0" text="Next" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#GetToBallotSummary" 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.ballot_summary.BallotSummaryLoader;
import main.select_candidate_by_picture.SelectCandidateByPictureLoader;
import main.select_candidate_name.SelectCandidateNameLoader;
import main.straight_channel_section.StraightChannelSectionLoader;
@ -57,6 +58,11 @@ public class ChainBuilder {
selectCandidateByPictureController.SetPrevious(selectCandidateNameController);
selectCandidateNameController.SetNext(selectCandidateByPictureController);
BallotSummaryLoader ballotSummaryLoader = new BallotSummaryLoader(primaryStage);
TwoWayNode ballotSummaryController = ballotSummaryLoader.GetBallotSummary();
ballotSummaryController.SetPrevious(selectCandidateByPictureController);
selectCandidateByPictureController.SetNext(ballotSummaryController);
/**
* all other two way nodes initialized
*/

View File

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

View File

@ -0,0 +1,43 @@
package main.ballot_summary;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import main.TwoWayNode;
import main.select_candidate_by_picture.SelectCandidateByPictureController;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
* BallotSummaryLoader creates starlight channel section object and sets its controller
*/
public class BallotSummaryLoader {
private static final String BALLOT_SUMMARY_FXML_PATH = "ballot_summary.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
public BallotSummaryLoader(Stage primaryStage) throws IOException
{
fxmlLoader = new FXMLLoader(getClass().getResource(BALLOT_SUMMARY_FXML_PATH));
currentStage = primaryStage;
}
/**
* Creates welcome splash parent node and sets it to the controller
* @return TwoWayNode
* @throws IOException
*/
public TwoWayNode GetBallotSummary() throws IOException {
Parent selectCandidateName = fxmlLoader.load();
BallotSummaryController controller = fxmlLoader.getController();
// set the controller to be functional TwoWayNode
controller.SetParent(selectCandidateName);
controller.SetStage(currentStage);
return controller;
}
}

View File

@ -7,7 +7,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<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.ballot_summary.BallotSummaryController">
<children>
<GridPane>
<children>
@ -50,7 +50,7 @@
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<left>
<Button mnemonicParsing="false" text="Back" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#GetToSelectByPicture" text="Back" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>

View File

@ -16,4 +16,11 @@ public class SelectCandidateByPictureController extends TwoWayNode {
this.currentStage.setScene(this.previous);
this.currentStage.show();
}
@FXML
private void GetToBallotSummary(MouseEvent mousePressed){
this.currentStage.close();
this.currentStage.setScene(this.next);
this.currentStage.show();
}
}

View File

@ -22,7 +22,6 @@ public class SelectCandidateByPictureLoader {
public SelectCandidateByPictureLoader(Stage primaryStage) throws IOException
{
fxmlLoader = new FXMLLoader(getClass().getResource(SELECT_CANDIDATE_BY_PICTURE_FXML_PATH));
System.out.println(fxmlLoader);
currentStage = primaryStage;
}

View File

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

View File

@ -23,6 +23,4 @@ public class SelectCandidateNameController extends TwoWayNode {
this.currentStage.setScene(this.next);
this.currentStage.show();
}
}

View File

@ -4,9 +4,6 @@ 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;
/**
@ -22,7 +19,6 @@ public class SelectCandidateNameLoader {
public SelectCandidateNameLoader(Stage primaryStage) throws IOException
{
fxmlLoader = new FXMLLoader(getClass().getResource(SELECT_CANDIDATE_NAME_FXML_PATH));
System.out.println(fxmlLoader);
currentStage = primaryStage;
}