Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0c56cfd033
4 changed files with 36 additions and 20 deletions
|
@ -51,15 +51,15 @@ public class AddWordController extends SharedCodeController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void addButtonClick(ActionEvent actionEvent) {
|
protected void addButtonClick(ActionEvent actionEvent) {
|
||||||
String trueWordType;
|
DictionaryEntry.wordTypeEnum trueWordType;
|
||||||
if (wordType.getValue() == "Masculine noun") {
|
if (wordType.getValue() == "Masculine noun") {
|
||||||
trueWordType = "nm";
|
trueWordType = DictionaryEntry.wordTypeEnum.nm;
|
||||||
} else if (wordType.getValue() == "Feminine noun") {
|
} else if (wordType.getValue() == "Feminine noun") {
|
||||||
trueWordType = "nf";
|
trueWordType = DictionaryEntry.wordTypeEnum.nf;
|
||||||
} else if (wordType.getValue() == "Verb") {
|
} else if (wordType.getValue() == "Verb") {
|
||||||
trueWordType = "verb";
|
trueWordType = DictionaryEntry.wordTypeEnum.verb;
|
||||||
} else {
|
} else {
|
||||||
trueWordType = "other";
|
trueWordType = DictionaryEntry.wordTypeEnum.other;
|
||||||
}
|
}
|
||||||
boolean entryFound = false;
|
boolean entryFound = false;
|
||||||
// one or more blank fields
|
// one or more blank fields
|
||||||
|
@ -100,6 +100,7 @@ public class AddWordController extends SharedCodeController {
|
||||||
dictionaryEntry.setPracticeWord(true);
|
dictionaryEntry.setPracticeWord(true);
|
||||||
Application.dictionary.contains(dictionaryEntry);
|
Application.dictionary.contains(dictionaryEntry);
|
||||||
Application.dictionary.add(dictionaryEntry);
|
Application.dictionary.add(dictionaryEntry);
|
||||||
|
Application.practiceList.add(dictionaryEntry);
|
||||||
|
|
||||||
// output of what was saved for testing
|
// output of what was saved for testing
|
||||||
// System.out.print(english.getText());
|
// System.out.print(english.getText());
|
||||||
|
|
|
@ -174,9 +174,9 @@ public class DictionaryController extends SharedCodeController {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
welsh.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
welsh.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
||||||
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("nm")) {
|
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.nm)) {
|
||||||
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {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}");
|
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {nf}");
|
||||||
} else {
|
} else {
|
||||||
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh());
|
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh());
|
||||||
|
@ -184,7 +184,7 @@ public class DictionaryController extends SharedCodeController {
|
||||||
});
|
});
|
||||||
|
|
||||||
english.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
english.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
||||||
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("verb")) {
|
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.verb)) {
|
||||||
return new SimpleStringProperty("to " + dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
return new SimpleStringProperty("to " + dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
||||||
} else {
|
} else {
|
||||||
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
||||||
|
@ -210,7 +210,7 @@ public class DictionaryController extends SharedCodeController {
|
||||||
result = true; // Filter matches English
|
result = true; // Filter matches English
|
||||||
// } else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseSearchFilter)) {
|
// } else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseSearchFilter)) {
|
||||||
// result = true; // Filter matches Word Type
|
// 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
|
result = true; // Filter matches ['to' + a word] or [a word] if word is a verb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.collections.transformation.FilteredList;
|
import javafx.collections.transformation.FilteredList;
|
||||||
import javafx.collections.transformation.SortedList;
|
import javafx.collections.transformation.SortedList;
|
||||||
|
import javafx.css.converter.DurationConverter;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
|
@ -104,7 +105,7 @@ public class PracticeListController extends SharedCodeController{
|
||||||
result = true; // Filter matches English
|
result = true; // Filter matches English
|
||||||
// } else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseSearchFilter)) {
|
// } else if (dictionaryEntry.getWordType().toLowerCase().contains(lowerCaseSearchFilter)) {
|
||||||
// result = true; // Filter matches Word Type
|
// 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
|
result = true; // Filter matches ['to' + a word] or [a word] if word is a verb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,9 +162,9 @@ public class PracticeListController extends SharedCodeController{
|
||||||
|
|
||||||
welsh.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
welsh.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
||||||
|
|
||||||
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("nm")) {
|
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.nm)) {
|
||||||
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {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}");
|
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh() + " {nf}");
|
||||||
} else {
|
} else {
|
||||||
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh());
|
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getWelsh());
|
||||||
|
@ -171,7 +172,7 @@ public class PracticeListController extends SharedCodeController{
|
||||||
});
|
});
|
||||||
|
|
||||||
english.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
english.setCellValueFactory(dictionaryEntryStringCellDataFeatures -> {
|
||||||
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals("verb")) {
|
if (dictionaryEntryStringCellDataFeatures.getValue().getWordType().equals(DictionaryEntry.wordTypeEnum.verb)) {
|
||||||
return new SimpleStringProperty("to " + dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
return new SimpleStringProperty("to " + dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
||||||
} else {
|
} else {
|
||||||
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
return new SimpleStringProperty(dictionaryEntryStringCellDataFeatures.getValue().getEnglish());
|
||||||
|
|
|
@ -26,7 +26,11 @@ import uk.ac.aber.cs22120.group20.javafx.DictionaryController;
|
||||||
public class DictionaryEntry {
|
public class DictionaryEntry {
|
||||||
private String english;
|
private String english;
|
||||||
private String welsh;
|
private String welsh;
|
||||||
private String wordType;
|
public enum wordTypeEnum {
|
||||||
|
nm, nf, verb, other
|
||||||
|
}
|
||||||
|
private wordTypeEnum wordType;
|
||||||
|
// private String wordType;
|
||||||
private Boolean practiceWord;
|
private Boolean practiceWord;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,9 +50,10 @@ public class DictionaryEntry {
|
||||||
* @see Application
|
* @see Application
|
||||||
* @see DictionaryController
|
* @see DictionaryController
|
||||||
*/
|
*/
|
||||||
public DictionaryEntry(String english, String welsh, String wordType) {
|
public DictionaryEntry(String english, String welsh, wordTypeEnum wordType) {
|
||||||
this.english = english;
|
this.english = english;
|
||||||
this.welsh = welsh;
|
this.welsh = welsh;
|
||||||
|
// this.wordType = wordType;
|
||||||
this.wordType = wordType;
|
this.wordType = wordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,15 +73,22 @@ public class DictionaryEntry {
|
||||||
this.welsh = welsh.trim();
|
this.welsh = welsh.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWordType() {
|
public wordTypeEnum getWordType() {
|
||||||
return wordType;
|
return wordType;
|
||||||
}
|
}
|
||||||
|
// public word getWordType() {
|
||||||
|
// return wordType;
|
||||||
|
// }
|
||||||
|
|
||||||
public void setWordType(String wordType) {
|
public void setWordType(wordTypeEnum wordType) {
|
||||||
this.wordType = wordType.trim();
|
this.wordType = wordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isPracticeWord() {
|
// public void setWordType(String wordType) {
|
||||||
|
// this.wordType = wordType;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Boolean isPracticeWord() {
|
||||||
return practiceWord;
|
return practiceWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +99,8 @@ public class DictionaryEntry {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object entry) {
|
public boolean equals(Object entry) {
|
||||||
DictionaryEntry otherEntry = (DictionaryEntry) 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue