/** * 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; }
@Override public void onFailure(Throwable caught) { MessageBox.alert("Load failed", caught.getMessage(), null); }
/** * 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 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; }
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 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)); } } }); }
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(); } }
/** * On send error message. * * @param event * the event */ private void onSendErrorMessage(AppEvent event) { String[] message = (String[]) event.getData(); MessageBox box = new MessageBox(); box.setIcon(MessageBox.ERROR); box.setTitle(message[0]); box.setMessage(message[1]); box.show(); }
private void onCancelTransfer() { MessageBox.confirm(I18N.CONSTANTS.transferDatabaseLabel(), I18N.CONSTANTS.pendingTransfer(), new Listener<MessageBoxEvent>() { @Override public void handleEvent(MessageBoxEvent be) { if (be.getButtonClicked().getItemId().equals(Dialog.YES)) { cancelTransfer(); } } }); }
@Override public void onSuccess(SchemaDTO schema) { LockedPeriodSet locks = new LockedPeriodSet(schema); if (locks.isLocked(gridPanel.getSelection())) { MessageBox.alert(I18N.CONSTANTS.lockedSiteTitle(), I18N.CONSTANTS.siteIsLocked(), null); return; } MessageBox.confirm(ClientContext.getAppTitle(), I18N.MESSAGES.confirmDeleteSite(), event -> { if (event.getButtonClicked().getItemId().equals(Dialog.YES)) { delete(); } }); } });
/** * Displays a GXT alert box titled "Error", and binds it to the passed callback. The alert popup is modal, and its * title is internationalized. * * @param message will be displayed as the alert box content. * @param callback may be <code>null</code> */ public void error(String message, Listener<MessageBoxEvent> callback) { MessageBox.alert(messages.headerErrorWindow(), message, callback).setModal(true); }
/** * Creates and displays the close confirmation box. */ private void displayDeleteConfirmationBox() { MessageBox box = createCloseConfirmationBox(); box.show(); }
progressBar.auto(); if (getProgressHtml() != null) { progressBar.updateText(getProgressHtml()); MessageBox.this.setIcon(icon);
/** * 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 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; }
private void confirmCreate(final AsyncMonitor monitor, final AsyncCallback<VoidResult> callback) { MessageBox.confirm(I18N.CONSTANTS.save(), I18N.MESSAGES.confirmSaveCopy(), new Listener<MessageBoxEvent>() { @Override public void handleEvent(final MessageBoxEvent be) { Button btn = be.getButtonClicked(); if (Dialog.YES.equalsIgnoreCase(btn.getItemId())) { performCreate(true); } } }); }
private void promptDeleteSelection() { ModelData selected = tree.getSelectionModel().getSelectedItem(); if(!(selected instanceof EntityDTO)) { return; } EntityDTO selectedEntity = (EntityDTO) selected; if( selectedEntity instanceof FolderDTO && treeStore.getChildCount(selectedEntity) != 0) { MessageBox.alert(I18N.CONSTANTS.delete(), I18N.CONSTANTS.folderNotEmpty(), null); return; } SafeHtml message = confirmationMessage(selectedEntity); if(message == null) { deleteEntity(selectedEntity); } else { MessageBox.confirm(SafeHtmlUtils.fromString(I18N.CONSTANTS.confirmDeletion()), message, event -> { if (event.getButtonClicked().getItemId().equals(Dialog.YES)) { deleteEntity(selectedEntity); } }); } }
/** * 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; }
public static void setText(String s) { if (!GXT.isIE) { MessageBox.alert("Błąd przeglądarki", "Funkcja schowka obsługiwana jedynie przez Internet Explorer 6+<br>" + "<br>" + "Kopiowany tekst: " + s, null); } else { nativeSetText(s); } }