diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/PicturesAnswersUpdater.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/PicturesAnswersUpdater.java new file mode 100644 index 0000000..c21853f --- /dev/null +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/PicturesAnswersUpdater.java @@ -0,0 +1,19 @@ +package meerkat.voting.gui.select_candidate_by_picture; + +import javafx.stage.Stage; +import meerkat.protobuf.BallotQuestionUIElementOuterClass; + +/** + * Created by Vladimir Elieze Tokarev on 10/3/2016. + * This object updates the voisual representations of the voters answers + */ +class PicturesAnswersUpdater { + private Stage currentStage; + + PicturesAnswersUpdater(Stage primaryStage){ + this.currentStage = primaryStage; + } + + public void UpdateAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question){ + } +} diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/SelectCandidateByPictureController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/SelectCandidateByPictureController.java index b94094e..6ebb0ea 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/SelectCandidateByPictureController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_by_picture/SelectCandidateByPictureController.java @@ -26,8 +26,16 @@ public class SelectCandidateByPictureController extends TwoWayNode { this.currentStage.show(); } + /** + * Updates the voter options according to the VotingBoothConfiguration + */ + private void UpdateVoterOptions(){ + PicturesAnswersUpdater updater = new PicturesAnswersUpdater(this.currentStage); + updater.UpdateAnswers(this.config.NameSelectionByPictureQuestion); + } + @Override public void UpdateNode() { - // Update the visual representations of the voters options + this.UpdateVoterOptions(); } } diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/SelectCandidateNameController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/SelectCandidateNameController.java index dc97322..1cc2653 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/SelectCandidateNameController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/SelectCandidateNameController.java @@ -30,7 +30,7 @@ public class SelectCandidateNameController extends TwoWayNode { */ private void UpdateVoterOptions(){ StringsAnswersUpdater updater = new StringsAnswersUpdater(this.currentStage); - updater.AddAnswers(this.config.NameSelectionQuestion); + updater.UpdateAnswers(this.config.NameSelectionQuestion); } @Override diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/StringsAnswersUpdater.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/StringsAnswersUpdater.java index cab03ac..c5cff66 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/StringsAnswersUpdater.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/select_candidate_name/StringsAnswersUpdater.java @@ -84,7 +84,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{ * Gets all the answers from the ballot ui question and puts them into the answers container * @param question */ - void AddAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question) { + void UpdateAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question) { this.RemoveAllAnswers(); for (ByteString bytesAnswer : question.getAnswers().getAnswers().getAnswersList()){ this.AddAnswer(bytesAnswer.toStringUtf8());