From dbf5d74ee87bf6ce8a4cdd544095c6dec5d11dcc Mon Sep 17 00:00:00 2001 From: law39 Date: Thu, 30 Apr 2020 19:09:42 +0100 Subject: [PATCH] Updated Translation Controller Translation Controller now uses 3 space tabbing consistently --- .../group20/javafx/TranslationController.java | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java index 348e686..136d7cc 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs221/group20/javafx/TranslationController.java @@ -24,91 +24,91 @@ import uk.ac.aber.cs221.group20.selfassessment.Question; */ public class TranslationController extends SharedCodeController{ - // //////////////// // - // Class variables. // - // //////////////// // + // //////////////// // + // Class variables. // + // //////////////// // - public static DictionaryEntry answer = new DictionaryEntry(); + public static DictionaryEntry answer = new DictionaryEntry(); - // /////////////////// // - // Instance variables. // - // /////////////////// // + // /////////////////// // + // Instance variables. // + // /////////////////// // - /** - * Represents the word that will be randomly chosen from the practiceList. - */ - int chosenWord = 0; - @FXML - private TextField translationBox; + /** + * Represents the word that will be randomly chosen from the practiceList. + */ + int chosenWord = 0; + @FXML + private TextField translationBox; - @FXML - private Text typeOfTest; + @FXML + private Text typeOfTest; - @FXML - private Text wordToTranslate; + @FXML + private Text wordToTranslate; - @FXML - private Text correctGuesses; + @FXML + private Text correctGuesses; - @FXML - private Text incorrectGuesses; + @FXML + private Text incorrectGuesses; - @FXML - private ImageView submitButton; + @FXML + private ImageView submitButton; - Random rand = new Random(); + Random rand = new Random(); - // //////// // - // Methods. // - // //////// // + // //////// // + // Methods. // + // //////// // - /** - * Loads the test for the first time, filling the practice list with words from the dictionary, - * deciding if this test will be from English to Welsh or Welsh to English, and generating - * which is the first word the user will have to translate. - */ - @FXML - private void initialize(){ - setup(); - currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/pass-fail-50.png")); - currentPageText.setText("Study"); + /** + * Loads the test for the first time, filling the practice list with words from the dictionary, + * deciding if this test will be from English to Welsh or Welsh to English, and generating + * which is the first word the user will have to translate. + */ + @FXML + private void initialize(){ + setup(); + currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/pass-fail-50.png")); + currentPageText.setText("Study"); - studyIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/pass-fail-50.png")); - studyText.setFill(Color.BLACK); + studyIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/pass-fail-50.png")); + studyText.setFill(Color.BLACK); - 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")); - correctGuesses.setText("Correct answers: " + AssessmentGenerator.getTotalCorrectAnswers()); - incorrectGuesses.setText("Total answers: " + AssessmentGenerator.getTotalAnswers()); + correctGuesses.setText("Correct answers: " + AssessmentGenerator.getTotalCorrectAnswers()); + incorrectGuesses.setText("Total answers: " + AssessmentGenerator.getTotalAnswers()); - if(AssessmentGenerator.isEnglish){ - wordToTranslate.setText(answer.getEnglish()); - } - else{ - wordToTranslate.setText(answer.getWelsh()); - } - } + if(AssessmentGenerator.isEnglish){ + wordToTranslate.setText(answer.getEnglish()); + } + else{ + wordToTranslate.setText(answer.getWelsh()); + } + } - /** - * Takes the word the user inputs and compares it to the correct answer using - * the checkAnswer function in the QuestionClass. - */ - @FXML - void translateWord() { + /** + * Takes the word the user inputs and compares it to the correct answer using + * the checkAnswer function in the QuestionClass. + */ + @FXML + void translateWord() { - ArrayList usersInput = new ArrayList<>(); - usersInput.add(translationBox.getText()); + ArrayList usersInput = new ArrayList<>(); + usersInput.add(translationBox.getText()); - ArrayList correctTranslation = new ArrayList<>(); - correctTranslation.add(answer); + ArrayList correctTranslation = new ArrayList<>(); + correctTranslation.add(answer); - Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish); + Question.checkAnswer(correctTranslation, usersInput, AssessmentGenerator.isEnglish); - AssessmentGenerator.goToNextQuestion(); + AssessmentGenerator.goToNextQuestion(); - } + } }