diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/DictionaryController.java b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/DictionaryController.java index cc68193..d0cf08b 100644 --- a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/DictionaryController.java +++ b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/DictionaryController.java @@ -14,6 +14,8 @@ import javafx.collections.transformation.SortedList; 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.layout.Pane; import javafx.stage.Stage; @@ -42,6 +44,8 @@ import uk.ac.aber.cs22120.group20.json.DictionaryEntry; public class DictionaryController implements Initializable { public static Stage primaryStage = null; + @FXML + private ImageView alphaSort; @FXML private TextField searchBox; @FXML @@ -56,9 +60,22 @@ public class DictionaryController implements Initializable { @FXML private void switchLangSort() { if (table.getSortOrder().contains(english)) { + 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")); + } + else if (welsh.getSortType().equals(TableColumn.SortType.DESCENDING)) { + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); + } table.getSortOrder().clear(); table.getSortOrder().add(welsh); - } else if (table.getSortOrder().contains(welsh)) { + } + else if (table.getSortOrder().contains(welsh)) { + 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")); + } + else if (english.getSortType().equals(TableColumn.SortType.DESCENDING)) { + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); + } table.getSortOrder().clear(); table.getSortOrder().add(english); } @@ -70,14 +87,18 @@ public class DictionaryController implements Initializable { if (table.getSortOrder().contains(english)) { if (english.getSortType().equals(TableColumn.SortType.ASCENDING)) { english.setSortType(TableColumn.SortType.DESCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); } else { english.setSortType(TableColumn.SortType.ASCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png")); } } else if (table.getSortOrder().contains(welsh)) { if (welsh.getSortType().equals(TableColumn.SortType.ASCENDING)) { welsh.setSortType(TableColumn.SortType.DESCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); } else { welsh.setSortType(TableColumn.SortType.ASCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png")); } } } diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/PracticeListController.java b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/PracticeListController.java index ed3474e..78c36f1 100644 --- a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/PracticeListController.java +++ b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/PracticeListController.java @@ -13,10 +13,9 @@ 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; -import javafx.scene.control.TextField; +import javafx.scene.control.*; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; import javafx.stage.Stage; import uk.ac.aber.cs22120.group20.json.DictionaryEntry; @@ -43,6 +42,8 @@ import java.util.ResourceBundle; public class PracticeListController implements Initializable { public static Stage primaryStage = null; + @FXML + private ImageView alphaSort; @FXML private TextField searchBox; @FXML @@ -106,23 +107,25 @@ public class PracticeListController implements Initializable { // welsh.setCellValueFactory(new PropertyValueFactory("welsh")); // english.setCellValueFactory(new PropertyValueFactory("english")); + table.setPlaceholder(new Label("No practice words found. Please try adding a practice word from the 'Dictionary' page.")); table.setRowFactory(tv -> { TableRow row = new TableRow() { @Override protected void updateItem(DictionaryEntry dictionaryEntry, boolean b) { super.updateItem(dictionaryEntry, b); if (!isEmpty()) { - if (dictionaryEntry.isPracticeWord()) { - setStyle("-fx-background-color: gray;"); - } else { - setStyle(" "); - } + setStyle(" "); +// if (dictionaryEntry.isPracticeWord()) { +// setStyle("-fx-background-color: gray;"); +// } else { +// setStyle(" "); +// } } } }; row.setOnMouseClicked(mouseEvent -> { if (mouseEvent.getClickCount() == 1 && (!row.isEmpty())) { - for(DictionaryEntry entry : Application.dictionary) { + for (DictionaryEntry entry : Application.dictionary) { if (entry.equals(row.getItem())) { entry.setPracticeWord(false); list.remove(row.getItem()); @@ -162,9 +165,22 @@ public class PracticeListController implements Initializable { @FXML private void switchLangSort() { if (table.getSortOrder().contains(english)) { + 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")); + } + else if (welsh.getSortType().equals(TableColumn.SortType.DESCENDING)) { + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); + } table.getSortOrder().clear(); table.getSortOrder().add(welsh); - } else if (table.getSortOrder().contains(welsh)) { + } + else if (table.getSortOrder().contains(welsh)) { + 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")); + } + else if (english.getSortType().equals(TableColumn.SortType.DESCENDING)) { + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); + } table.getSortOrder().clear(); table.getSortOrder().add(english); } @@ -176,14 +192,18 @@ public class PracticeListController implements Initializable { if (table.getSortOrder().contains(english)) { if (english.getSortType().equals(TableColumn.SortType.ASCENDING)) { english.setSortType(TableColumn.SortType.DESCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); } else { english.setSortType(TableColumn.SortType.ASCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png")); } } else if (table.getSortOrder().contains(welsh)) { if (welsh.getSortType().equals(TableColumn.SortType.ASCENDING)) { welsh.setSortType(TableColumn.SortType.DESCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-reversed-50.png")); } else { welsh.setSortType(TableColumn.SortType.ASCENDING); + alphaSort.setImage(new Image("file:src/main/resources/assets/icons/black_icons/50px/sort-alpha-up-50.png")); } } } diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/dictionary.fxml b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/dictionary.fxml index e912e7f..b4c8210 100644 --- a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/dictionary.fxml +++ b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/dictionary.fxml @@ -35,7 +35,7 @@ - + diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml index 2057ef6..3616d5c 100644 --- a/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml +++ b/dev/20200421/osp1/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml @@ -35,7 +35,7 @@ - + diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController$1.class b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController$1.class index 179bc23..a7ab447 100644 Binary files a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController$1.class and b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController$1.class differ diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController.class b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController.class index 43d3a5a..6b23dc6 100644 Binary files a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController.class and b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/DictionaryController.class differ diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController$1.class b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController$1.class index dd65026..2aa5dab 100644 Binary files a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController$1.class and b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController$1.class differ diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController.class b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController.class index 34cf080..1ca6088 100644 Binary files a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController.class and b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/PracticeListController.class differ diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/dictionary.fxml b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/dictionary.fxml index e912e7f..b4c8210 100644 --- a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/dictionary.fxml +++ b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/dictionary.fxml @@ -35,7 +35,7 @@ - + diff --git a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/practicelist.fxml b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/practicelist.fxml index 2057ef6..3616d5c 100644 --- a/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/practicelist.fxml +++ b/dev/20200421/osp1/Welsh Vocabulary Tutor/target/classes/uk/ac/aber/cs22120/group20/practicelist.fxml @@ -35,7 +35,7 @@ - +