This commit is contained in:
Henry Dugmore 2020-04-30 15:49:36 +01:00
commit 3cdaa7d442
23 changed files with 724 additions and 361 deletions

View file

@ -17,6 +17,6 @@ module uk.ac.aber.cs22120.group20 {
exports uk.ac.aber.cs22120.group20.json to com.fasterxml.jackson.databind;
exports uk.ac.aber.cs22120.group20.javafx to javafx.graphics, javafx.fxml;
exports uk.ac.aber.cs22120.group20.test to org.junit.jupiter;
// exports uk.ac.aber.cs22120.group20.test to junit;
exports uk.ac.aber.cs22120.group20.test to org.junit.jupiter, org.testfx;
// exports uk.ac.aber.cs22120.group20.test to junit;
}

View file

@ -89,15 +89,15 @@ public class AddWordController extends SharedCodeController {
@FXML
protected void addButtonClick(ActionEvent actionEvent) {
String trueWordType;
DictionaryEntry.wordTypeEnum trueWordType;
if (wordType.getValue() == "Masculine noun") {
trueWordType = "nm";
trueWordType = DictionaryEntry.wordTypeEnum.nm;
} else if (wordType.getValue() == "Feminine noun") {
trueWordType = "nf";
trueWordType = DictionaryEntry.wordTypeEnum.nf;
} else if (wordType.getValue() == "Verb") {
trueWordType = "verb";
trueWordType = DictionaryEntry.wordTypeEnum.verb;
} else {
trueWordType = "other";
trueWordType = DictionaryEntry.wordTypeEnum.other;
}
boolean entryFound = false;
// test for one or more blank fields and if there is create the correct error dialogue box
@ -140,6 +140,7 @@ public class AddWordController extends SharedCodeController {
dictionaryEntry.setPracticeWord(true);
Application.dictionary.contains(dictionaryEntry);
Application.dictionary.add(dictionaryEntry);
Application.practiceList.add(dictionaryEntry);
//Resets values to blank for next word to be entered

View file

@ -1,14 +1,11 @@
/**
* @(#) App.java 0,1 2020/04/07
* @(#) Application.java 0,2 2020/04/30
* <p>
* Copyright (c) 2020 Aberystwyth University.
* All rights reserved.
*/
package uk.ac.aber.cs22120.group20.javafx;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
@ -16,9 +13,7 @@ import uk.ac.aber.cs22120.group20.json.JsonProcessing;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.LinkedList;
import java.util.Scanner;
/**
* A class that launches the Welsh Vocabulary tutor Application.
@ -31,89 +26,50 @@ import java.util.Scanner;
* @author Oscar Pocock [osp1]
* @author Waylen Watts [ncw]
* @author Luke Wybar [law39]
*
* @version 0.1 Initial development
*/
public class Application extends javafx.application.Application {
private JsonProcessing jsonProcessing = new JsonProcessing();
private Scanner scanner = new Scanner(System.in);
// Dictionary containing all the words.
public static LinkedList<DictionaryEntry> dictionary = new LinkedList<>();
public static LinkedList<DictionaryEntry> practiseList = new LinkedList<>();
// Practice list containing all the practice words.
public static LinkedList<DictionaryEntry> practiceList = new LinkedList<>();
// Json processor to import and export the json dictionary file.
private JsonProcessing jsonProcessing = new JsonProcessing();
/**
*
* @param stage
* @throws IOException
*/
@Override
public void start(Stage stage) throws IOException {
Scene scene;
File jsonFileLocation = null;
while(jsonFileLocation ==null) {
FileChooser fileChooser = new FileChooser();
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Json Files", "*.json"));
fileChooser.setTitle("Open Json File");
jsonFileLocation = fileChooser.showOpenDialog(stage);
}
final File jsonFileFinalLocation = jsonFileLocation;
dictionary = jsonProcessing.readInJson(jsonFileFinalLocation);
for (DictionaryEntry entry : dictionary) {
if (entry.isPracticeWord()) {
practiseList.add(entry);
}
}
// dictionary.add(new DictionaryEntry("abbey", "abaty", "nm", false));
// dictionary.add(new DictionaryEntry("believe", "credu", "verb", true));
// dictionary.add(new DictionaryEntry("concert", "cyngerdd", "nm", false));
// dictionary.add(new DictionaryEntry("disease", "clefyd", "nm", true));
// dictionary.add(new DictionaryEntry("extremely", "dros ben", "other", false));
// dictionary.add(new DictionaryEntry("flu", "ffliw", "nm", false));
new ScreenSwitch(stage);
// scene = new Scene(loadFXML("dictionary"));
// stage.setScene(scene);
// stage.setOnCloseRequest(e -> {
// jsonProcessing.writeOutJson(jsonFileLocation, dictionary);
// Platform.exit();
// System.exit(0);
// });
// stage.show();
// ScreenSwitch.setScene(scene);
}
/**
* @deprecated Please now use ScreenSwitch swap method with SceneEnum
* @param fxml
* @throws IOException
* @see ScreenSwitch
* @see ScreenSwitch.SceneEnum
*/
static void setRoot(String fxml) throws IOException {
ScreenSwitch.swap(ScreenSwitch.SceneEnum.dictionaryScene);
}
// /**
// *
// * @param fxml
// * @return
// * @throws IOException
// */
// private static Parent loadFXML(String fxml) throws IOException {
//// FXMLLoader fxmlLoader = new FXMLLoader(Application.class.getResource(fxml + ".fxml"));
// FXMLLoader fxmlLoader = new FXMLLoader(new URL("file:src/main/resources/uk/ac/aber/cs22120/group20/" + fxml + ".fxml"));
// return fxmlLoader.load();
// }
/**
*
* @param args
*/
public static void main(String[] args) {
launch();
}
/**
* @param stage
* @throws IOException
*/
@Override
public void start(Stage stage) throws IOException {
// Prompts the user to load their dictionary json file.
File jsonFileLocation = null;
while (jsonFileLocation == null) {
FileChooser fileChooser = new FileChooser();
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Json Files", "*.json"));
fileChooser.setTitle("Open Json File");
jsonFileLocation = fileChooser.showOpenDialog(stage);
}
final File jsonFileFinalLocation = jsonFileLocation;
dictionary = jsonProcessing.readInJson(jsonFileFinalLocation);
// Adds all words that are practice words to the practice list.
for (DictionaryEntry entry : dictionary) {
if (entry.isPracticeWord()) {
practiceList.add(entry);
}
}
new ScreenSwitch(stage);
}
}

View file

@ -12,7 +12,6 @@ import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
import javafx.scene.control.TableView;
@ -21,13 +20,9 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import uk.ac.aber.cs22120.group20.javafx.Application;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
/**
* A class that handles the keyboard and mouse input and interaction for the 'Dictionary Page' which is
@ -69,7 +64,7 @@ public class DictionaryController extends SharedCodeController {
*/
@FXML
private void switchLangSort() {
if (table.getSortOrder().contains(english)) {
if (isSortedByEnglish) {
if (welsh.getSortType().equals(TableColumn.SortType.ASCENDING)) {
alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png"));
}
@ -78,8 +73,10 @@ public class DictionaryController extends SharedCodeController {
}
table.getSortOrder().clear();
table.getSortOrder().add(welsh);
isSortedByEnglish = false;
}
else if (table.getSortOrder().contains(welsh)) {
else {
if (english.getSortType().equals(TableColumn.SortType.ASCENDING)) {
alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png"));
}
@ -88,8 +85,10 @@ public class DictionaryController extends SharedCodeController {
}
table.getSortOrder().clear();
table.getSortOrder().add(english);
isSortedByEnglish = true;
}
table.sort();
}
/**
@ -160,16 +159,16 @@ public class DictionaryController extends SharedCodeController {
if (row.getItem().isPracticeWord()) {
Application.dictionary.get(list.indexOf(row.getItem())).setPracticeWord(false);
ArrayList<DictionaryEntry> toRemove = new ArrayList<DictionaryEntry>();
for (DictionaryEntry entry : Application.practiseList) {
for (DictionaryEntry entry : Application.practiceList) {
if (entry.equals(row.getItem())) {
toRemove.add(entry);
}
}
Application.practiseList.removeAll(toRemove);
Application.practiceList.removeAll(toRemove);
// row.getItem().setPracticeWord(false);
} else if (!row.getItem().isPracticeWord()) {
Application.dictionary.get(list.indexOf(row.getItem())).setPracticeWord(true);
Application.practiseList.add(row.getItem());
Application.practiceList.add(row.getItem());
// row.getItem().setPracticeWord(true);
}
table.getSelectionModel().clearSelection();
@ -179,9 +178,9 @@ public class DictionaryController extends SharedCodeController {
}
);
welsh.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("nm")) {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.nm)) {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {nm}");
} else if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("nf")) {
} else if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.nf)) {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {nf}");
} else {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh());
@ -189,7 +188,7 @@ public class DictionaryController extends SharedCodeController {
});
english.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("verb")) {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.verb)) {
return new SimpleStringProperty("to " + dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
} else {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
@ -215,7 +214,7 @@ public class DictionaryController extends SharedCodeController {
result = true; // Filter matches English
// } else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseSearchFilter)) {
// result = true; // Filter matches Word Type
} else if (dictionaryEntry.getWordType().equals("verb") && ("to " + dictionaryEntry.getEnglish()).toLowerCase().contains(lowerCaseSearchFilter)) {
} else if (dictionaryEntry.getWordType().equals(DictionaryEntry.wordTypeEnum.verb) && ("to " + dictionaryEntry.getEnglish()).toLowerCase().contains(lowerCaseSearchFilter)) {
result = true; // Filter matches ['to' + a word] or [a word] if word is a verb
}
}
@ -229,7 +228,12 @@ public class DictionaryController extends SharedCodeController {
// english.setCellValueFactory(new PropertyValueFactory<DictionaryEntry, String>("english"));
table.setItems(sortedList);
table.getSortOrder().add(english);
if(isSortedByEnglish){
table.getSortOrder().add(english);
} else{
table.getSortOrder().add(welsh);
}
}
}

View file

@ -45,10 +45,10 @@ public class FlashcardController extends SharedCodeController {
@FXML
private Text wordType;
@FXML
private Rectangle flashcard;
@FXML
private Text testWord;
@FXML
private ImageView flashcard;
@FXML
private ImageView leftArrow;
@FXML
@ -71,14 +71,19 @@ 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);
testWord.setText(Application.practiseList.getFirst().getWelsh());
wordType.setText("Welsh");
if(isSortedByEnglish){
testWord.setText(Application.practiceList.getFirst().getEnglish());
wordType.setText("English");
} else{
testWord.setText(Application.practiceList.getFirst().getWelsh());
wordType.setText("Welsh");
}
updateCounter();
card = flashcard;
leftArrow.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/left-50.png")));
rightArrow.setImage(new Image(getClass().getResourceAsStream("/assets/icons/black_icons/50px/right-50.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"));
}
/**
@ -103,8 +108,14 @@ public class FlashcardController extends SharedCodeController {
index--;
}
updateCounter();
testWord.setText(Application.practiseList.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");
}
}
/**
@ -115,13 +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.practiseList.size()-1) {
if (index < Application.practiceList.size()-1) {
index++;
}
updateCounter();
testWord.setText(Application.practiseList.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");
}
}
/**
@ -130,7 +147,7 @@ public class FlashcardController extends SharedCodeController {
* @see DictionaryEntry
*/
private void updateCounter() {
counter.setText((index + 1) + "/" + Application.practiseList.size());
counter.setText((index + 1) + "/" + Application.practiceList.size());
}
/**
@ -157,10 +174,10 @@ public class FlashcardController extends SharedCodeController {
rotate.setOnFinished(event -> { // Once the transition is completed, update the text on the flashcard.
if (wordType.getText().equals("Welsh")) { // If the word currently on the flashcard is welsh, display the english translation.
testWord.setText(Application.practiseList.get(index).getEnglish());
testWord.setText(Application.practiceList.get(index).getEnglish());
wordType.setText("English");
} else { // Else display the welsh translation.
testWord.setText(Application.practiseList.get(index).getWelsh());
testWord.setText(Application.practiceList.get(index).getWelsh());
wordType.setText("Welsh");
}
testWord.setVisible(true);

View file

@ -8,6 +8,7 @@ package uk.ac.aber.cs22120.group20.javafx;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
@ -133,29 +134,57 @@ public class MatchTheMeaningController extends SharedCodeController {
*/
public void checkAnswers(){
ArrayList<DictionaryEntry> answers = new ArrayList<>();
ArrayList<String> listOfAnswers = new ArrayList<>();
answers.add(answer.get(Integer.parseInt(word1.getValue())-1));
answers.add(answer.get(Integer.parseInt(word2.getValue())-1));
answers.add(answer.get(Integer.parseInt(word3.getValue())-1));
answers.add(answer.get(Integer.parseInt(word4.getValue())-1));
if(isEnglish){
listOfAnswers.add(RightWord1.getText());
listOfAnswers.add(RightWord2.getText());
listOfAnswers.add(RightWord3.getText());
listOfAnswers.add(RightWord4.getText());
}else {
listOfAnswers.add(LeftWord1.getText());
listOfAnswers.add(LeftWord2.getText());
listOfAnswers.add(LeftWord3.getText());
listOfAnswers.add(LeftWord4.getText());
}else {
listOfAnswers.add(RightWord1.getText());
listOfAnswers.add(RightWord2.getText());
listOfAnswers.add(RightWord3.getText());
listOfAnswers.add(RightWord4.getText());
}
Question.checkAnswer(answer,listOfAnswers,isEnglish);
if(checkForDuplicates(answers)){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("Please check answers");
alert.setContentText("Please ensure you have selected answers for each test word, with no duplicates.");
alert.showAndWait();
}else {
Question.checkAnswer(answers, listOfAnswers, isEnglish);
answer.clear();
AssessmentGenerator.goToNextQuestion();
answer.clear();
AssessmentGenerator.goToNextQuestion();
}
}
private boolean checkForDuplicates(ArrayList<DictionaryEntry> wordSet){
boolean result = false;
Set<DictionaryEntry> set = new HashSet<>(wordSet);
if(set.size() < wordSet.size()){
result = true;
}
return result;
}
@FXML
@FXML
private void initialize() {
setup();
currentPageIcon.setImage(new Image("file:src/main/resources/assets/icons/white_icons/50px/pass-fail-50.png"));
@ -165,8 +194,8 @@ public class MatchTheMeaningController extends SharedCodeController {
studyText.setFill(Color.BLACK);
setWords(answer,orderList);
CorrectAnswer.setText(Integer.toString(Question.correctAnswers));
WrongAnswer.setText(Integer.toString(Question.wrongAnswers));
CorrectAnswer.setText(Integer.toString(AssessmentGenerator.getTotalCorrectAnswers()));
WrongAnswer.setText(Integer.toString(AssessmentGenerator.getTotalAnswers()));
}
}

View file

@ -11,20 +11,16 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList;
import javafx.css.converter.DurationConverter;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import uk.ac.aber.cs22120.group20.javafx.Application;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
/**
* A class that handles the keyboard and mouse input and interaction for the 'Dictionary Page' which is
@ -83,7 +79,7 @@ public class PracticeListController extends SharedCodeController{
langSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-lang-50.png"));
// list.addAll(Application.dictionary);
list.addAll(Application.practiseList);
list.addAll(Application.practiceList);
// for (DictionaryEntry entry : Application.dictionary) {
// if (entry.isPracticeWord())
// list.add(entry);
@ -109,7 +105,7 @@ public class PracticeListController extends SharedCodeController{
result = true; // Filter matches English
// } else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseSearchFilter)) {
// result = true; // Filter matches Word Type
} else if (dictionaryEntry.getWordType().equals("verb") && ("to " + dictionaryEntry.getEnglish()).toLowerCase().contains(lowerCaseSearchFilter)) {
} else if (dictionaryEntry.getWordType().equals(DictionaryEntry.wordTypeEnum.verb) && ("to " + dictionaryEntry.getEnglish()).toLowerCase().contains(lowerCaseSearchFilter)) {
result = true; // Filter matches ['to' + a word] or [a word] if word is a verb
}
}
@ -150,13 +146,13 @@ public class PracticeListController extends SharedCodeController{
}
ArrayList<DictionaryEntry> toRemove = new ArrayList<DictionaryEntry>();
for (DictionaryEntry entry : Application.practiseList) {
for (DictionaryEntry entry : Application.practiceList) {
if (entry.equals(row.getItem())) {
toRemove.add(entry);
list.remove(row.getItem());
}
}
Application.practiseList.removeAll(toRemove);
Application.practiceList.removeAll(toRemove);
table.getSelectionModel().clearSelection();
}
});
@ -166,9 +162,9 @@ public class PracticeListController extends SharedCodeController{
welsh.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("nm")) {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.nm)) {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {nm}");
} else if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("nf")) {
} else if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.nf)) {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {nf}");
} else {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh());
@ -176,7 +172,7 @@ public class PracticeListController extends SharedCodeController{
});
english.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("verb")) {
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.verb)) {
return new SimpleStringProperty("to " + dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
} else {
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
@ -184,12 +180,17 @@ public class PracticeListController extends SharedCodeController{
});
table.setItems(sortedList);
table.getSortOrder().add(english);
if(isSortedByEnglish){
table.getSortOrder().add(english);
} else{
table.getSortOrder().add(welsh);
}
}
@FXML
private void switchLangSort() {
if (table.getSortOrder().contains(english)) {
if (isSortedByEnglish) {
if (welsh.getSortType().equals(TableColumn.SortType.ASCENDING)) {
alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png"));
}
@ -198,8 +199,10 @@ public class PracticeListController extends SharedCodeController{
}
table.getSortOrder().clear();
table.getSortOrder().add(welsh);
isSortedByEnglish = false;
}
else if (table.getSortOrder().contains(welsh)) {
else {
if (english.getSortType().equals(TableColumn.SortType.ASCENDING)) {
alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png"));
}
@ -208,6 +211,8 @@ public class PracticeListController extends SharedCodeController{
}
table.getSortOrder().clear();
table.getSortOrder().add(english);
isSortedByEnglish = true;
}
table.sort();
}

View file

@ -20,7 +20,7 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
* @see AssessmentGenerator
*/
abstract public class SharedCodeController {
static boolean isSortedByEnglish = true;
static int sideBarWidth = 50;
// /////////////////// //
@ -151,7 +151,7 @@ abstract public class SharedCodeController {
@FXML
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.setTitle("Error");
alert.setHeaderText("Unable to use Flashcard");
@ -170,7 +170,7 @@ abstract public class SharedCodeController {
*/
@FXML
private void studyIconClick() {
AssessmentGenerator.generateAssessment(Application.practiseList);
AssessmentGenerator.generateAssessment(Application.practiceList);
}
/**

View file

@ -173,9 +173,9 @@ public class SixMeaningsController extends SharedCodeController {
setWords(allQuestions,orderList);
correctAnswer.setText(Integer.toString(Question.correctAnswers));
correctAnswer.setText("Correct answers:" +Integer.toString(AssessmentGenerator.getTotalCorrectAnswers()));
wrongAnswer.setText(Integer.toString(Question.wrongAnswers));
wrongAnswer.setText("Total answers:" +Integer.toString(AssessmentGenerator.getTotalAnswers()));
}

View file

@ -69,8 +69,8 @@ public class TranslationController extends SharedCodeController{
submitButton.setImage(new Image ("file:src/main/resources/assets/icons/black_icons/50px/right-50.png"));
correctGuesses.setText("Correct Guesses: " + Question.correctAnswers);
incorrectGuesses.setText("Incorrect Guesses: " + Question.wrongAnswers);
correctGuesses.setText("Correct answers: " + AssessmentGenerator.getTotalCorrectAnswers());
incorrectGuesses.setText("Total answers: " + AssessmentGenerator.getTotalAnswers());

View file

@ -26,7 +26,11 @@ import uk.ac.aber.cs22120.group20.javafx.DictionaryController;
public class DictionaryEntry {
private String english;
private String welsh;
private String wordType;
public enum wordTypeEnum {
nm, nf, verb, other
}
private wordTypeEnum wordType;
// private String wordType;
private Boolean practiceWord;
@ -46,9 +50,10 @@ public class DictionaryEntry {
* @see Application
* @see DictionaryController
*/
public DictionaryEntry(String english, String welsh, String wordType) {
public DictionaryEntry(String english, String welsh, wordTypeEnum wordType) {
this.english = english;
this.welsh = welsh;
// this.wordType = wordType;
this.wordType = wordType;
}
@ -68,15 +73,22 @@ public class DictionaryEntry {
this.welsh = welsh.trim();
}
public String getWordType() {
public wordTypeEnum getWordType() {
return wordType;
}
// public word getWordType() {
// return wordType;
// }
public void setWordType(String wordType) {
this.wordType = wordType.trim();
public void setWordType(wordTypeEnum wordType) {
this.wordType = wordType;
}
public Boolean isPracticeWord() {
// public void setWordType(String wordType) {
// this.wordType = wordType;
// }
public Boolean isPracticeWord() {
return practiceWord;
}
@ -87,6 +99,8 @@ public class DictionaryEntry {
@Override
public boolean equals(Object entry) {
DictionaryEntry otherEntry = (DictionaryEntry) entry;
return otherEntry.getEnglish().equals(this.getEnglish()) && otherEntry.getWelsh().equals(this.getWelsh()) && otherEntry.getWordType().equals(this.getWordType());
return otherEntry.getEnglish().equals(this.getEnglish()) &&
otherEntry.getWelsh().equals(this.getWelsh()) &&
otherEntry.getWordType().equals(this.getWordType());
}
}

View file

@ -7,6 +7,7 @@ import javafx.scene.control.ButtonType;
import uk.ac.aber.cs22120.group20.javafx.*;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.text.DecimalFormat;
import java.util.*;
@ -14,14 +15,30 @@ import java.util.*;
* Class that contains methods to create a randomised list of questions that will
* contain a random distribution of question types.
*
* @Author
* @Version
* @See
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @See Question
* @See SixMeaningsQuestion
* @See TranslationQuestion
* @See MatchTheMeaningQuestion
* @See ScreenSwitch
* @See SixMeaningsController
* @See TranslationController
* @See MatchTheMeaningController
*/
public class AssessmentGenerator {
public static boolean isEnglish;
static LinkedList<Question> listOfAssessment = new LinkedList<>();
static int currentAssessment = 0;
static int totalCorrectAnswers = 0;
static int totalAnswers = 0;
/**
* Method that will generate a randomized list of questions consisting of random distribution of questions
@ -34,6 +51,8 @@ public class AssessmentGenerator {
LinkedList<Question> listOfAssessment = new LinkedList<>();
Random rand = new Random();
reset();
//int wordToTranslatePlace;
if (practiseList.size()<5){
@ -52,21 +71,20 @@ public class AssessmentGenerator {
case (0): //0 Means translation test.
//wordToTranslatePlace = rand.nextInt(Application.practiseList.size());
//wordToTranslate = Application.practiseList.get(wordToTranslatePlace);
if(!(listOfAssessment.getLast() == null) || (listOfAssessment.getLast() instanceof TranslationQuestion)){
if((listOfAssessment.isEmpty()) || !(listOfAssessment.getLast() instanceof TranslationQuestion)){
generatedAssessment = generateTranslationTest(practiseList);
}else {
numberToGenerate--;
break;
}
generatedAssessment = generateTranslationTest(practiseList);
break;
case (1): //1 Means six meanings test.
//wordToTranslatePlace = rand.nextInt(Application.practiseList.size());
//wordToTranslate = Application.practiseList.get(wordToTranslatePlace);
if(!(listOfAssessment.getLast() == null) || (listOfAssessment.getLast() instanceof SixMeaningsQuestion)){
if(((listOfAssessment.isEmpty())) || !(listOfAssessment.getLast() instanceof SixMeaningsQuestion)){
generatedAssessment = generateSixMeanings(practiseList);
}else {
numberToGenerate--;
break;
}
generatedAssessment = generateSixMeanings(practiseList);
break;
case (2): //2 Means match meanings test.
// LinkedList<DictionaryEntry> wordsToTranslate = new LinkedList<>();
@ -75,15 +93,16 @@ public class AssessmentGenerator {
// wordsToTranslate.add(Application.practiseList.get(wordToTranslatePlace));
// wordsToTranslate.toArray();
// }
if(!(listOfAssessment.getLast() == null) || (listOfAssessment.getLast() instanceof MatchTheMeaningQuestion)){
if((listOfAssessment.isEmpty()) || !(listOfAssessment.getLast() instanceof MatchTheMeaningQuestion)){
generatedAssessment = generateMatchMeaning(practiseList);
}else {
numberToGenerate--;
break;
}
generatedAssessment = generateMatchMeaning(practiseList);
break;
}
listOfAssessment.add(generatedAssessment);
if(generatedAssessment != null) {
listOfAssessment.add(generatedAssessment);
}
}
AssessmentGenerator.listOfAssessment = listOfAssessment;
goToNextQuestion();
@ -150,7 +169,11 @@ public class AssessmentGenerator {
public static void goToNextQuestion() {
if (currentAssessment > 0){
Question.showFeedback();
}
if (currentAssessment < 10) {
Question currentQuestion = listOfAssessment.get(currentAssessment);
if (currentQuestion instanceof MatchTheMeaningQuestion) {
@ -166,14 +189,14 @@ public class AssessmentGenerator {
System.err.print("The question has not been recognised");
System.err.println(currentQuestion);
}
currentAssessment++;
} else {
StringBuilder sb = new StringBuilder();
sb.append("You scored: ")
.append(Question.correctAnswers).append("/")
.append(Question.correctAnswers + Question.wrongAnswers)
sb.append("You got ")
.append(new DecimalFormat("#.##").format(((double)(totalCorrectAnswers*100) / (double)totalAnswers)))
.append("%")
.append("\n Would you like to test yourself again?");
ButtonType yesBtn = new ButtonType("Yes");
@ -192,15 +215,28 @@ public class AssessmentGenerator {
Optional<ButtonType> result = alert.showAndWait();
currentAssessment = 0;
Question.resetScore();
reset();
if (result.isEmpty() || result.get() == noBtn) {
ScreenSwitch.swap(ScreenSwitch.SceneEnum.dictionaryScene);
} else {
generateAssessment(Application.practiseList);
generateAssessment(Application.practiceList);
}
}
}
public static int getTotalCorrectAnswers() {
return totalCorrectAnswers;
}
public static int getTotalAnswers() {
return totalAnswers;
}
public static void reset(){
totalCorrectAnswers = 0;
totalAnswers =0;
LinkedList<Question> listOfAssessment = new LinkedList<>();
currentAssessment = 0;
}
}

View file

@ -5,6 +5,21 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Class used to create a MatchTheMeaning Question.
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @See Question
*/
public class MatchTheMeaningQuestion extends Question {
private ArrayList<DictionaryEntry> correctAnswer = new ArrayList<>();

View file

@ -1,5 +1,8 @@
package uk.ac.aber.cs22120.group20.selfassessment;
import javafx.scene.control.Alert;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.util.ArrayList;
@ -9,40 +12,100 @@ import java.util.ArrayList;
* Abstract class contains the basic information that all the shared information between the
* types of test questions including the questions correct answers and possible answers. All question
* classes will extend this class.
* @Author
* @Version
* @See
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
*/
public class Question {
public static int correctAnswers = 0;
public static int wrongAnswers =0;
public static StringBuilder sb = new StringBuilder();
/**
/** Function that checks the answers of
*
* @param listOfCorrectQuestions
* @param listOfAnswers
* @param isEnglish
* @param listOfCorrectQuestions List of the right answers to the question.
* @param listOfAnswers List of the answers the user input.
* @param isEnglish Boolean for if the test is English To Welsh or Welsh To English
*/
public static void checkAnswer(ArrayList<DictionaryEntry> listOfCorrectQuestions, ArrayList<String>listOfAnswers, boolean isEnglish){
if(isEnglish){
for(int i=0; i<listOfCorrectQuestions.size();i++){
sb
.append("'").append(listOfCorrectQuestions.get(i).getEnglish()).append("'")
.append(" is the English for ")
.append("'").append(listOfCorrectQuestions.get(i).getWelsh()).append("'")
.append(". ");
if(listOfCorrectQuestions.get(i).getWelsh().equals(listOfAnswers.get(i))){
sb.append("Correct!");
correctAnswers++;
}else wrongAnswers++;
}else{
sb.append("'").append(listOfAnswers.get(i)).append("'").append(" is incorrect.");
wrongAnswers++;
}
sb.append("\n");
}
}else{
for(int i=0; i<listOfCorrectQuestions.size();i++){
sb
.append("'").append(listOfCorrectQuestions.get(i).getEnglish()).append("'")
.append(" is the English for ")
.append("'").append(listOfCorrectQuestions.get(i).getWelsh()).append("'")
.append(". ");
if(listOfCorrectQuestions.get(i).getEnglish().equals(listOfAnswers.get(i))){
sb.append("Correct!");
correctAnswers++;
}else wrongAnswers++;
}else{
sb.append("'").append(listOfAnswers.get(i)).append("'").append(" is incorrect.");
wrongAnswers++;
}
sb.append("\n");
}
}
}
public static void resetScore(){
correctAnswers = 0;
wrongAnswers =0;
}
}
/**
* Function for giving user positive or negative feedback for when they answer a question during an assessment.
*/
static void showFeedback(){
Alert alert = new Alert(Alert.AlertType.INFORMATION);
StringBuilder sb = new StringBuilder();
sb.append("You got ").append(correctAnswers).append(" out of ").append(correctAnswers+wrongAnswers).append("\n");
sb.append(Question.sb.toString());
alert.setTitle("You finished this part of the assessment!");
alert.setHeaderText("You finished this part of the assessment!");
Label label = new Label(sb.toString());
label.setWrapText(true);
alert.getDialogPane().setContent(label);
alert.showAndWait();
Question.sb = new StringBuilder();
AssessmentGenerator.totalCorrectAnswers += correctAnswers;
AssessmentGenerator.totalAnswers += (wrongAnswers + correctAnswers);
resetScore();
}
/**
* Resets the score to 0 for the next test.
*/
private static void resetScore(){
correctAnswers = 0;
wrongAnswers =0;
}
}

View file

@ -7,6 +7,19 @@ import java.util.ArrayList;
import java.util.Dictionary;
import java.util.LinkedList;
import java.util.Random;
/**
* Class used to create a SixMeanings Question.
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @See Question
*/
public class SixMeaningsQuestion extends Question{
private DictionaryEntry correctAnswer;
@ -17,6 +30,11 @@ public class SixMeaningsQuestion extends Question{
this.dictionary = dictionary;
}
/** Function to retrieve the correct answer to a SixMeaningsQuestion.
*
* @return Retrieves the correct answer
*/
public ArrayList<DictionaryEntry> getCorrectAnswer() {
Random rand = new Random();

View file

@ -4,6 +4,20 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import java.util.LinkedList;
/**
* Class used to create a MatchTheMeaning Question.
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @See Question
*/
public class TranslationQuestion extends Question {
private DictionaryEntry correctAnswer;

View file

@ -0,0 +1,158 @@
package uk.ac.aber.cs22120.group20.test;
import org.junit.jupiter.api.Test;
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
import uk.ac.aber.cs22120.group20.selfassessment.AssessmentGenerator;
import uk.ac.aber.cs22120.group20.selfassessment.Question;
import uk.ac.aber.cs22120.group20.selfassessment.TranslationQuestion;
import java.util.ArrayList;
import java.util.LinkedList;
import static org.junit.jupiter.api.Assertions.*;
import static uk.ac.aber.cs22120.group20.json.DictionaryEntry.wordTypeEnum.verb;
/**
* Class that contains methods which will be used to test the Question class, and its methods.
* @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1]
* @author Waylen Watts [ncw]
* @version 0.1 Initial development
* @See Question
*/
class QuestionTest {
/**
* Tests that the correctAnswers variable increments when a user gets a right answer
* when doing either a Translation or SixMeanings test.
*/
@Test
void testCheckRightAnswerTranslationOrSixMeanings() {
ArrayList<DictionaryEntry> correctAnswerList = new ArrayList<>();
ArrayList<String> correctEntryList = new ArrayList<>();
DictionaryEntry wordToTest = new DictionaryEntry("english1", "welsh1",verb);
boolean isEnglish = true;
correctAnswerList.add(wordToTest);
correctEntryList.add(wordToTest.getWelsh());
Question question;
Question.checkAnswer(correctAnswerList, correctEntryList, isEnglish);
assertEquals(1, Question.correctAnswers);
}
/**
* Tests that the wrongAnswers variable increments when a user gets a wrong answer
* when doing either a Translation or SixMeanings test.
*/
@Test
void testCheckWrongAnswerTranslationOrSixMeanings() {
ArrayList<DictionaryEntry> correctAnswerList = new ArrayList<>();
ArrayList<String> correctEntryList = new ArrayList<>();
DictionaryEntry wordToTest = new DictionaryEntry("english1", "welsh1",verb);
boolean isEnglish = true;
correctAnswerList.add(wordToTest);
correctEntryList.add("incorrectValue");
Question question;
Question.resetScore();
Question.checkAnswer(correctAnswerList, correctEntryList, isEnglish);
assertEquals(1, Question.wrongAnswers);
}
/**
* Tests that the correctAnswers variable increments when a user gets a right answer
* when doing either a MatchTheMeaning test.
*/
@Test
void testCheckRightAnswerMatchMeaning(){
ArrayList<DictionaryEntry> correctAnswerList = new ArrayList<>();
ArrayList<String> correctEntryList = new ArrayList<>();
DictionaryEntry wordToTest1 = new DictionaryEntry("english1", "welsh1",verb);
DictionaryEntry wordToTest2 = new DictionaryEntry("english2", "welsh2",verb);
DictionaryEntry wordToTest3 = new DictionaryEntry("english3", "welsh3",verb);
DictionaryEntry wordToTest4 = new DictionaryEntry("english4", "welsh4",verb);
boolean isEnglish = true;
correctAnswerList.add(wordToTest1);
correctAnswerList.add(wordToTest2);
correctAnswerList.add(wordToTest3);
correctAnswerList.add(wordToTest4);
correctEntryList.add("welsh1");
correctEntryList.add("welsh2");
correctEntryList.add("welsh3");
correctEntryList.add("welsh4");
AssessmentGenerator.isEnglish = true;
Question.resetScore();
Question.checkAnswer(correctAnswerList, correctEntryList, isEnglish);
assertEquals(4, Question.correctAnswers);
}
/**
* Tests that the wrongAnswers variable increments when a user gets a wrong answer
* when doing either a MatchTheMeaning test.
*/
@Test
void testCheckWrongAnswerMatchMeaning(){
ArrayList<DictionaryEntry> correctAnswerList = new ArrayList<>();
ArrayList<String> correctEntryList = new ArrayList<>();
DictionaryEntry wordToTest1 = new DictionaryEntry("english1", "welsh1",verb);
DictionaryEntry wordToTest2 = new DictionaryEntry("english2", "welsh2",verb);
DictionaryEntry wordToTest3 = new DictionaryEntry("english3", "welsh3",verb);
DictionaryEntry wordToTest4 = new DictionaryEntry("english4", "welsh4",verb);
correctAnswerList.add(wordToTest1);
correctAnswerList.add(wordToTest2);
correctAnswerList.add(wordToTest3);
correctAnswerList.add(wordToTest4);
correctEntryList.add("");
correctEntryList.add("");
correctEntryList.add("");
correctEntryList.add("");
boolean isEnglish = true;
Question.checkAnswer(correctAnswerList, correctEntryList, isEnglish);
assertEquals(4, Question.wrongAnswers);
}
@Test
void resetScore() {
Question.wrongAnswers = 5;
Question.correctAnswers = 5;
Question.resetScore();
assertEquals(0, Question.correctAnswers);
assertEquals(0, Question.wrongAnswers);
}
}

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
@ -124,11 +124,10 @@
<Insets top="25" right="25" bottom="10" left="25"/>
</padding>
<children>
<StackPane alignment="CENTER" onMouseClicked="#handleFlashcardClick" VBox.vgrow="NEVER" minWidth="350">
<StackPane alignment="CENTER" onMouseClicked="#handleFlashcardClick" minWidth="500">
<children>
<Rectangle fx:id="flashcard" width="550" height="360" fill="white" arcHeight="80" arcWidth="80"
stroke="black"/>
<Text textAlignment="CENTER" fx:id="testWord">
<ImageView fx:id="flashcard" fitWidth="450" fitHeight="360"></ImageView>
<Text textAlignment="CENTER" fx:id="testWord">
<font>
<Font size="55"/>
</font>

View file

@ -5,78 +5,73 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="uk.ac.aber.cs22120.group20.javafx.MatchTheMeaningController"
fx:id="container"
minWidth="450"
minHeight="550"
>
<?import javafx.scene.text.Text?>
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.MatchTheMeaningController">
<left>
<StackPane fx:id="outerBar">
<Rectangle fx:id="sideBar" fill="dimgray" height="${outerBar.height}" width="50"></Rectangle>
<Rectangle fx:id="sideBar" fill="dimgray" height="${outerBar.height}" width="50" />
<VBox spacing="300">
<VBox alignment="TOP_CENTER" maxHeight="${outerBar.height}">
<StackPane onMouseClicked="#dictionaryIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="dictionaryText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="dictionaryIcon"></ImageView>
<ImageView fx:id="dictionaryIcon" />
</HBox>
</StackPane>
<StackPane onMouseClicked="#practiceListIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="practiceListTest" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="practiceListIcon"></ImageView>
<ImageView fx:id="practiceListIcon" />
</HBox>
</StackPane>
<StackPane onMouseClicked="#flashcardIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="flashcardsText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="flashcardIcon"></ImageView>
<ImageView fx:id="flashcardIcon" />
</HBox>
</StackPane>
<StackPane onMouseClicked="#studyIconClick">
<Rectangle fill="white" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="white" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="studyText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="studyIcon"></ImageView>
<ImageView fx:id="studyIcon" />
</HBox>
</StackPane>
@ -85,15 +80,15 @@
<StackPane alignment="BOTTOM_CENTER" onMouseClicked="#addWordIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="addDefinitionText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="addDefinitionIcon"></ImageView>
<ImageView fx:id="addDefinitionIcon" />
</HBox>
</StackPane>
@ -105,18 +100,18 @@
<top>
<StackPane fx:id="topBar">
<Rectangle fx:id="parentRectangle" fill="dimgray" width="${topBar.width}" height="50"></Rectangle>
<HBox alignment="CENTER_LEFT" prefWidth="${topBar.width}" spacing="7">
<Rectangle fx:id="parentRectangle" fill="dimgray" height="50" width="${topBar.width}" />
<HBox alignment="CENTER_LEFT" prefWidth="${topBar.width}" spacing="7">
<StackPane onMouseClicked="#expandMenuClick">
<Rectangle fill="dimgray" width="55" height="50"></Rectangle>
<ImageView fx:id="expandMenuIcon"></ImageView>
<Rectangle fill="dimgray" height="50" width="55" />
<ImageView fx:id="expandMenuIcon" />
</StackPane>
<ImageView fx:id="currentPageIcon"></ImageView>
<ImageView fx:id="currentPageIcon" />
<Text fx:id="currentPageText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
</HBox>
@ -124,10 +119,10 @@
</StackPane>
</top>
<center>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" BorderPane.alignment="CENTER">
<children>
<Button fx:id="ConfirmButton" layoutX="271.0" layoutY="321.0" mnemonicParsing="false" text="Confirm" onAction="#checkAnswers" />
<Label layoutX="248.0" layoutY="356.0" text="Match the meaning" />
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="400.0" prefWidth="600.0">
<Button fx:id="ConfirmButton" layoutX="271.0" layoutY="321.0" mnemonicParsing="false" onAction="#checkAnswers" text="Confirm" />
<ComboBox fx:id="word1" layoutX="448.0" layoutY="118.0" prefHeight="25.0" prefWidth="58.0" value="1">
<items>
<FXCollections fx:factory="observableArrayList">
@ -168,27 +163,83 @@
</FXCollections>
</items>
</ComboBox>
<Label fx:id="RightWord1" layoutX="343.0" layoutY="122.0" text="Welsh word#3" />
<Label fx:id="RightWord2" layoutX="343.0" layoutY="157.0" text="Welsh word#2" />
<Label fx:id="RightWord3" layoutX="343.0" layoutY="192.0" text="Welsh word#1" />
<Label fx:id="RightWord4" layoutX="343.0" layoutY="227.0" text="Welsh word#4" />
<Label fx:id="LeftWord1" layoutX="115.0" layoutY="122.0" text="English Word #1" />
<Label fx:id="LeftWord2" layoutX="115.0" layoutY="157.0" text="English Word #2" />
<Label fx:id="LeftWord3" layoutX="115.0" layoutY="192.0" text="English Word #3" />
<Label fx:id="LeftWord4" layoutX="115.0" layoutY="227.0" text="English Word #4" />
<Label layoutX="105.0" layoutY="122.0" text="1." />
<Label layoutX="105.0" layoutY="157.0" text="2." />
<Label layoutX="105.0" layoutY="192.0" text="3." />
<Label layoutX="105.0" layoutY="227.0" text="4." />
<Label layoutX="367.0" layoutY="23.0" text="Correct answers:" />
<Label layoutX="368.0" layoutY="53.0" text="Wrong answers:" />
<Label fx:id="CorrectAnswer" layoutX="463.0" layoutY="23.0" text="0" />
<Label fx:id="WrongAnswer" layoutX="463.0" layoutY="53.0" text="0" />
<Label fx:id="RightWord1" layoutX="319.0" layoutY="122.0" text="Welsh word#3">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="RightWord2" layoutX="319.0" layoutY="157.0" text="Welsh word#2">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="RightWord3" layoutX="319.0" layoutY="192.0" text="Welsh word#1">
<font>
<Font size="14.0" />
</font></Label>
<Label fx:id="RightWord4" layoutX="319.0" layoutY="227.0" text="Welsh word#4">
<font>
<Font size="14.0" />
</font></Label>
<Label fx:id="LeftWord1" layoutX="122.0" layoutY="122.0" text="English Word #1">
<font>
<Font size="14.0" />
</font></Label>
<Label fx:id="LeftWord2" layoutX="122.0" layoutY="157.0" text="English Word #2">
<font>
<Font size="14.0" />
</font></Label>
<Label fx:id="LeftWord3" layoutX="122.0" layoutY="192.0" text="English Word #3">
<font>
<Font size="14.0" />
</font></Label>
<Label fx:id="LeftWord4" layoutX="122.0" layoutY="227.0" text="English Word #4">
<font>
<Font size="14.0" />
</font></Label>
<Label layoutX="105.0" layoutY="122.0" text="1.">
<font>
<Font size="14.0" />
</font></Label>
<Label layoutX="105.0" layoutY="157.0" text="2.">
<font>
<Font size="14.0" />
</font></Label>
<Label layoutX="105.0" layoutY="192.0" text="3.">
<font>
<Font size="14.0" />
</font></Label>
<Label layoutX="105.0" layoutY="227.0" text="4.">
<font>
<Font size="14.0" />
</font></Label>
<Label layoutX="334.0" layoutY="19.0" text="Correct answers:">
<font>
<Font size="17.0" />
</font>
</Label>
<Label layoutX="328.0" layoutY="53.0" text="Total answers:">
<font>
<Font size="17.0" />
</font>
</Label>
<Label fx:id="CorrectAnswer" layoutX="472.0" layoutY="19.0" text="0">
<font>
<Font size="17.0" />
</font>
</Label>
<Label fx:id="WrongAnswer" layoutX="472.0" layoutY="53.0" text="0">
<font>
<Font size="17.0" />
</font>
</Label>
<Text fill="#8d8d8d" layoutX="197.0" layoutY="379.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Match The Meaning">
<font>
<Font name="System Italic" size="24.0" />
</font>
</Text>
</AnchorPane>
</children>
</Pane>
</center>
</BorderPane>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.PrimaryController">
<children>
<Label text="Primary View" />
<Button fx:id="primaryButton" text="Switch to Secondary View" onAction="#switchToSecondary"/>
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.SecondaryController">
<children>
<Label text="Secondary View" />
<Button fx:id="secondaryButton" text="Switch to Primary View" onAction="#switchToPrimary" />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>

View file

@ -1,73 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.Label?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="uk.ac.aber.cs22120.group20.javafx.SixMeaningsController"
fx:id="container"
minWidth="450"
minHeight="550"
>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<BorderPane fx:id="container" minHeight="550" minWidth="450" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uk.ac.aber.cs22120.group20.javafx.SixMeaningsController">
<left>
<StackPane fx:id="outerBar">
<Rectangle fx:id="sideBar" fill="dimgray" height="${outerBar.height}" width="50"></Rectangle>
<Rectangle fx:id="sideBar" fill="dimgray" height="${outerBar.height}" width="50" />
<VBox spacing="300">
<VBox alignment="TOP_CENTER" maxHeight="${outerBar.height}">
<StackPane onMouseClicked="#dictionaryIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="dictionaryText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="dictionaryIcon"></ImageView>
<ImageView fx:id="dictionaryIcon" />
</HBox>
</StackPane>
<StackPane onMouseClicked="#practiceListIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="practiceListTest" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="practiceListIcon"></ImageView>
<ImageView fx:id="practiceListIcon" />
</HBox>
</StackPane>
<StackPane onMouseClicked="#flashcardIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="flashcardsText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="flashcardIcon"></ImageView>
<ImageView fx:id="flashcardIcon" />
</HBox>
</StackPane>
<StackPane onMouseClicked="#studyIconClick">
<Rectangle fill="white" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="white" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="studyText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="studyIcon"></ImageView>
<ImageView fx:id="studyIcon" />
</HBox>
</StackPane>
@ -76,15 +76,15 @@
<StackPane alignment="BOTTOM_CENTER" onMouseClicked="#addWordIconClick">
<Rectangle fill="dimgray" height="60" width="${sideBar.width}"></Rectangle>
<Rectangle fill="dimgray" height="60" width="${sideBar.width}" />
<HBox alignment="CENTER_RIGHT">
<Text fx:id="addDefinitionText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
<ImageView fx:id="addDefinitionIcon"></ImageView>
<ImageView fx:id="addDefinitionIcon" />
</HBox>
</StackPane>
@ -96,18 +96,18 @@
<top>
<StackPane fx:id="topBar">
<Rectangle fx:id="parentRectangle" fill="dimgray" width="${topBar.width}" height="50"></Rectangle>
<HBox alignment="CENTER_LEFT" prefWidth="${topBar.width}" spacing="7">
<Rectangle fx:id="parentRectangle" fill="dimgray" height="50" width="${topBar.width}" />
<HBox alignment="CENTER_LEFT" prefWidth="${topBar.width}" spacing="7">
<StackPane onMouseClicked="#expandMenuClick">
<Rectangle fill="dimgray" width="55" height="50"></Rectangle>
<ImageView fx:id="expandMenuIcon"></ImageView>
<Rectangle fill="dimgray" height="50" width="55" />
<ImageView fx:id="expandMenuIcon" />
</StackPane>
<ImageView fx:id="currentPageIcon"></ImageView>
<ImageView fx:id="currentPageIcon" />
<Text fx:id="currentPageText" fill="white">
<font>
<Font name="System Bold" size="25"></Font>
<Font name="System Bold" size="25" />
</font>
</Text>
</HBox>
@ -116,43 +116,65 @@
</top>
<center>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"
>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" prefHeight="400.0" prefWidth="600.0" text="Learn">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"/>
</content>
</TitledPane>
<AnchorPane prefHeight="400.0" prefWidth="600.0">
<AnchorPane layoutX="-8.0" prefHeight="400.0" prefWidth="600.0">
<children>
<Label fx:id="wordToTranslate" layoutX="228.0" layoutY="73.0" text="Welsh Word">
<Label fx:id="wordToTranslate" layoutX="228.0" layoutY="73.0" text="Welsh Word" textAlignment="CENTER">
<font>
<Font name="System Bold" size="25.0"/>
<Font name="System Bold" size="25.0" />
</font>
</Label>
<Text fx:id="possibleAnswer1" layoutX="61.0" layoutY="176.0" onMouseClicked="#answer1" strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 1" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font></Text>
<Text fx:id="possibleAnswer2" layoutX="260.0" layoutY="175.0" onMouseClicked="#answer2" strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 2" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font></Text>
<Text fx:id="possibleAnswer3" layoutX="472.0" layoutY="175.0" onMouseClicked="#answer3" strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 3" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font></Text>
<Text fx:id="possibleAnswer4" layoutX="61.0" layoutY="297.0" onMouseClicked="#answer4" strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 4" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font></Text>
<Text fx:id="possibleAnswer5" layoutX="260.0" layoutY="297.0" onMouseClicked="#answer5" strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 5" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font></Text>
<Text fx:id="possibleAnswer6" layoutX="472.0" layoutY="297.0" onMouseClicked="#answer6" strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 6" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font></Text>
<Text fx:id="wrongAnswer" layoutX="554.0" layoutY="69.0" strokeType="OUTSIDE" strokeWidth="0.0" text="0" wrappingWidth="22.46875">
<font>
<Font size="17.0" />
</font>
</Text>
<Label layoutX="405.0" layoutY="50.0" text="Incorrect answers:">
<font>
<Font size="17.0" />
</font>
</Label>
<Text fx:id="correctAnswer" layoutX="554.0" layoutY="43.0" strokeType="OUTSIDE" strokeWidth="0.0" text="0">
<font>
<Font size="17.0" />
</font>
</Text>
<Label layoutX="411.0" layoutY="24.0" text="Correct answers:">
<font>
<Font size="17.0" />
</font>
</Label>
<Text fx:id="possibleAnswer1" layoutX="61.0" layoutY="176.0" onMouseClicked="#answer1" strokeType="OUTSIDE"
strokeWidth="0.0" text="English Word 1"/>
<Text fx:id="possibleAnswer2" layoutX="260.0" layoutY="175.0" onMouseClicked="#answer2"
strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 2"/>
<Text fx:id="possibleAnswer3" layoutX="472.0" layoutY="175.0" onMouseClicked="#answer3"
strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 3"/>
<Text fx:id="possibleAnswer4" layoutX="61.0" layoutY="297.0" onMouseClicked="#answer4" strokeType="OUTSIDE"
strokeWidth="0.0" text="English Word 4"/>
<Text fx:id="possibleAnswer5" layoutX="260.0" layoutY="297.0" onMouseClicked="#answer5"
strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 5"/>
<Text fx:id="possibleAnswer6" layoutX="472.0" layoutY="297.0" onMouseClicked="#answer6"
strokeType="OUTSIDE" strokeWidth="0.0" text="English Word 6"/>
</children>
</AnchorPane>
<Text fx:id="correctAnswer" layoutX="469.0" layoutY="51.0" strokeType="OUTSIDE" strokeWidth="0.0"
text="Correct Guesses: 0"/>
<Text fx:id="wrongAnswer" layoutX="469.0" layoutY="68.0" strokeType="OUTSIDE" strokeWidth="0.0"
text="Incorrect Guesses: 0"/>
<Text fill="#8d8d8d" layoutX="238.0" layoutY="360.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Six Meanings">
<font>
<Font name="System Italic" size="22.0"/>
<Font name="System Italic" size="22.0" />
</font>
</Text>
</children>
@ -160,8 +182,3 @@
</center>
</BorderPane>

View file

@ -125,8 +125,8 @@
<center>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" prefHeight="400.0" prefWidth="600.0" text="Learn">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<TextField fx:id="translationBox" layoutX="205.0" layoutY="199.0" prefHeight="45.0" prefWidth="188.0" promptText="Enter translation here" />
@ -153,8 +153,6 @@
<ImageView fx:id="submitButton" fitHeight="46.0" fitWidth="69.0" layoutX="398.0" layoutY="199.0" onMouseClicked="#translateWord" pickOnBounds="true" preserveRatio="true" />
</children>
</AnchorPane>
</content>
</TitledPane>
</children>
</Pane>