Every pannel that choses somthing now saves it into VotersBallot`

android-scanner
VladimirEliTokarev 2016-10-05 13:11:18 +03:00
parent 6655f2dc8e
commit 8e2fdb7828
5 changed files with 21 additions and 4 deletions

View File

@ -43,36 +43,45 @@ class ChainBuilder {
* The Build method creates all the screens and connect between them * The Build method creates all the screens and connect between them
*/ */
static Map<String, TwoWayNode> Build(Stage primaryStage, VotingBoothConfiguration configuration) throws IOException { static Map<String, TwoWayNode> Build(Stage primaryStage, VotingBoothConfiguration configuration) throws IOException {
VotersBallot votersBallot = new VotersBallot();
WelcomeSplashLoader welcomeSplashLoader = new WelcomeSplashLoader(primaryStage, configuration); WelcomeSplashLoader welcomeSplashLoader = new WelcomeSplashLoader(primaryStage, configuration);
TwoWayNode welcomeSplashController = welcomeSplashLoader.GetWelcomeSplash(); TwoWayNode welcomeSplashController = welcomeSplashLoader.GetWelcomeSplash();
welcomeSplashController.SetVotersBallot(votersBallot);
StraightChannelSectionLoader straightChannelSectionLoader = new StraightChannelSectionLoader(primaryStage, configuration); StraightChannelSectionLoader straightChannelSectionLoader = new StraightChannelSectionLoader(primaryStage, configuration);
TwoWayNode straightChannelSectionController = straightChannelSectionLoader.GetStraightChannelSection(); TwoWayNode straightChannelSectionController = straightChannelSectionLoader.GetStraightChannelSection();
straightChannelSectionController.SetVotersBallot(votersBallot);
welcomeSplashController.SetNext(straightChannelSectionController); welcomeSplashController.SetNext(straightChannelSectionController);
straightChannelSectionController.SetPrevious(welcomeSplashController); straightChannelSectionController.SetPrevious(welcomeSplashController);
SelectCandidateNameLoader selectCandidateNameLoader = new SelectCandidateNameLoader(primaryStage, configuration); SelectCandidateNameLoader selectCandidateNameLoader = new SelectCandidateNameLoader(primaryStage, configuration);
TwoWayNode selectCandidateNameController = selectCandidateNameLoader.GetSelectCandidateName(); TwoWayNode selectCandidateNameController = selectCandidateNameLoader.GetSelectCandidateName();
selectCandidateNameController.SetVotersBallot(votersBallot);
selectCandidateNameController.SetPrevious(straightChannelSectionController); selectCandidateNameController.SetPrevious(straightChannelSectionController);
straightChannelSectionController.SetNext(selectCandidateNameController); straightChannelSectionController.SetNext(selectCandidateNameController);
SelectCandidateByPictureLoader selectCandidateByPictureLoader = SelectCandidateByPictureLoader selectCandidateByPictureLoader =
new SelectCandidateByPictureLoader(primaryStage,configuration); new SelectCandidateByPictureLoader(primaryStage,configuration);
TwoWayNode selectCandidateByPictureController = selectCandidateByPictureLoader.GetSelectCandidateByPicture(); TwoWayNode selectCandidateByPictureController = selectCandidateByPictureLoader.GetSelectCandidateByPicture();
selectCandidateByPictureController.SetVotersBallot(votersBallot);
selectCandidateByPictureController.SetPrevious(selectCandidateNameController); selectCandidateByPictureController.SetPrevious(selectCandidateNameController);
selectCandidateNameController.SetNext(selectCandidateByPictureController); selectCandidateNameController.SetNext(selectCandidateByPictureController);
BallotSummaryLoader ballotSummaryLoader = new BallotSummaryLoader(primaryStage, configuration); BallotSummaryLoader ballotSummaryLoader = new BallotSummaryLoader(primaryStage, configuration);
TwoWayNode ballotSummaryController = ballotSummaryLoader.GetBallotSummary(); TwoWayNode ballotSummaryController = ballotSummaryLoader.GetBallotSummary();
ballotSummaryController.SetVotersBallot(votersBallot);
ballotSummaryController.SetPrevious(selectCandidateByPictureController); ballotSummaryController.SetPrevious(selectCandidateByPictureController);
selectCandidateByPictureController.SetNext(ballotSummaryController); selectCandidateByPictureController.SetNext(ballotSummaryController);
CastOrAuditLoader castOrAuditLoader = new CastOrAuditLoader(primaryStage, configuration); CastOrAuditLoader castOrAuditLoader = new CastOrAuditLoader(primaryStage, configuration);
TwoWayNode castOrAuditController = castOrAuditLoader.GetCastOrAudit(); TwoWayNode castOrAuditController = castOrAuditLoader.GetCastOrAudit();
castOrAuditController.SetVotersBallot(votersBallot);
ballotSummaryController.SetNext(castOrAuditController); ballotSummaryController.SetNext(castOrAuditController);
VoteHaveBeenCastLoader voteHaveBeenCastLoader = new VoteHaveBeenCastLoader(primaryStage, configuration); VoteHaveBeenCastLoader voteHaveBeenCastLoader = new VoteHaveBeenCastLoader(primaryStage, configuration);
TwoWayNode voteHaveBeenCastController = voteHaveBeenCastLoader.GetVoteHaveBeenCast(); TwoWayNode voteHaveBeenCastController = voteHaveBeenCastLoader.GetVoteHaveBeenCast();
voteHaveBeenCastController.SetVotersBallot(votersBallot);
castOrAuditController.SetNext(voteHaveBeenCastController); castOrAuditController.SetNext(voteHaveBeenCastController);
/** /**

View File

@ -20,7 +20,11 @@ public abstract class TwoWayNode {
/** /**
* Object which contains the voters selections in different panels * 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 * Sets which next TwoWayNode

View File

@ -33,6 +33,7 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu
*/ */
private void UpdateVoterOptions(){ private void UpdateVoterOptions(){
PicturesAnswersUpdater updater = new PicturesAnswersUpdater(this.currentStage); PicturesAnswersUpdater updater = new PicturesAnswersUpdater(this.currentStage);
updater.SetImageUpdate(this);
updater.UpdateAnswers(this.config.NameSelectionByPictureQuestion); updater.UpdateAnswers(this.config.NameSelectionByPictureQuestion);
} }
@ -43,7 +44,8 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu
@Override @Override
public void onSuccess(ByteString result) { 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 @Override

View File

@ -42,7 +42,8 @@ public class SelectCandidateNameController extends TwoWayNode implements FutureC
@Override @Override
public void onSuccess(String result) { 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 @Override

View File

@ -45,7 +45,8 @@ public class StraightChannelSectionController extends TwoWayNode {
* Updates the channel in the voters choise * Updates the channel in the voters choise
*/ */
private void UpdateVotersChoise(){ 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);
} }
/** /**