/** * 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; }
/** * 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; }
private void editTitle() { final MessageBox box = new MessageBox(); box.setTitle(I18N.CONSTANTS.changeTitleDialogTitle()); box.setType(MessageBoxType.PROMPT); box.setButtons(Dialog.OKCANCEL); box.show(); box.getTextBox().setValue(model.getTitle()); box.addCallback(new Listener<MessageBoxEvent>() { @Override public void handleEvent(MessageBoxEvent be) { if (be.getButtonClicked().getItemId().equals(Dialog.OK)) { model.setTitle(box.getTextBox().getValue()); titleElement.setInnerText(ElementTitles.format(model)); } } }); }