private static void configurePort(TextIO textIO, WebTextIoExecutor webTextIoExecutor, int defaultPort) { int port = textIO.newIntInputReader() .withDefaultValue(defaultPort) .read("Server port number"); webTextIoExecutor.withPort(port); }
private void addJobTask(TextIO textIO, String prompt, Supplier<Integer> defaultValueSupplier, Consumer<Integer> valueSetter) { operations.add(() -> { setChoices(); valueSetter.accept(textIO.newIntInputReader() .withDefaultValue(5) // .withDefaultValue(defaultValueSupplier.get()) .withMinVal(1) .withMaxVal(16) .read(prompt)); }); }
private void addCountryTask(TextIO textIO, String prompt, Supplier<Integer> defaultValueSupplier, Consumer<Integer> valueSetter) { operations.add(() -> { setChoices(); valueSetter.accept(textIO.newIntInputReader() .withDefaultValue(5) .withMinVal(1) .withMaxVal(28)//defaultValueSupplier.get()) .read(prompt)); }); }
private void addAge(TextIO textIO, String prompt, Supplier<Integer> defaultValueSupplier, Consumer<Integer> valueSetter) { operations.add(() -> { setChoices(); valueSetter.accept(textIO.newIntInputReader() .withDefaultValue(30) // // .withDefaultValue(defaultValueSupplier.get()) // .withPromptAdjustments(false) // .withNumberedPossibleValues(age) .withMaxVal(80) .withMinVal(18) .read(prompt)); }); }
+ "Which timestamp do you want to use (1, 2 or 3)?"; int choice = sim.getTerm().getTextIO().newIntInputReader().read(prompt1);
this.intInputReaderSupplier = () -> textIO.newIntInputReader(); this.longInputReaderSupplier = () -> textIO.newLongInputReader(); this.doubleInputReaderSupplier = () -> textIO.newDoubleInputReader();
@Override public void accept(TextIO textIO, RunnerData runnerData) { TextTerminal<?> terminal = textIO.getTextTerminal(); String initData = (runnerData == null) ? null : runnerData.getInitData(); AppUtil.printGsonMessage(terminal, initData); String user = textIO.newStringInputReader() .withDefaultValue("admin") .read("Username"); String password = textIO.newStringInputReader() .withMinLength(6) .withInputMasking(true) .read("Password"); int age = textIO.newIntInputReader() .withMinVal(13) .read("Age"); Month month = textIO.newEnumInputReader(Month.class) .read("What month were you born in?"); terminal.printf("\nUser %s is %d years old, was born in %s and has the password %s.\n", user, age, month, password); textIO.newStringInputReader().withMinLength(0).read("\nPress enter to terminate..."); textIO.dispose("User '" + user + "' has left the building."); }
String product = textIO.newStringInputReader().read("Product name"); int quantity = textIO.newIntInputReader() .withMinVal(1) .withMaxVal(10)