diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/ChainBuilder.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/ChainBuilder.java index c2fb51e..3175748 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/ChainBuilder.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/ChainBuilder.java @@ -43,36 +43,45 @@ class ChainBuilder { * The Build method creates all the screens and connect between them */ static Map Build(Stage primaryStage, VotingBoothConfiguration configuration) throws IOException { + VotersBallot votersBallot = new VotersBallot(); + WelcomeSplashLoader welcomeSplashLoader = new WelcomeSplashLoader(primaryStage, configuration); TwoWayNode welcomeSplashController = welcomeSplashLoader.GetWelcomeSplash(); + welcomeSplashController.SetVotersBallot(votersBallot); StraightChannelSectionLoader straightChannelSectionLoader = new StraightChannelSectionLoader(primaryStage, configuration); TwoWayNode straightChannelSectionController = straightChannelSectionLoader.GetStraightChannelSection(); + straightChannelSectionController.SetVotersBallot(votersBallot); welcomeSplashController.SetNext(straightChannelSectionController); straightChannelSectionController.SetPrevious(welcomeSplashController); SelectCandidateNameLoader selectCandidateNameLoader = new SelectCandidateNameLoader(primaryStage, configuration); TwoWayNode selectCandidateNameController = selectCandidateNameLoader.GetSelectCandidateName(); + selectCandidateNameController.SetVotersBallot(votersBallot); selectCandidateNameController.SetPrevious(straightChannelSectionController); straightChannelSectionController.SetNext(selectCandidateNameController); SelectCandidateByPictureLoader selectCandidateByPictureLoader = new SelectCandidateByPictureLoader(primaryStage,configuration); TwoWayNode selectCandidateByPictureController = selectCandidateByPictureLoader.GetSelectCandidateByPicture(); + selectCandidateByPictureController.SetVotersBallot(votersBallot); selectCandidateByPictureController.SetPrevious(selectCandidateNameController); selectCandidateNameController.SetNext(selectCandidateByPictureController); BallotSummaryLoader ballotSummaryLoader = new BallotSummaryLoader(primaryStage, configuration); TwoWayNode ballotSummaryController = ballotSummaryLoader.GetBallotSummary(); + ballotSummaryController.SetVotersBallot(votersBallot); ballotSummaryController.SetPrevious(selectCandidateByPictureController); selectCandidateByPictureController.SetNext(ballotSummaryController); CastOrAuditLoader castOrAuditLoader = new CastOrAuditLoader(primaryStage, configuration); TwoWayNode castOrAuditController = castOrAuditLoader.GetCastOrAudit(); + castOrAuditController.SetVotersBallot(votersBallot); ballotSummaryController.SetNext(castOrAuditController); VoteHaveBeenCastLoader voteHaveBeenCastLoader = new VoteHaveBeenCastLoader(primaryStage, configuration); TwoWayNode voteHaveBeenCastController = voteHaveBeenCastLoader.GetVoteHaveBeenCast(); + voteHaveBeenCastController.SetVotersBallot(votersBallot); castOrAuditController.SetNext(voteHaveBeenCastController); /** diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/TwoWayNode.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/TwoWayNode.java index 58cf0b3..ca4b73b 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/TwoWayNode.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/TwoWayNode.java @@ -20,7 +20,11 @@ public abstract class TwoWayNode { /** * Object which contains the voters selections in different panels */ - protected VotersBallot votersChoise; + protected VotersBallot votersBallot; + + public void SetVotersBallot(VotersBallot votersBallot){ + this.votersBallot = votersBallot; + } /** * Sets which next TwoWayNode diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java index d7ac6e9..d878499 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java @@ -33,6 +33,7 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu */ private void UpdateVoterOptions(){ PicturesAnswersUpdater updater = new PicturesAnswersUpdater(this.currentStage); + updater.SetImageUpdate(this); updater.UpdateAnswers(this.config.NameSelectionByPictureQuestion); } @@ -43,7 +44,8 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu @Override public void onSuccess(ByteString result) { - this.votersChoise.VotersImageSelection = result; + this.votersBallot.VotersImageSelection = result; + System.out.println(this.votersBallot.Votershannel +" "+this.votersBallot.VotersNameSelection +" "+ this.votersBallot.VotersImageSelection); } @Override diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/SelectCandidateNameController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/SelectCandidateNameController.java index 302dc57..7e0752e 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/SelectCandidateNameController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/SelectCandidateNameController.java @@ -42,7 +42,8 @@ public class SelectCandidateNameController extends TwoWayNode implements FutureC @Override public void onSuccess(String result) { - this.votersChoise.VotersNameSelection = result; + this.votersBallot.VotersNameSelection = result; + System.out.println(this.votersBallot.Votershannel +" "+this.votersBallot.VotersNameSelection +" "+ this.votersBallot.VotersImageSelection); } @Override diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/straight_channel_section/StraightChannelSectionController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/straight_channel_section/StraightChannelSectionController.java index a4d3fd7..349a4c2 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/straight_channel_section/StraightChannelSectionController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/straight_channel_section/StraightChannelSectionController.java @@ -45,7 +45,8 @@ public class StraightChannelSectionController extends TwoWayNode { * Updates the channel in the voters choise */ private void UpdateVotersChoise(){ - this.votersChoise.Votershannel = this.chanelValue; + this.votersBallot.Votershannel = this.chanelValue; + System.out.println(this.votersBallot.Votershannel +" "+this.votersBallot.VotersNameSelection +" "+ this.votersBallot.VotersImageSelection); } /**