Make the practice and dictionary sort by language sort by default
This commit is contained in:
parent
5b1ac5896d
commit
2ff007d378
2 changed files with 24 additions and 6 deletions
|
@ -64,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"));
|
||||
}
|
||||
|
@ -73,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"));
|
||||
}
|
||||
|
@ -83,8 +85,10 @@ public class DictionaryController extends SharedCodeController {
|
|||
}
|
||||
table.getSortOrder().clear();
|
||||
table.getSortOrder().add(english);
|
||||
isSortedByEnglish = true;
|
||||
}
|
||||
table.sort();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -180,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"));
|
||||
}
|
||||
|
@ -194,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"));
|
||||
}
|
||||
|
@ -204,6 +211,8 @@ public class PracticeListController extends SharedCodeController{
|
|||
}
|
||||
table.getSortOrder().clear();
|
||||
table.getSortOrder().add(english);
|
||||
|
||||
isSortedByEnglish = true;
|
||||
}
|
||||
table.sort();
|
||||
}
|
||||
|
|
Reference in a new issue