/** * Prints a message to the console with a new line. * * @param message the message to print */ protected void println(String message) { console.println(message); }
@Override public void emitNotification(String message) { console.println(message); } };
/** * Prints a message to the console with a new line. * * @param message the message to print */ @Override public void println(String message) { super.println(message); output.add(message); }
private void generateAutoInstallScript(final File file, final InstallData installData, final UninstallData uninstallData, final Console console) { try { parent.writeInstallationRecord(file, uninstallData); } catch (Exception err) { console.println("Failed to save the installation into file [" + file.getAbsolutePath() + "]"); } } }
protected void printHeadLine(InstallData installData, Console console) { final String headline = getI18nStringForClass("headline", installData); if (headline != null) { console.println(); console.printFilledLine('\u2500'); console.println(headline); console.printFilledLine('\u2500'); console.println(); } }
/** * Displays a prompt and waits for input. * * @param prompt the prompt to display * @param defaultValue the default value to use, if no input is entered * @return the user input value; if the user input is empty (return key pressed) return defaultValue */ public String prompt(String prompt, String defaultValue) { String result; try { println(prompt); result = readLine(); if (result != null && result.isEmpty()) { result = defaultValue; } } catch (IOException e) { result = null; logger.log(Level.WARNING, e.getMessage(), e); } return result; }
if (oldValue != null) console.println("Warning: Property " + key + " overwritten: '" + oldValue + "' --> '" + newValue + "'");
public void printMessageBox(String title, String message) { int termWidth = 80; boolean wrapLineFull = true; if (consoleReader != null) { Terminal terminal = consoleReader.getTerminal(); termWidth = terminal.getWidth(); } if (title != null && title.length() > termWidth) { title = WordUtil.wordWrap(title, termWidth, wrapLineFull); } if (message != null && message.length() > termWidth) { message = WordUtil.wordWrap(message, termWidth, wrapLineFull); } int len = title != null ? Math.max(title.length(), message.length()) : message.length(); int width = Math.min(termWidth, len); print('-', width); println(); if (title != null) { println(title); println(); } println(message); print('-', width); println(); }
/** * Runs the panel using the specified console. * * @param installData the installation data * @param console the console * @return <tt>true</tt> */ @Override public boolean run(InstallData installData, Console console) { printHeadLine(installData, console); if (doGenerateAutoInstallScript()) { generateAutoInstallScript(installData, uninstallData, console); } if (installData.isInstallSuccess()) { console.println("Installation was successful"); console.println("Application installed on " + installData.getInstallPath()); } else { console.println("Installation failed!"); } return true; }
/** * Runs the panel using the specified console. * <p/> * If there is no text to display, the panel will return {@code false}. * * @param installData the installation data * @param console the console * @return {@code true} if the panel ran successfully, otherwise {@code false} */ @Override public boolean run(InstallData installData, Console console) { super.run(installData, console); console.println(installData.getMessages().get("InfoPanel.info")); return true; }
public void printFilledLine(char c) { int width = 80; boolean wrapLineFull = true; if (consoleReader != null) { Terminal terminal = consoleReader.getTerminal(); width = terminal.getWidth(); wrapLineFull = terminal.hasWeirdWrap(); } print(c, width); if (wrapLineFull) { println(); } }
console.println("Path of the installation script must be absolute"); promptRerunPanel(installData, console);
String welcomeText = messages.get("HelloPanel.welcome1") + info.getAppName() + " " + info.getAppVersion() + messages.get("HelloPanel.welcome2"); console.println(welcomeText); ArrayList<Info.Author> authors = info.getAuthors(); if (!authors.isEmpty()) console.println(messages.get("HelloPanel.authors")); console.println(" - " + author.getName() + email); console.println(urlText);
/** * Shuts down the installer, rebooting if necessary. * * @param exitSuccess if <tt>true</tt>, exits with a <tt>0</tt> exit code, else exits with a <tt>1</tt> exit code * @param console the console */ protected void shutdown(boolean exitSuccess, Console console) { // TODO - fix reboot handling boolean reboot = false; final Messages messages = installData.getMessages(); if (installData.isRebootNecessary()) { console.println("[ " + messages.get("ConsoleInstaller.shutdown.pendingFileOperations") + " ]"); switch (installData.getInfo().getRebootAction()) { case Info.REBOOT_ACTION_ALWAYS: reboot = true; } if (reboot) { console.println("[ " + messages.get("ConsoleInstaller.shutdown.rebootingNow") + " ]"); } } shutdown(exitSuccess, reboot); }
public void printMultiLine(String text, boolean wrap, boolean paging) throws IOException { if (wrap) { int width = 80; boolean wrapLineFull = true; if (consoleReader != null) { Terminal terminal = consoleReader.getTerminal(); width = terminal.getWidth(); wrapLineFull = terminal.hasWeirdWrap(); } text = WordUtil.wordWrap(text, width, wrapLineFull); } if (paging) { paging(text); } else { println(text); } }
/** * 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; }
final Messages messages = installData.getMessages(); String prompt = messages.get("ConsoleInstaller.acceptRejectRedisplay"); console.println(); int value = console.prompt(prompt, 1, 3, 2); switch (value)
final Messages messages = installData.getMessages(); String prompt = messages.get("ConsoleInstaller.continueQuitRedisplay"); console.println(); int value = console.prompt(prompt, 1, 3, 2); switch (value)