List of usage examples for com.vaadin.ui Notification Notification
public Notification(String caption, String description, Type type, boolean htmlContentAllowed)
From source file:org.jpos.qi.login.LoginView.java
License:Open Source License
private void loginFailed(String nick, User user) { boolean userLocked = false; if (user != null) { int attempts = helper.addLoginAttempt(user); int maxLoginAttempts; try {//w ww . j a v a2 s .com maxLoginAttempts = helper.getMaxLoginAttempts(); } catch (NumberFormatException exc) { app.displayError("errorMessage.invalidSysConfig", "errorMessage.invalidSysConfigFormat", LoginConstants.MAX_LOGIN_ATTEMPTS.name()); maxLoginAttempts = 0; } if (maxLoginAttempts != 0 && attempts >= maxLoginAttempts) { helper.lockUser(user); userLocked = true; } } //Display message String descKey = userLocked ? "login.fail.maxAttempts" : "login.fail.desc"; Notification notif = new Notification(app.getMessage("login.fail"), app.getMessage(descKey, nick), Notification.Type.ERROR_MESSAGE, true); notif.show(Page.getCurrent()); }
From source file:org.opencms.ui.apps.CmsAppWorkplaceUi.java
License:Open Source License
/** * Checks for new broadcasts.<p>/*www.j a v a2 s. c o m*/ */ public void checkBroadcasts() { CmsSessionInfo info = OpenCms.getSessionManager().getSessionInfo(getHttpSession()); Buffer queue = info.getBroadcastQueue(); if (!queue.isEmpty()) { StringBuffer broadcasts = new StringBuffer(); while (!queue.isEmpty()) { CmsBroadcast broadcastMessage = (CmsBroadcast) queue.remove(); String from = broadcastMessage.getUser() != null ? broadcastMessage.getUser().getName() : CmsVaadinUtils .getMessageText(org.opencms.workplace.Messages.GUI_LABEL_BROADCAST_FROM_SYSTEM_0); String date = CmsVaadinUtils.getWpMessagesForCurrentLocale() .getDateTime(broadcastMessage.getSendTime()); String content = broadcastMessage.getMessage(); content = content.replaceAll("\\n", "<br />"); broadcasts.append("<p><em>").append(date).append("</em><br />"); broadcasts .append(CmsVaadinUtils .getMessageText(org.opencms.workplace.Messages.GUI_LABEL_BROADCASTMESSAGEFROM_0)) .append(" <b>").append(from).append("</b>:</p><p>"); broadcasts.append(content).append("<br /></p>"); } Notification notification = new Notification( CmsVaadinUtils.getMessageText(Messages.GUI_BROADCAST_TITLE_0), broadcasts.toString(), Type.WARNING_MESSAGE, true); notification.setDelayMsec(-1); notification.show(getPage()); } }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditor.java
License:Open Source License
/** * @see org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.I_OptionListener#handleLanguageChange(java.util.Locale) *//*from w w w . j ava2 s . com*/ public void handleLanguageChange(final Locale locale) { if (!locale.equals(m_model.getLocale())) { Object sortProperty = m_table.getSortContainerPropertyId(); boolean isAcending = m_table.isSortAscending(); Map<Object, Object> filters = getFilters(); m_table.clearFilters(); if (m_model.setLocale(locale)) { m_options.setEditedFilePath(m_model.getEditedFilePath()); m_table.sort(new Object[] { sortProperty }, new boolean[] { isAcending }); } else { String caption = m_messages .key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_LOCALE_SWITCHING_FAILED_CAPTION_0); String description = m_messages .key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_LOCALE_SWITCHING_FAILED_DESCRIPTION_0); Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true); warning.setDelayMsec(-1); warning.show(UI.getCurrent().getPage()); m_options.setLanguage(m_model.getLocale()); } setFilters(filters); m_table.select(m_table.getCurrentPageFirstItemId()); } }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.java
License:Open Source License
/** * Displays a localized warning./*from www . j a v a 2 s . com*/ * @param caption the caption of the warning. * @param description the description of the warning. */ static void showWarning(final String caption, final String description) { Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true); warning.setDelayMsec(-1); warning.show(UI.getCurrent().getPage()); }
From source file:org.opennms.features.vaadin.jmxconfiggenerator.ui.UIHelper.java
License:Open Source License
public static void showNotification(String title, String message, Type type, int delayMsec) { Notification notification = new Notification(title, message, type, true); notification.setDelayMsec(delayMsec); notification.show(Page.getCurrent()); }
From source file:songstock.web.SongStockUI.java
License:Open Source License
/** * Shows a warning notification with the given title and message. * @param title of the notification//from w ww . j a va2s . co m * @param message for the notification */ public void showWarningNotification(String title, String message) { new Notification(title, message, Type.WARNING_MESSAGE, true).show(Page.getCurrent()); }
From source file:sph.vaadin.ui.videojs.VideojsSourceLoader.java
License:Apache License
@Override public void setup() { this.doLayout(); this.videoUrlField.setImmediate(true); this.videoUrlField.addValueChangeListener(new TextFieldValidator()); this.videoUrlField.addFocusListener(new TextSelector()); this.videoUrlField.setTextChangeEventMode(TextChangeEventMode.TIMEOUT); this.loadBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 402515738995537894L; @Override/*from w w w . j a va 2 s. c o m*/ public void buttonClick(ClickEvent event) { if (videoUrlField.isValid()) { getPlayer().setSource(videoUrlField.getValue(), parseMIME()); } else { Notification n = new Notification("Loading failed!", "<strong>Video URL:</strong> is not recognized as a valid video stream!", Notification.Type.WARNING_MESSAGE, true); n.show(Page.getCurrent()); } } }); }
From source file:uk.co.q3c.v7.i18n.Notifier.java
License:Apache License
public void notify(I18NKey<?> captionKey, I18NKey<?> messageKey, Notification.Type messageType, Object... messageArguments) { String msg = i18nValue.message(messageKey, messageArguments); String caption = i18nValue.message(captionKey); Notification n = new Notification(caption, msg, messageType, false); n.show(Page.getCurrent());/*from w w w .jav a2 s . c o m*/ }