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
|
@FXML
|
||||||
private void switchLangSort() {
|
private void switchLangSort() {
|
||||||
if (table.getSortOrder().contains(english)) {
|
if (isSortedByEnglish) {
|
||||||
if (welsh.getSortType().equals(TableColumn.SortType.ASCENDING)) {
|
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"));
|
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().clear();
|
||||||
table.getSortOrder().add(welsh);
|
table.getSortOrder().add(welsh);
|
||||||
|
|
||||||
|
isSortedByEnglish = false;
|
||||||
}
|
}
|
||||||
else if (table.getSortOrder().contains(welsh)) {
|
else {
|
||||||
if (english.getSortType().equals(TableColumn.SortType.ASCENDING)) {
|
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"));
|
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().clear();
|
||||||
table.getSortOrder().add(english);
|
table.getSortOrder().add(english);
|
||||||
|
isSortedByEnglish = true;
|
||||||
}
|
}
|
||||||
table.sort();
|
table.sort();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,7 +228,12 @@ public class DictionaryController extends SharedCodeController {
|
||||||
// english.setCellValueFactory(new PropertyValueFactory<DictionaryEntry, String>("english"));
|
// english.setCellValueFactory(new PropertyValueFactory<DictionaryEntry, String>("english"));
|
||||||
|
|
||||||
table.setItems(sortedList);
|
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.setItems(sortedList);
|
||||||
table.getSortOrder().add(english);
|
if(isSortedByEnglish){
|
||||||
|
table.getSortOrder().add(english);
|
||||||
|
} else{
|
||||||
|
table.getSortOrder().add(welsh);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void switchLangSort() {
|
private void switchLangSort() {
|
||||||
if (table.getSortOrder().contains(english)) {
|
if (isSortedByEnglish) {
|
||||||
if (welsh.getSortType().equals(TableColumn.SortType.ASCENDING)) {
|
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"));
|
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().clear();
|
||||||
table.getSortOrder().add(welsh);
|
table.getSortOrder().add(welsh);
|
||||||
|
|
||||||
|
isSortedByEnglish = false;
|
||||||
}
|
}
|
||||||
else if (table.getSortOrder().contains(welsh)) {
|
else {
|
||||||
if (english.getSortType().equals(TableColumn.SortType.ASCENDING)) {
|
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"));
|
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().clear();
|
||||||
table.getSortOrder().add(english);
|
table.getSortOrder().add(english);
|
||||||
|
|
||||||
|
isSortedByEnglish = true;
|
||||||
}
|
}
|
||||||
table.sort();
|
table.sort();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue