/** * Prompts for a value from a set of values. * * @param prompt the prompt to display * @param values the valid values * @return the user input value; if the user input is empty (return key pressed) return defaultValue */ public String prompt(String prompt, String[] values) { return prompt(prompt, values, ""); }
String strIn = console.prompt(errorMessage, (String)null); if (strIn == null)
/** * Displays a prompt and waits for numeric input. * * @param prompt the prompt to display * @param min the minimum allowed value * @param max the maximum allowed value * @param eof the value to return if end of stream is reached * @return a value in the range of <tt>from..to</tt>, or <tt>eof</tt> if the end of stream is reached */ public int prompt(String prompt, int min, int max, int eof) { return prompt(prompt, min, max, min - 1, eof); }
/** * Prompts for a value from a set of values. * * @param prompt the prompt to display * @param values the valid values * @param defaultValue the default value to return when the user input is empty * @return the user input value; if the user input is empty (return key pressed) return defaultValue */ public String prompt(String prompt, String[] values, String defaultValue) { while (true) { String input; if ((input = prompt(prompt, defaultValue)) != null) { for (String value : values) { if (value.equalsIgnoreCase(input)) { return value; } } } else { return null; } } }
/** * Choose under which program group to place the shortcuts. */ private void chooseProgramGroup(Console console) { String programGroup = shortcutPanelLogic.getSuggestedProgramGroup(); if (programGroup != null && "".equals(programGroup)) { programGroup = console.prompt(installData.getMessages().get("ShortcutPanel.regular.list"), ""); } shortcutPanelLogic.setGroupName(programGroup); }
result = prompt(prompt, defaultValue);
int numberOfUniqueLanguage = console.prompt(installData.getMessages().get("ConsoleInstaller.inputSelection"), 0, displayNames.keySet().size() - 1, 0, 0); String[] keys = displayNames.keySet().toArray(new String[0]); propagateLocale(keys[numberOfUniqueLanguage]);
String selected = console.prompt(okCancelPrompt, new String[]{ok, cancel}, defaultValue); if (ok.equals(selected)) String selected = console.prompt(yesNoCancelPrompt, new String[]{yes, no, cancel}, defaultValue); if (yes.equals(selected)) String selected = console.prompt(yesNoPrompt, new String[]{yes, no}, defaultValue); if (yes.equals(selected))
@Override public boolean display() { SearchField field = (SearchField)getField(); printDescription(); List<String> choices = field.getChoices(); int selectedIndex = field.getSelectedIndex(); listChoices(choices, selectedIndex); if (isReadonly()) { field.setValue(choices.get(selectedIndex == -1 ? 0 : selectedIndex)); return true; } int selected = getConsole().prompt("input selection: ", 0, choices.size() - 1, selectedIndex, -1); if (selected == -1) { return false; } field.setValue(field.getResult(choices.get(selected))); return true; }
if (installGroups.size() == 0) console.prompt("Skip InstallGroup selection", new String[]{"Yes", "No"}, "Yes"); return false;
if (isReadonly()) userValue = getConsole().prompt("Enter 1 to continue, 2 to redisplay", 1, 2, 2, -1); switch (userValue) userValue = getConsole().prompt("Enter the row number (" + 1 + ".." + numberOfRows + ") to edit, " + Integer.toString(numberOfRows+1) + " to accept all, " + Integer.toString(numberOfRows+2) + " to redisplay"
/** * Prompts to re-run the panel or quit. * <p/> * This displays a prompt to redisplay the panel or quit. On redisplay, it invokes * {@link #run(InstallData, Console)}. * * @param installData the installation date * @param console the console to use * @return {@code true} to re-display, {@code false} to quit. If redisplaying the panel, the result of * {@link #run(InstallData, Console)} is returned */ protected boolean promptRerunPanel(InstallData installData, Console console) { boolean result; final Messages messages = installData.getMessages(); String prompt = messages.get("ConsoleInstaller.redisplayQuit"); console.println(); int value = console.prompt(prompt, 1, 2, 2); switch (value) { case 2: throw new UserInterruptException(messages.get("ConsoleInstaller.aborted.PressedQuit")); default: result = run(installData, console); break; } return result; }
String prompt = messages.get("ConsoleInstaller.continueQuitRedisplay"); console.println(); int value = console.prompt(prompt, 1, 3, 2); switch (value)
String prompt = messages.get("ConsoleInstaller.acceptRejectRedisplay"); console.println(); int value = console.prompt(prompt, 1, 3, 2); switch (value)
int selectedVisibleIndex = getConsole().prompt(getMessage("ConsoleInstaller.inputSelection"), 0, visibleToRealMapping.size() - 1, visibleToRealMapping.getDefaultVisibleIndex(), -1); if (selectedVisibleIndex == -1)
int value = getConsole().prompt("Enter 1 to select, 0 to deselect: ", 0, 1, defaultValue, -1); if (value == -1)
value = getConsole().prompt(field.getButtonName() + " [y/n]: [n]", "n");
try choice = console.prompt(messages.get(PROMPT), 0, maxRow, -1) - 1;
String value = getConsole().prompt(label + " [" + initialValue + "] ", initialValue); if (value != null)