refactor: migrate UI from views and presenters to windows and menus

This commit is contained in:
2026-08-27 18:03:01 +04:00
parent c1d6b17ddc
commit e1d76cf69c
20 changed files with 375 additions and 570 deletions
@@ -0,0 +1,37 @@
package ru.project.ui.menu;
import com.googlecode.lanterna.gui2.ActionListBox;
import com.googlecode.lanterna.gui2.WindowBasedTextGUI;
import java.util.function.Consumer;
import ru.project.model.FillMethod;
import ru.project.ui.base.BaseWindow;
public class FillMethodSelectionWindow extends BaseWindow {
private final Consumer<FillMethod> onFillMethodSelected;
public FillMethodSelectionWindow(
WindowBasedTextGUI gui, Consumer<FillMethod> onFillMethodSelected) {
super("Выбор способа заполнения", gui);
this.onFillMethodSelected = onFillMethodSelected;
ActionListBox menu = new ActionListBox();
menu.addItem("Пользовательские данные", () -> selectFillMethod(FillMethod.CUSTOM));
menu.addItem("Случайные данные", () -> selectFillMethod(FillMethod.RANDOM));
menu.addItem("Данные из файла", () -> selectFillMethod(FillMethod.FILE));
menu.addItem("Выйти", this::close);
setComponent(menu);
}
private void selectFillMethod(FillMethod fillMethod) {
onFillMethodSelected.accept(fillMethod);
close();
}
}