Updated flashcard to display based on the language sort.

This commit is contained in:
top19 2020-04-30 12:46:19 +01:00
parent 0c56cfd033
commit 70edefd4a6
3 changed files with 27 additions and 10 deletions

View file

@ -71,8 +71,13 @@ 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);
testWord.setText(Application.practiceList.getFirst().getWelsh()); if(isSortedByEnglish){
wordType.setText("Welsh"); testWord.setText(Application.practiceList.getFirst().getEnglish());
wordType.setText("English");
} else{
testWord.setText(Application.practiceList.getFirst().getWelsh());
wordType.setText("Welsh");
}
updateCounter(); updateCounter();
card = flashcard; card = flashcard;
@ -103,8 +108,14 @@ public class FlashcardController extends SharedCodeController {
index--; index--;
} }
updateCounter(); updateCounter();
testWord.setText(Application.practiceList.get(index).getWelsh());
wordType.setText("Welsh"); if(isSortedByEnglish){
testWord.setText(Application.practiceList.get(index).getEnglish());
wordType.setText("English");
} else{
testWord.setText(Application.practiceList.get(index).getWelsh());
wordType.setText("Welsh");
}
} }
/** /**
@ -120,8 +131,14 @@ public class FlashcardController extends SharedCodeController {
} }
updateCounter(); updateCounter();
testWord.setText(Application.practiceList.get(index).getWelsh()); if(isSortedByEnglish){
wordType.setText("Welsh"); testWord.setText(Application.practiceList.get(index).getEnglish());
wordType.setText("English");
} else{
testWord.setText(Application.practiceList.get(index).getWelsh());
wordType.setText("Welsh");
}
} }
/** /**

View file

@ -20,7 +20,7 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
* @see AssessmentGenerator * @see AssessmentGenerator
*/ */
abstract public class SharedCodeController { abstract public class SharedCodeController {
static boolean isSortedByEnglish = true;
static int sideBarWidth = 50; static int sideBarWidth = 50;
// /////////////////// // // /////////////////// //
@ -151,7 +151,7 @@ abstract public class SharedCodeController {
@FXML @FXML
private void flashcardIconClick() { private void flashcardIconClick() {
if(Application.practiseList.size() == 0) { // Check to see if there are any practice words before switching scene, throwing an alert notifying them that they can't switch scenes. if(Application.practiceList.size() == 0) { // Check to see if there are any practice words before switching scene, throwing an alert notifying them that they can't switch scenes.
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error"); alert.setTitle("Error");
alert.setHeaderText("Unable to use Flashcard"); alert.setHeaderText("Unable to use Flashcard");
@ -170,7 +170,7 @@ abstract public class SharedCodeController {
*/ */
@FXML @FXML
private void studyIconClick() { private void studyIconClick() {
AssessmentGenerator.generateAssessment(Application.practiseList); AssessmentGenerator.generateAssessment(Application.practiceList);
} }
/** /**

View file

@ -126,7 +126,7 @@
<children> <children>
<StackPane alignment="CENTER" onMouseClicked="#handleFlashcardClick" minWidth="500"> <StackPane alignment="CENTER" onMouseClicked="#handleFlashcardClick" minWidth="500">
<children> <children>
<ImageView fx:id="flashcard" fitWidth="500" fitHeight="360"></ImageView> <ImageView fx:id="flashcard" fitWidth="450" fitHeight="360"></ImageView>
<Text textAlignment="CENTER" fx:id="testWord"> <Text textAlignment="CENTER" fx:id="testWord">
<font> <font>
<Font size="55"/> <Font size="55"/>