From 555783d30c058862ffc34e8c109a419d500aa927 Mon Sep 17 00:00:00 2001 From: VladimirEliTokarev Date: Sat, 29 Oct 2016 23:06:28 +0300 Subject: [PATCH] Removed unnsessery panels --- VotersBallot.png | Bin 985 -> 954 bytes .../voting/gui/managment/ChainBuilder.java | 18 +++++++++--------- .../voting/gui/managment/VotersBallot.java | 9 +++++++++ .../ballot_summary/VotersChoicesAdder.java | 17 ++++++++++++++++- .../main/resources/view/ballot_summary.fxml | 6 +++--- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/VotersBallot.png b/VotersBallot.png index a63d0c3726f1739776e1aa9c78203ef227273509..aba8fa2ada55510ea315128a4eb8567235ac721d 100644 GIT binary patch delta 182 zcmcb~zKdP4Gr-TCmrII^fq{Y7)59f*fq~Hr$d=$>29m3fxzuk|lFzskrs_ z!fDKJ6;%FYa5o_VbQ;>+Rlct(#Xq zB1EPDi7D?b a8Crj8vh$<`ykOu4y2aDg&t;ucLK6T6%u5LX delta 213 zcmdnRev@6XGr-TCmrII^fq{Y7)59f*fr0TCkS)Q%3?x+z&bw_? 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 @@ - + - + - +