Updated documentation for Flashcard and SharedCodeController.

This commit is contained in:
top19 2020-04-30 16:55:42 +01:00
parent 05fb74f9e8
commit 706ff1085d
2 changed files with 26 additions and 21 deletions

View file

@ -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")); flashcardIcon.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/flashcard-50.png"));
flashcardsText.setFill(Color.BLACK); 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()); testWord.setText(Application.practiceList.getFirst().getEnglish());
wordType.setText("English"); wordType.setText("English");
} else{ } else{ // Else display the word definition first.
testWord.setText(Application.practiceList.getFirst().getWelsh()); testWord.setText(Application.practiceList.getFirst().getWelsh());
wordType.setText("Welsh"); wordType.setText("Welsh");
} }
updateCounter(); updateCounter();
card = flashcard; 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")); 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")); rightArrow.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
} }
@ -106,17 +106,17 @@ 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 statement to check the start of the practiceList hasn't been reached before moving to the previous card.
if (index > 0) { if (index > 0) {
index--; index--;
}
updateCounter(); updateCounter();
if(isSortedByEnglish){ if (isSortedByEnglish) { // If the current language ordering is by english, display the english word first.
testWord.setText(Application.practiceList.get(index).getEnglish()); testWord.setText(Application.practiceList.get(index).getEnglish());
wordType.setText("English"); wordType.setText("English");
} else{ } else { // Else display the word definition first.
testWord.setText(Application.practiceList.get(index).getWelsh()); testWord.setText(Application.practiceList.get(index).getWelsh());
wordType.setText("Welsh"); wordType.setText("Welsh");
} }
} }
}
/** /**
* Event that switches to the next flashcard whenever the user clicks the 'right-arrow' icon. * Event that switches to the next flashcard whenever the user clicks the 'right-arrow' icon.
@ -128,18 +128,18 @@ public class FlashcardController extends SharedCodeController {
// If statement to check the end of the practiceList hasn't been reached before moving to the next card. // 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++; index++;
}
updateCounter(); updateCounter();
if(isSortedByEnglish){ if (isSortedByEnglish) { // If the current language ordering is by english, display the english word first.
testWord.setText(Application.practiceList.get(index).getEnglish()); testWord.setText(Application.practiceList.get(index).getEnglish());
wordType.setText("English"); wordType.setText("English");
} else{ } else { // Else display the word definition first.
testWord.setText(Application.practiceList.get(index).getWelsh()); testWord.setText(Application.practiceList.get(index).getWelsh());
wordType.setText("Welsh"); wordType.setText("Welsh");
} }
} }
}
/** /**
* Method that updates the onscreen counter of the current flashcard. * Method that updates the onscreen counter of the current flashcard.

View file

@ -20,6 +20,11 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
* @see AssessmentGenerator * @see AssessmentGenerator
*/ */
abstract public class SharedCodeController { abstract public class SharedCodeController {
// //////////////// //
// Class variables. //
// //////////////// //
static boolean isSortedByEnglish = true; static boolean isSortedByEnglish = true;
static int sideBarWidth = 50; static int sideBarWidth = 50;