Started implementing the representation of the pictures for voter
parent
352fb7a548
commit
91b0d947f2
|
@ -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){
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,8 +26,16 @@ public class SelectCandidateByPictureController extends TwoWayNode {
|
||||||
this.currentStage.show();
|
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
|
@Override
|
||||||
public void UpdateNode() {
|
public void UpdateNode() {
|
||||||
// Update the visual representations of the voters options
|
this.UpdateVoterOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class SelectCandidateNameController extends TwoWayNode {
|
||||||
*/
|
*/
|
||||||
private void UpdateVoterOptions(){
|
private void UpdateVoterOptions(){
|
||||||
StringsAnswersUpdater updater = new StringsAnswersUpdater(this.currentStage);
|
StringsAnswersUpdater updater = new StringsAnswersUpdater(this.currentStage);
|
||||||
updater.AddAnswers(this.config.NameSelectionQuestion);
|
updater.UpdateAnswers(this.config.NameSelectionQuestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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
|
* Gets all the answers from the ballot ui question and puts them into the answers container
|
||||||
* @param question
|
* @param question
|
||||||
*/
|
*/
|
||||||
void AddAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question) {
|
void UpdateAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question) {
|
||||||
this.RemoveAllAnswers();
|
this.RemoveAllAnswers();
|
||||||
for (ByteString bytesAnswer : question.getAnswers().getAnswers().getAnswersList()){
|
for (ByteString bytesAnswer : question.getAnswers().getAnswers().getAnswersList()){
|
||||||
this.AddAnswer(bytesAnswer.toStringUtf8());
|
this.AddAnswer(bytesAnswer.toStringUtf8());
|
||||||
|
|
Loading…
Reference in New Issue