From 706ff1085dd91a822f802eb9d6184efb7f65dd82 Mon Sep 17 00:00:00 2001 From: top19 Date: Thu, 30 Apr 2020 16:55:42 +0100 Subject: [PATCH] Updated documentation for Flashcard and SharedCodeController. --- .../group20/javafx/FlashcardController.java | 42 +++++++++---------- .../group20/javafx/SharedCodeController.java | 5 +++ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/FlashcardController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/FlashcardController.java index e80bda4..f3eeda8 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/FlashcardController.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/FlashcardController.java @@ -71,17 +71,17 @@ public class FlashcardController extends SharedCodeController { flashcardIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/flashcard-50.png")); flashcardsText.setFill(Color.BLACK); - if(isSortedByEnglish){ + if(isSortedByEnglish){ // If the current language ordering is by english, display the english word first. testWord.setText(Application.practiceList.getFirst().getEnglish()); wordType.setText("English"); - } else{ + } else{ // Else display the word definition first. testWord.setText(Application.practiceList.getFirst().getWelsh()); wordType.setText("Welsh"); } updateCounter(); card = flashcard; - flashcard.setImage(new Image("file:src/main/resources/assets/flashcard/Flashcard.png")); + flashcard.setImage(new Image("file:src/main/resources/assets/flashcard/FlashCard.png")); leftArrow.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/left-50.png")); rightArrow.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/right-50.png")); } @@ -106,15 +106,15 @@ public class FlashcardController extends SharedCodeController { // If statement to check the start of the practiceList hasn't been reached before moving to the previous card. if (index > 0) { index--; - } - updateCounter(); + updateCounter(); - if(isSortedByEnglish){ - testWord.setText(Application.practiceList.get(index).getEnglish()); - wordType.setText("English"); - } else{ - testWord.setText(Application.practiceList.get(index).getWelsh()); - wordType.setText("Welsh"); + if (isSortedByEnglish) { // If the current language ordering is by english, display the english word first. + testWord.setText(Application.practiceList.get(index).getEnglish()); + wordType.setText("English"); + } else { // Else display the word definition first. + testWord.setText(Application.practiceList.get(index).getWelsh()); + wordType.setText("Welsh"); + } } } @@ -126,19 +126,19 @@ public class FlashcardController extends SharedCodeController { @FXML private void handleNextCard() { // If statement to check the end of the practiceList hasn't been reached before moving to the next card. - if (index < Application.practiceList.size()-1) { + if (index < Application.practiceList.size() - 1) { index++; - } - updateCounter(); + updateCounter(); - if(isSortedByEnglish){ - testWord.setText(Application.practiceList.get(index).getEnglish()); - wordType.setText("English"); - } else{ - testWord.setText(Application.practiceList.get(index).getWelsh()); - wordType.setText("Welsh"); - } + if (isSortedByEnglish) { // If the current language ordering is by english, display the english word first. + testWord.setText(Application.practiceList.get(index).getEnglish()); + wordType.setText("English"); + } else { // Else display the word definition first. + testWord.setText(Application.practiceList.get(index).getWelsh()); + wordType.setText("Welsh"); + } + } } /** diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/SharedCodeController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/SharedCodeController.java index 4b567dc..94ba67c 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/SharedCodeController.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/SharedCodeController.java @@ -20,6 +20,11 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry; * @see AssessmentGenerator */ abstract public class SharedCodeController { + + // //////////////// // + // Class variables. // + // //////////////// // + static boolean isSortedByEnglish = true; static int sideBarWidth = 50;