2026-08-29 23:37:58 +04:00
|
|
|
package ru.project.ui.creation;
|
2026-08-27 18:03:01 +04:00
|
|
|
|
|
|
|
|
import com.googlecode.lanterna.gui2.ActionListBox;
|
|
|
|
|
import com.googlecode.lanterna.gui2.WindowBasedTextGUI;
|
|
|
|
|
import java.util.function.Consumer;
|
2026-08-29 18:42:22 +04:00
|
|
|
import ru.project.ui.base.BaseModalWindow;
|
2026-08-27 18:03:01 +04:00
|
|
|
|
2026-08-29 18:42:22 +04:00
|
|
|
public class FillMethodSelectionWindow extends BaseModalWindow {
|
2026-08-27 18:03:01 +04:00
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|