Added the thank for auditing pannel

android-scanner
VladimirEliTokarev 2016-10-05 16:48:30 +03:00
parent dcaf36f8fa
commit 94adef22f3
13 changed files with 110 additions and 24 deletions

View File

@ -6,6 +6,7 @@ import meerkat.voting.gui.panels.cast_or_audit.CastOrAuditLoader;
import meerkat.voting.gui.panels.select_candidate_by_picture.SelectCandidateByPictureLoader; import meerkat.voting.gui.panels.select_candidate_by_picture.SelectCandidateByPictureLoader;
import meerkat.voting.gui.panels.select_candidate_name.SelectCandidateNameLoader; import meerkat.voting.gui.panels.select_candidate_name.SelectCandidateNameLoader;
import meerkat.voting.gui.panels.straight_channel_section.StraightChannelSectionLoader; import meerkat.voting.gui.panels.straight_channel_section.StraightChannelSectionLoader;
import meerkat.voting.gui.panels.thank_for_audditing.ThankForAuditingLoader;
import meerkat.voting.gui.panels.vote_have_been_cast.VoteHaveBeenCastLoader; import meerkat.voting.gui.panels.vote_have_been_cast.VoteHaveBeenCastLoader;
import meerkat.voting.gui.panels.welcome_splash.WelcomeSplashLoader; import meerkat.voting.gui.panels.welcome_splash.WelcomeSplashLoader;
import meerkat.voting.gui.configuration.VotingBoothConfiguration; import meerkat.voting.gui.configuration.VotingBoothConfiguration;
@ -25,19 +26,19 @@ class ChainBuilder {
* Creates all the twoWayNodes and connects between them * Creates all the twoWayNodes and connects between them
* *
* The flow of Voting booth gui is next * The flow of Voting booth gui is next
* Welcome Splash screen * Welcome Splash screen
* \/ * \/
* Channel selection screen * Channel selection screen
* \/ * \/
* Select Candidate Name screen * Select Candidate Name screen
* \/ /\ * \/ /\
* Select candidate by picture screen * Select candidate by picture screen
* \/ /\ * \/ /\
* Ballot summary no pictures * Ballot summary no pictures
* \/ * \/
* Cast Or audit screen * Cast Or audit screen
* \/ * \/ \/
* thank you for screen * thank for voting thank for auditing
* In order to maintain this order next technique was implemented every "screen" will have the next 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 . * and the previous this way the flow between will be easy .
* The Build method creates all the screens and connect between them * The Build method creates all the screens and connect between them
@ -74,10 +75,16 @@ class ChainBuilder {
ballotSummaryController.SetPrevious(selectCandidateByPictureController); ballotSummaryController.SetPrevious(selectCandidateByPictureController);
selectCandidateByPictureController.SetNext(ballotSummaryController); selectCandidateByPictureController.SetNext(ballotSummaryController);
ThankForAuditingLoader thankForAuditingLoader = new ThankForAuditingLoader(primaryStage, configuration);
TwoWayNode thankForAuditingController = thankForAuditingLoader.GetThankForAuditing();
thankForAuditingController.SetVotersBallot(votersBallot);
thankForAuditingController.SetPrevious(welcomeSplashController);
CastOrAuditLoader castOrAuditLoader = new CastOrAuditLoader(primaryStage, configuration); CastOrAuditLoader castOrAuditLoader = new CastOrAuditLoader(primaryStage, configuration);
TwoWayNode castOrAuditController = castOrAuditLoader.GetCastOrAudit(); TwoWayNode castOrAuditController = castOrAuditLoader.GetCastOrAudit();
castOrAuditController.SetVotersBallot(votersBallot); castOrAuditController.SetVotersBallot(votersBallot);
ballotSummaryController.SetNext(castOrAuditController); ballotSummaryController.SetNext(castOrAuditController);
castOrAuditController.SetPrevious(thankForAuditingController);
VoteHaveBeenCastLoader voteHaveBeenCastLoader = new VoteHaveBeenCastLoader(primaryStage, configuration); VoteHaveBeenCastLoader voteHaveBeenCastLoader = new VoteHaveBeenCastLoader(primaryStage, configuration);
TwoWayNode voteHaveBeenCastController = voteHaveBeenCastLoader.GetVoteHaveBeenCast(); TwoWayNode voteHaveBeenCastController = voteHaveBeenCastLoader.GetVoteHaveBeenCast();
@ -97,6 +104,7 @@ class ChainBuilder {
nameToTwoWayNodeMap.put("selectCandidateByPictureController", selectCandidateByPictureController); nameToTwoWayNodeMap.put("selectCandidateByPictureController", selectCandidateByPictureController);
nameToTwoWayNodeMap.put("ballotSummaryController", ballotSummaryController); nameToTwoWayNodeMap.put("ballotSummaryController", ballotSummaryController);
nameToTwoWayNodeMap.put("voteHaveBeenCastController", voteHaveBeenCastController); nameToTwoWayNodeMap.put("voteHaveBeenCastController", voteHaveBeenCastController);
nameToTwoWayNodeMap.put("thankForAuditing", thankForAuditingController);
return nameToTwoWayNodeMap; return nameToTwoWayNodeMap;
} }

View File

@ -51,7 +51,7 @@ public class VotersChoicesAdder {
* Remove all previous binaryDatas from the container * Remove all previous binaryDatas from the container
*/ */
private void RemoveAllAnswers() { private void RemoveAllAnswers() {
this.GetAnswersContainer().getChildren().removeAll(); this.GetAnswersContainer().getChildren().remove(0, this.GetAnswersContainer().getChildren().size());
} }
/** /**

View File

@ -18,6 +18,14 @@ public class CastOrAuditController extends TwoWayNode {
this.currentStage.show(); this.currentStage.show();
} }
@FXML
private void GetToThankForAuditing(MouseEvent mousePressed) {
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
}
@Override @Override
public void UpdateNode() { public void UpdateNode() {
// Maybe one of the buttons should be disabled ? // Maybe one of the buttons should be disabled ?

View File

@ -28,7 +28,7 @@ public class CastOrAuditLoader {
/** /**
* Creates welcome splash parent node and sets it to the controller * Creates welcome splash parent node and sets it to the controller
* @return TwoWayNode * @return TwoWayNode controller.SetCurrentScene(thankForAuditing);
* @throws IOException * @throws IOException
*/ */
public TwoWayNode GetCastOrAudit() throws IOException { public TwoWayNode GetCastOrAudit() throws IOException {

View File

@ -81,9 +81,10 @@ class PicturesAnswersUpdater implements EventHandler{
* Remove all previous binaryDatas from the container * Remove all previous binaryDatas from the container
*/ */
private void RemoveAllAnswers() { private void RemoveAllAnswers() {
this.GetAnswersContainer().getChildren().removeAll(); this.GetAnswersContainer().getChildren().remove(0, this.GetAnswersContainer().getChildren().size());
} }
/** /**
* Creates binaryData element which is grid pane with the binaryData and check box * Creates binaryData element which is grid pane with the binaryData and check box
* *

View File

@ -45,7 +45,6 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu
@Override @Override
public void onSuccess(ByteString result) { public void onSuccess(ByteString result) {
this.votersBallot.VotersImageSelection = result; this.votersBallot.VotersImageSelection = result;
System.out.println(this.votersBallot.Votershannel +" "+this.votersBallot.VotersNameSelection +" "+ this.votersBallot.VotersImageSelection);
} }
@Override @Override

View File

@ -43,7 +43,6 @@ public class SelectCandidateNameController extends TwoWayNode implements FutureC
@Override @Override
public void onSuccess(String result) { public void onSuccess(String result) {
this.votersBallot.VotersNameSelection = result; this.votersBallot.VotersNameSelection = result;
System.out.println(this.votersBallot.Votershannel +" "+this.votersBallot.VotersNameSelection +" "+ this.votersBallot.VotersImageSelection);
} }
@Override @Override

View File

@ -49,8 +49,8 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
/** /**
* Remove all previous answers from the container * Remove all previous answers from the container
*/ */
private void RemoveAllAnswers(){ private void RemoveAllAnswers() {
this.GetAnswersContainer().getChildren().removeAll(); this.GetAnswersContainer().getChildren().remove(0, this.GetAnswersContainer().getChildren().size() );
} }
/** /**

View File

@ -46,7 +46,6 @@ public class StraightChannelSectionController extends TwoWayNode {
*/ */
private void UpdateVotersChoise(){ private void UpdateVotersChoise(){
this.votersBallot.Votershannel = this.chanelValue; this.votersBallot.Votershannel = this.chanelValue;
System.out.println(this.votersBallot.Votershannel +" "+this.votersBallot.VotersNameSelection +" "+ this.votersBallot.VotersImageSelection);
} }
/** /**

View File

@ -0,0 +1,25 @@
package meerkat.voting.gui.panels.thank_for_audditing;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
/**
* Created by Vladimir Eliezer Tokarev on 10/5/2016.
* Representing that the vote have been given for auditing
*/
public class ThankForAuditingController extends TwoWayNode {
@FXML
private void GetBackToStart(MouseEvent boutonPressed) {
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
}
@Override
public void UpdateNode() {
// Should do nothing really
}
}

View File

@ -0,0 +1,47 @@
package meerkat.voting.gui.panels.thank_for_audditing;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 10/5/2016.
* This class load the pannel that represent the thank u message
*/
public class ThankForAuditingLoader {
private static final String THANK_FOR_AUDITING_FXML_PATH = "/view/thank_for_auditing.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
private VotingBoothConfiguration config;
public ThankForAuditingLoader(Stage primaryStage, VotingBoothConfiguration config) throws IOException
{
this.fxmlLoader = new FXMLLoader(getClass().getResource(THANK_FOR_AUDITING_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
}
/**
* Creates welcome splash parent node and sets it to the controller
* @return TwoWayNode
* @throws IOException
*/
public TwoWayNode GetThankForAuditing() throws IOException {
Parent thankForAuditing = fxmlLoader.load();
ThankForAuditingController controller = fxmlLoader.getController();
// set the controller to be functional TwoWayNode
controller.SetCurrentScene(thankForAuditing);
controller.SetStage(currentStage);
// set the controller to have the configuration file
controller.SetConfig(this.config);
return controller;
}
}

View File

@ -41,7 +41,7 @@
<children> <children>
<BorderPane prefHeight="200.0" prefWidth="200.0"> <BorderPane prefHeight="200.0" prefWidth="200.0">
<left> <left>
<Button mnemonicParsing="false" text="Audit" BorderPane.alignment="CENTER"> <Button mnemonicParsing="false" onMousePressed="#GetToThankForAuditing" text="Audit" BorderPane.alignment="CENTER">
<font> <font>
<Font size="16.0" /> <Font size="16.0" />
</font> </font>

View File

@ -7,7 +7,7 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?> <?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="meerkat.voting.gui.panels.thank_for_audditing.ThankForAuditingController">
<children> <children>
<GridPane> <GridPane>
<children> <children>
@ -106,7 +106,7 @@
</GridPane> </GridPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="2"> <BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="2">
<top> <top>
<Button mnemonicParsing="false" text="Redo ballot" BorderPane.alignment="CENTER"> <Button mnemonicParsing="false" onMousePressed="#GetBackToStart" text="Redo ballot" BorderPane.alignment="CENTER">
<font> <font>
<Font size="20.0" /> <Font size="20.0" />
</font> </font>