/** * Displays a standard read-only message box with an OK button (comparable to * the basic JavaScript alert prompt). * * @param title the title bar text * @param msg the message box body text * @param callback listener to be called when the box is closed * @return the new message box instance */ public static MessageBox alert(String title, String msg, Listener<MessageBoxEvent> callback) { MessageBox box = new MessageBox(); box.setTitleHtml(title); box.setMessage(msg); box.callback = callback; box.setButtons(OK); box.icon = WARNING; box.show(); return box; }
/** * Displays a confirmation message box with Yes and No buttons (comparable to * JavaScript's confirm). * * @param title the title bar text * @param msg the message box body text * @param callback the listener invoked after the message box is closed * @return the new message box instance */ public static MessageBox confirm(String title, String msg, Listener<MessageBoxEvent> callback) { MessageBox box = new MessageBox(); box.setTitleHtml(title); box.setMessage(msg); box.callback = callback; box.icon = QUESTION; box.setButtons(YESNO); box.show(); return box; }
/** * Displays a standard read-only message box with an OK button (comparable to * the basic JavaScript alert prompt). * * @param title the title bar text * @param msg the message box body text * @param callback listener to be called when the box is closed * @return the new message box instance */ public static MessageBox info(String title, String msg, Listener<MessageBoxEvent> callback) { MessageBox box = new MessageBox(); box.setTitleHtml(title); box.setMessage(msg); box.callback = callback; box.setButtons(OK); box.icon = INFO; box.show(); return box; }
/** * Displays a message box with a progress bar. This message box has no buttons * and is not closeable by the user. You are responsible for updating the * progress bar as needed via {@link MessageBox#updateProgress} * * @param title the title bar text * @param msg the message box body text * @param progressText the text to display inside the progress bar * @return the new message box */ public static MessageBox progress(String title, String msg, String progressText) { MessageBox box = new MessageBox(); box.setTitleHtml(title); box.setMessage(msg); box.setType(MessageBoxType.PROGRESSS); box.setProgressHtml(progressText); box.setButtons(""); box.setClosable(false); box.show(); return box; }
/** * Displays a message box with an infinitely auto-updating progress bar. This * can be used to block user interaction while waiting for a long-running * process to complete that does not have defined intervals. You are * responsible for closing the message box when the process is complete. * * @param title the title bar text * @param msg the message box body text * @param progressText the text to display inside the progress bar * @return the new message box instance */ public static MessageBox wait(String title, String msg, String progressText) { MessageBox box = new MessageBox(); box.setTitleHtml(title); box.setMessage(msg); box.setType(MessageBoxType.WAIT); box.setProgressHtml(progressText); box.setButtons(""); box.setClosable(false); box.show(); return box; }
/** * Displays a message box with OK and Cancel buttons prompting the user to * enter some text (comparable to JavaScript's prompt). * * @param title the title bar text * @param msg the message box body text * @param multiline true for a multi-line text aread * @return the new message box */ public static MessageBox prompt(String title, String msg, boolean multiline, Listener<MessageBoxEvent> callback) { MessageBox box = new MessageBox(); box.setTitleHtml(title); box.setMessage(msg); box.setType(MessageBoxType.PROMPT); box.setButtons(Dialog.OKCANCEL); box.setType(multiline ? MessageBoxType.MULTIPROMPT : MessageBoxType.PROMPT); if (callback != null) { box.addCallback(callback); } box.show(); return box; }