/** * Shows a notification message on the middle of the current page. The * message automatically disappears ("humanized message"). * * The caption is rendered as plain text with HTML automatically escaped. * * @see #Notification(String) * @see #show(Page) * * @param caption * The message * @return The Notification */ public static Notification show(String caption) { Notification notification = new Notification(caption); notification.extend(UI.getCurrent()); return notification; }
/** * Shows a notification consisting of a bigger caption and a smaller * description. The position and behavior of the message depends on the * type, which is one of the basic types defined in {@link Notification} , * for instance Notification.TYPE_WARNING_MESSAGE. * * Care should be taken to avoid XSS vulnerabilities if html content is * allowed. * * @see #showNotification(Notification) * @see Notification * * @param caption * The message caption * @param description * The message description * @param type * The type of message * @param htmlContentAllowed * Whether html in the caption and description should be * displayed as html or as plain text * * @deprecated As of 7.0, use new Notification(...).show(Page). */ @Deprecated public void showNotification(String caption, String description, Notification.Type type, boolean htmlContentAllowed) { getPage().showNotification(new Notification(caption, description, type, htmlContentAllowed)); }
/** * Shows a notification message the current page. The position and behavior * of the message depends on the type, which is one of the basic types * defined in {@link Notification}, for instance * {@link Type#WARNING_MESSAGE}. * * The caption is rendered as plain text with HTML automatically escaped. * * @see Notification(String, int) * @see #show(Page) * * @param caption * The message * @param type * The message type * @return The Notification */ public static Notification show(String caption, Type type) { Notification notification = new Notification(caption, type); notification.extend(UI.getCurrent()); return notification; }
/** * Shows a notification message the current page. The position and behavior * of the message depends on the type, which is one of the basic types * defined in {@link Notification}, for instance * Notification.TYPE_WARNING_MESSAGE. * * The caption is rendered as plain text with HTML automatically escaped. * * @see #Notification(String, Type) * @see #show(Page) * * @param caption * The message * @param description * The message description * @param type * The message type * @return The Notification */ public static Notification show(String caption, String description, Type type) { Notification notification = new Notification(caption, description, type); notification.extend(UI.getCurrent()); return notification; }
/** * Shows a notification message on the middle of the UI. The message * automatically disappears ("humanized message"). * * Care should be taken to to avoid XSS vulnerabilities as the caption is * rendered as html. * * @see #showNotification(Notification) * @see Notification * * @param caption * The message * * @deprecated As of 7.0, use Notification.show instead but be aware that * Notification.show does not allow HTML. */ @Deprecated public void showNotification(String caption) { Notification notification = new Notification(caption); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); }
/** * Shows a notification consisting of a bigger caption and a smaller * description on the middle of the UI. The message automatically disappears * ("humanized message"). * * Care should be taken to to avoid XSS vulnerabilities as the caption and * description are rendered as html. * * @see #showNotification(Notification) * @see Notification * * @param caption * The caption of the message * @param description * The message description * * @deprecated As of 7.0, use new Notification(...).show(Page) instead but * be aware that HTML by default not allowed. */ @Deprecated public void showNotification(String caption, String description) { Notification notification = new Notification(caption, description); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); }
/** * Shows a notification message the UI. The position and behavior of the * message depends on the type, which is one of the basic types defined in * {@link Notification}, for instance Notification.TYPE_WARNING_MESSAGE. * * Care should be taken to to avoid XSS vulnerabilities as the caption is * rendered as html. * * @see #showNotification(Notification) * @see Notification * * @param caption * The message * @param type * The message type * * @deprecated As of 7.0, use Notification.show instead but be aware that * Notification.show does not allow HTML. */ @Deprecated public void showNotification(String caption, Notification.Type type) { Notification notification = new Notification(caption, type); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); }
/** * Shows a notification consisting of a bigger caption and a smaller * description. The position and behavior of the message depends on the * type, which is one of the basic types defined in {@link Notification} , * for instance Notification.TYPE_WARNING_MESSAGE. * * Care should be taken to to avoid XSS vulnerabilities as the caption and * description are rendered as html. * * @see #showNotification(Notification) * @see Notification * * @param caption * The caption of the message * @param description * The message description * @param type * The message type * * @deprecated As of 7.0, use new Notification(...).show(Page) instead but * be aware that HTML by default not allowed. */ @Deprecated public void showNotification(String caption, String description, Notification.Type type) { Notification notification = new Notification(caption, description, type); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); }
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()); }
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()); }
@Override public void run() { if(!AnnisBaseUI.handleCommonError(ex, "get corpus configurations")) { new Notification(ERROR_MESSAGE_CORPUS_PROPS_HEADER, ERROR_MESSAGE_CORPUS_PROPS, Notification.Type.WARNING_MESSAGE, true). show(Page.getCurrent()); } } });
/** * Displays a localized warning. * @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()); } }
public static Notification build(final String caption, final String description, final int delayMsec, final boolean htmlContentAllowed) { Notification notification = new Notification(caption); notification.setDescription(description); notification.setStyleName("tray dark small closable login-help"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(delayMsec); notification.setHtmlContentAllowed(htmlContentAllowed); return notification; }
private void printDocument(Doc doc, PrintRequestAttributeSet aset, DocPrintJob job) { try { job.print(doc, aset); getUI().access(() -> new Notification("See the result!", HUMANIZED_MESSAGE) .show(getPage()) ); } catch (PrintException e) { // may be called from Swing thread getUI().access(() -> { new Notification("Unable to print file, please check settings", WARNING_MESSAGE).show(getPage()); }); } } }
@Override public void buttonClick(ClickEvent event) { String caption = "Help"; if(getCaption() != null && !getCaption().isEmpty()) { caption = "Help for \"" + getCaption(); } caption = caption + "<br/><br/>(Click here to close)"; Notification notify = new Notification(caption, Notification.Type.HUMANIZED_MESSAGE); notify.setHtmlContentAllowed(true); notify.setDescription(field.getDescription()); notify.setDelayMsec(-1); notify.show(UI.getCurrent().getPage()); }
/** * Method for displaying notification for the user. * * @param message the message to be displayed * @param description the description of this message * @param type the type of this notification */ public void notifyMessage(String message, String description, Notification.Type type) { Notification m_notification = new Notification("Message", type); m_notification.setCaption(message); m_notification.setDescription(description); m_notification.setDelayMsec(1000); if (getUI() != null) { if (getPage() != null) { m_notification.show(getUI().getPage()); } } }
/** * Method for displaying notification for the user. * * @param message the message to be displayed * @param description the description of this message * @param type the type of this notification */ public void notifyMessage(String message, String description, Notification.Type type) { Notification notification = new Notification("Message", type); notification.setCaption(message); notification.setDescription(description); notification.setDelayMsec(1000); if (getUI() != null) { if (getPage() != null) { notification.show(getUI().getPage()); } } }
@Override public void buttonClick(ClickEvent clickEvent) { platformConfigurationService.saveConfigurationValue (ConfigurationConstants.DASHBOARD_BASE_URL, dashboardBaseUrl.getValue()); platformConfigurationService.saveWebServiceUsername(usernameField.getValue()); platformConfigurationService.saveWebServicePassword(passwordField.getValue()); Notification notification = new Notification( "Saved", "The configuration has been saved successfully!", Type.HUMANIZED_MESSAGE); notification.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE); notification.show(Page.getCurrent()); } });
@Override public void buttonClick(ClickEvent clickEvent) { platformConfigurationService.saveConfigurationValue (ConfigurationConstants.REPLAY_TARGET_SERVERS, replayServers.getValue()); platformConfigurationService.saveConfigurationValue (ConfigurationConstants.NOTIFICATION_INTERVAL_MINUTES, notificationIntervalMinutes.getValue()); platformConfigurationService.saveConfigurationValue (ConfigurationConstants.SEARCH_RESULT_SET_SIZE, searchResultSize.getValue()); Notification notification = new Notification( "Saved", "The configuration has been saved successfully!", Type.HUMANIZED_MESSAGE); notification.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE); notification.show(Page.getCurrent()); } });
@Override public void enter(final ViewChangeListener.ViewChangeEvent event) { final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName()); if (view == null) { message.setValue(i18n.getMessage("message.error.view", event.getViewName())); return; } if (dashboardMenu.isAccessDenied(event.getViewName())) { final Notification nt = new Notification("Access denied", i18n.getMessage("message.accessdenied.view", event.getViewName()), Type.ERROR_MESSAGE, false); nt.setStyleName(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE); nt.setPosition(Position.BOTTOM_RIGHT); nt.show(UI.getCurrent().getPage()); message.setValue(i18n.getMessage("message.accessdenied.view", event.getViewName())); } }