Updated translation controller SE.QA.09 Issues #51

This commit is contained in:
law39 2020-05-01 15:16:52 +01:00
parent fa4f9759f7
commit 96546c7419

View file

@ -1,3 +1,11 @@
/**
@(#) TranslationController.java 1.1 2020/05/01
Copyright (c) 2020 Aberystwyth University.
All rights reserved.
*/
package uk.ac.aber.cs221.group20.javafx; package uk.ac.aber.cs221.group20.javafx;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
@ -83,16 +91,20 @@ public class TranslationController extends SharedCodeController {
@FXML @FXML
private void initialize() { private void initialize() {
setup(); setup();
//Setup of image on screen
currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/pass-fail-50.png")); currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/pass-fail-50.png"));
currentPageText.setText("Study"); currentPageText.setText("Study");
//Setup of image on screen
studyIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/pass-fail-50.png")); studyIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/pass-fail-50.png"));
studyText.setFill(Color.BLACK); studyText.setFill(Color.BLACK);
//Setup of image on screen
submitButton.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/right-50.png")); submitButton.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
//Sets answer counters to correct values
correctAnswer.setText(": " + AssessmentGenerator.getTotalCorrectAnswers()); correctAnswer.setText(": " + AssessmentGenerator.getTotalCorrectAnswers());
totalAnswer.setText(": " + AssessmentGenerator.getTotalAnswers()); totalAnswer.setText(": " + AssessmentGenerator.getTotalAnswers());
@ -111,14 +123,16 @@ public class TranslationController extends SharedCodeController {
@FXML @FXML
void translateWord() { void translateWord() {
//Creates ArrayList of answers and ArrayList of user answers to check
ArrayList<String> usersInput = new ArrayList<>(); ArrayList<String> usersInput = new ArrayList<>();
usersInput.add(translationBox.getText()); usersInput.add(translationBox.getText());
ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>(); ArrayList<DictionaryEntry> correctTranslation = new ArrayList<>();
correctTranslation.add(answer); correctTranslation.add(answer);
//check user answers against correct answers
Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish()); Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish());
//Open the next question of the assessment.
AssessmentGenerator.goToNextQuestion(); AssessmentGenerator.goToNextQuestion();