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_name.SelectCandidateNameLoader;
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.welcome_splash.WelcomeSplashLoader;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
@ -25,19 +26,19 @@ 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
* Welcome Splash screen
* \/
* Channel selection screen
* \/
* Select Candidate Name screen
* \/ /\
* Select candidate by picture screen
* \/ /\
* Ballot summary no pictures
* \/
* Cast Or audit screen
* \/ \/
* thank for voting thank for auditing
* 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
@ -74,10 +75,16 @@ class ChainBuilder {
ballotSummaryController.SetPrevious(selectCandidateByPictureController);
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);
TwoWayNode castOrAuditController = castOrAuditLoader.GetCastOrAudit();
castOrAuditController.SetVotersBallot(votersBallot);
ballotSummaryController.SetNext(castOrAuditController);
castOrAuditController.SetPrevious(thankForAuditingController);
VoteHaveBeenCastLoader voteHaveBeenCastLoader = new VoteHaveBeenCastLoader(primaryStage, configuration);
TwoWayNode voteHaveBeenCastController = voteHaveBeenCastLoader.GetVoteHaveBeenCast();
@ -97,6 +104,7 @@ class ChainBuilder {
nameToTwoWayNodeMap.put("selectCandidateByPictureController", selectCandidateByPictureController);
nameToTwoWayNodeMap.put("ballotSummaryController", ballotSummaryController);
nameToTwoWayNodeMap.put("voteHaveBeenCastController", voteHaveBeenCastController);
nameToTwoWayNodeMap.put("thankForAuditing", thankForAuditingController);
return nameToTwoWayNodeMap;
}

View File

@ -51,7 +51,7 @@ public class VotersChoicesAdder {
* Remove all previous binaryDatas from the container
*/
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();
}
@FXML
private void GetToThankForAuditing(MouseEvent mousePressed) {
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
}
@Override
public void UpdateNode() {
// 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
* @return TwoWayNode
* @return TwoWayNode controller.SetCurrentScene(thankForAuditing);
* @throws IOException
*/
public TwoWayNode GetCastOrAudit() throws IOException {

View File

@ -81,9 +81,10 @@ class PicturesAnswersUpdater implements EventHandler{
* Remove all previous binaryDatas from the container
*/
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
*

View File

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

View File

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

View File

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

View File

@ -46,7 +46,6 @@ public class StraightChannelSectionController extends TwoWayNode {
*/
private void UpdateVotersChoise(){
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>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<left>
<Button mnemonicParsing="false" text="Audit" BorderPane.alignment="CENTER">
<Button mnemonicParsing="false" onMousePressed="#GetToThankForAuditing" text="Audit" BorderPane.alignment="CENTER">
<font>
<Font size="16.0" />
</font>

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