private MessageBox createCloseConfirmationBox() { MessageBox box = new MessageBox(); box.setButtons(MessageBox.YESNO); box.setIcon(MessageBox.QUESTION); box.setTitle("Ostrzeżenie"); box.setMessage("Czy na pewno chcesz usunąć plik?"); box.addCallback(new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent messageBoxEvent) { Button b = messageBoxEvent.getButtonClicked(); String buttonType = b.getItemId(); if (Dialog.YES.equals(buttonType)) { //TODO where to get selected row from AppEvent event = new AppEvent(EventName.LOCAL_FILE_DELETE.toType()); fireEvent(event.getType(),event); } else if (Dialog.NO.equals(buttonType)) { // Nothing happens } } }); return box; }
private static void promptUseNewEntry(final ActivityDTO dto) { MessageBox box = new MessageBox(); box.setTitle(dto.getName()); box.setMessage(SafeHtmlUtils.fromString(I18N.CONSTANTS.pleaseUseNewDataEntry())); box.setButtons(MessageBox.OKCANCEL); box.addCallback(messageBoxEvent -> { if(messageBoxEvent.getButtonClicked().getItemId().equals(MessageBox.OK)) { App3.openNewTable(dto.getFormId()); } }); box.show(); } }
/** * 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; }
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)); } } }); }