feat(ui): improve menu action labels and sort display

This commit is contained in:
2026-08-31 18:01:58 +04:00
parent a59d574c67
commit a143a535ba
3 changed files with 23 additions and 9 deletions
@@ -25,15 +25,15 @@ public class CurrentCollectionMenu extends BaseModalWindow {
ActionListBox menu = new ActionListBox(); ActionListBox menu = new ActionListBox();
menu.addItem("Показать коллекцию", this::showCurrentCollection); menu.addItem("Показать коллекцию...", this::showCurrentCollection);
menu.addItem("Сохранить коллекцию в файл", this::saveCurrentCollection); menu.addItem("Сохранить коллекцию в файл...", this::saveCurrentCollection);
menu.addItem("Сортировать коллекцию", sortCollectionMenu::showModal); menu.addItem("Меню сортировки коллекции", sortCollectionMenu::showModal);
menu.addItem("Поиск элемента в коллекции", this::searchCollection); menu.addItem("Меню поиска элемента в коллекции", this::searchCollection);
menu.addItem("Подсчёт количества вхождений элемента", this::countOccurrences); menu.addItem("Меню подсчёта количества вхождений элемента", this::countOccurrences);
menu.addItem("Выйти", this::close); menu.addItem("Выйти", this::close);
@@ -36,7 +36,8 @@ public class SortCollectionMenu extends BaseModalWindow {
this.sortMethodLabel = new Label("Способ сортировки: " + getSortMethodName(selectedSortMethod)); this.sortMethodLabel = new Label("Способ сортировки: " + getSortMethodName(selectedSortMethod));
this.sortFieldLabel = new Label("Сортировать по: " + getSortFieldName(selectedSortField)); this.sortFieldLabel =
new Label("Сортировать по: " + getSortFieldName(selectedSortMethod, selectedSortField));
this.sortMethodSelectionWindow = this.sortMethodSelectionWindow =
new SortMethodSelectionWindow( new SortMethodSelectionWindow(
@@ -46,6 +47,9 @@ public class SortCollectionMenu extends BaseModalWindow {
sortMethodLabel.setText( sortMethodLabel.setText(
"Способ сортировки: " + getSortMethodName(selectedSortMethod)); "Способ сортировки: " + getSortMethodName(selectedSortMethod));
sortFieldLabel.setText(
"Сортировать по: " + getSortFieldName(selectedSortMethod, selectedSortField));
}); });
this.normalSortSettingsWindow = this.normalSortSettingsWindow =
@@ -53,6 +57,9 @@ public class SortCollectionMenu extends BaseModalWindow {
gui, gui,
sortField -> { sortField -> {
selectedSortField = sortField; selectedSortField = sortField;
sortFieldLabel.setText(
"Сортировать по: " + getSortFieldName(selectedSortMethod, selectedSortField));
}); });
this.paritySortSettingsWindow = new ParitySortSettingsWindow(gui); this.paritySortSettingsWindow = new ParitySortSettingsWindow(gui);
@@ -116,7 +123,14 @@ public class SortCollectionMenu extends BaseModalWindow {
}; };
} }
private String getSortFieldName(SortField sortField) { private String getSortFieldName(SortMethod sortMethod, SortField sortField) {
return switch (sortMethod) {
case NORMAL -> getNormalSortFieldName(sortField);
case PARITY -> "номеру зачётной книжки";
};
}
private String getNormalSortFieldName(SortField sortField) {
return switch (sortField) { return switch (sortField) {
case GROUP_NUMBER -> "номеру группы"; case GROUP_NUMBER -> "номеру группы";
case AVERAGE_GRADE -> "среднему баллу"; case AVERAGE_GRADE -> "среднему баллу";
@@ -50,10 +50,10 @@ public class CreateCollectionMenu extends BaseModalWindow {
panel.addComponent(fillMethodLabel); panel.addComponent(fillMethodLabel);
panel.addComponent(new Button("Выбрать способ заполнения", this::selectFillMethod)); panel.addComponent(new Button("Выбрать способ заполнения...", this::selectFillMethod));
panel.addComponent( panel.addComponent(
new Button("Настроить текущий способ заполнения", this::setupCurrentFillMethod)); new Button("Настроить текущий способ заполнения...", this::setupCurrentFillMethod));
panel.addComponent(new Button("Создать новую коллекцию", this::updateMainCollection)); panel.addComponent(new Button("Создать новую коллекцию", this::updateMainCollection));