From 0509bf6dda2f06e7ddb74c6134345d9a9aeea3f2 Mon Sep 17 00:00:00 2001 From: VladimirEliTokarev Date: Sat, 12 Nov 2016 17:49:48 +0200 Subject: [PATCH] Resolved the umextendablity of the summary ballot panel --- VotersBallot.png | Bin 953 -> 950 bytes .../voting/gui/managment/VotersBallot.java | 3 ++ .../ballot_summary/VotersChoicesAdder.java | 19 ++++++++----- .../main/resources/view/ballot_summary.fxml | 26 +++++++++--------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/VotersBallot.png b/VotersBallot.png index cc8402410161af0358e175e4a32d378e18080d2e..535519feda533266aa2bcdc820faddb38ec10219 100644 GIT binary patch delta 116 zcmV-)0E_>*2et>WFauI?NklD delta 146 zcmdnSzLR}}0dswcr;B4q#jUp&ZgVym@UUKZWp=lI#+t<){Y#n_{HW9mxfGIQ8@#3Z z*RG`6V`1(unCS?>$tq8 qXavFuR#hMuL^KHjiBGoN{ZBR7QyI4|WMJT8VDNPHb6Mw<&;$UY4?ceY 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 3dd9b48..ee569e2 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 @@ -22,6 +22,9 @@ public class VotersBallot { * @return String */ public String GetCandidateName(){ + if (this.VotersImageSelection == null || this.VotersImageSelection.getDescription() == null ){ + return null; + } String[] name = this.VotersImageSelection.getDescription().split(" "); return name[0] + " " + name[1]; } 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 cdd1f0a..1c6bf02 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 @@ -46,13 +46,18 @@ class VotersChoicesAdder { */ void ShowVotersChoices() throws IOException { this.RemoveAllAnswers(); - this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel)); - 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); + if (this.votersBallot != null) { + this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel)); + this.addAnswer(this.getNameChoice(this.votersBallot.GetCandidateName())); + + if (this.votersBallot.VotersImageSelection != null) { + 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."); } 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 5f6c9fe..811400b 100644 --- a/voting-booth-gui/src/main/resources/view/ballot_summary.fxml +++ b/voting-booth-gui/src/main/resources/view/ballot_summary.fxml @@ -78,11 +78,11 @@ - + - - + + @@ -116,17 +116,17 @@ - - - + + + - - - + + + - +
@@ -137,11 +137,11 @@ - + - + - +