diff --git a/VotersBallot.png b/VotersBallot.png index a63d0c3..aba8fa2 100644 Binary files a/VotersBallot.png and b/VotersBallot.png differ 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 4a3f7e4..703c17f 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 @@ -5,7 +5,6 @@ import meerkat.voting.gui.configuration.VotingBoothConfiguration; import meerkat.voting.gui.panels.ballot_summary.BallotSummaryLoader; 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; @@ -60,18 +59,19 @@ public class ChainBuilder { 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); +// SelectCandidateNameLoader selectCandidateNameLoader = new SelectCandidateNameLoader(primaryStage, configuration); +// TwoWayNode selectCandidateNameController = selectCandidateNameLoader.GetSelectCandidateName(); +// selectCandidateNameController.SetVotersBallot(votersBallot); +// selectCandidateNameController.SetPrevious(straightChannelSectionController); + SelectCandidateByPictureLoader selectCandidateByPictureLoader = new SelectCandidateByPictureLoader(primaryStage,configuration); TwoWayNode selectCandidateByPictureController = selectCandidateByPictureLoader.GetSelectCandidateByPicture(); selectCandidateByPictureController.SetVotersBallot(votersBallot); - selectCandidateByPictureController.SetPrevious(selectCandidateNameController); - selectCandidateNameController.SetNext(selectCandidateByPictureController); + selectCandidateByPictureController.SetPrevious(straightChannelSectionController); +// selectCandidateNameController.SetNext(selectCandidateByPictureController); + straightChannelSectionController.SetNext(selectCandidateByPictureController); BallotSummaryLoader ballotSummaryLoader = new BallotSummaryLoader(primaryStage, configuration); TwoWayNode ballotSummaryController = ballotSummaryLoader.GetBallotSummary(); @@ -105,7 +105,7 @@ public class ChainBuilder { Map nameToTwoWayNodeMap = new HashMap<>(); nameToTwoWayNodeMap.put("welcomeSplashController", welcomeSplashController); nameToTwoWayNodeMap.put("straightChannelSectionController", straightChannelSectionController); - nameToTwoWayNodeMap.put("selectCandidateNameController", selectCandidateNameController); + //nameToTwoWayNodeMap.put("selectCandidateNameController", selectCandidateNameController); nameToTwoWayNodeMap.put("selectCandidateByPictureController", selectCandidateByPictureController); nameToTwoWayNodeMap.put("ballotSummaryController", ballotSummaryController); nameToTwoWayNodeMap.put("voteHaveBeenCastController", voteHaveBeenCastController); diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java index d4b35d3..3dd9b48 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java @@ -17,6 +17,15 @@ public class VotersBallot { public String VotersNameSelection; public BallotQuestionUIElementOuterClass.UIAnswer VotersImageSelection; + /** + * Gets the name of the candidate the voter choose + * @return String + */ + public String GetCandidateName(){ + String[] name = this.VotersImageSelection.getDescription().split(" "); + return name[0] + " " + name[1]; + } + public String toString(){ return this.VotersNameSelection +"---"+ this.VoterChannel.get(0) + "" + this.VoterChannel.get(1) + this.VoterChannel.get(2) + "" + this.VoterChannel.get(3); diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java index 399f259..cdd1f0a 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java @@ -39,20 +39,35 @@ class VotersChoicesAdder { this.logger.debug("Created voters choises adder."); } + + /** * Adds all of the voters choises to the right panel */ void ShowVotersChoices() throws IOException { this.RemoveAllAnswers(); this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel)); - this.addAnswer(this.getNameChoice(this.votersBallot.VotersNameSelection)); + this.addAnswer(this.getNameChoice(this.votersBallot.GetCandidateName())); this.addAnswer(this.getImageChoice(this.votersBallot.VotersImageSelection.getAnswer())); + this.addAnswer(this.getImageDescription(this.votersBallot.VotersImageSelection.getDescription())); Label error = new Label(); error.setPrefSize(250,30); this.addAnswer(error); this.logger.debug("Add all the choises of the voter to the represent grid pane."); } + /** + * Creates label and puts it into borderpane (the label contains desctiption of the cadidate image) + * @param description the descriptiom of candidate image + * @return borderPane which contains the label + */ + private BorderPane getImageDescription(String description) { + BorderPane borderPane = new BorderPane(); + Label descriptionLabel = new Label(description); + borderPane.setCenter(descriptionLabel); + return borderPane; + } + /** * Remove all previous binaryDatas from the container */ diff --git a/voting-booth-gui/src/main/resources/view/ballot_summary.fxml b/voting-booth-gui/src/main/resources/view/ballot_summary.fxml index 9963a7e..5f6c9fe 100644 --- a/voting-booth-gui/src/main/resources/view/ballot_summary.fxml +++ b/voting-booth-gui/src/main/resources/view/ballot_summary.fxml @@ -137,11 +137,11 @@ - + - + - +