List of usage examples for com.vaadin.ui.themes ValoTheme NOTIFICATION_WARNING
String NOTIFICATION_WARNING
To view the source code for com.vaadin.ui.themes ValoTheme NOTIFICATION_WARNING.
Click Source Link
From source file:life.qbic.utils.qOfferManagerUtils.java
License:Open Source License
/** * Displays a vaadin Notification with the respective title, description and type. * @param title: title of the displayNotification window * @param description: description of the displayNotification Window * @param type: one of "error", "success" and "warning". Changes the style and the delay of the displayNotification. *///from www . j av a 2 s . co m public static void displayNotification(String title, String description, String type) { com.vaadin.ui.Notification notify = new com.vaadin.ui.Notification(title, description); notify.setPosition(Position.TOP_CENTER); switch (type) { case "error": notify.setDelayMsec(16000); notify.setIcon(FontAwesome.FROWN_O); notify.setStyleName(ValoTheme.NOTIFICATION_ERROR + " " + ValoTheme.NOTIFICATION_CLOSABLE); break; case "success": notify.setDelayMsec(8000); notify.setIcon(FontAwesome.SMILE_O); notify.setStyleName(ValoTheme.NOTIFICATION_SUCCESS + " " + ValoTheme.NOTIFICATION_CLOSABLE); break; case "warning": notify.setDelayMsec(16000); notify.setIcon(FontAwesome.MEH_O); notify.setStyleName(ValoTheme.NOTIFICATION_WARNING + " " + ValoTheme.NOTIFICATION_CLOSABLE); break; default: notify.setDelayMsec(16000); notify.setIcon(FontAwesome.MEH_O); notify.setStyleName(ValoTheme.NOTIFICATION_TRAY + " " + ValoTheme.NOTIFICATION_CLOSABLE); break; } notify.show(Page.getCurrent()); }
From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java
License:Open Source License
public static void notify(String caption, String message, Throwable ex, Type type) { Page page = Page.getCurrent();/*from ww w . j a v a 2s . co m*/ if (page != null) { Notification notification = new Notification(caption, contactWithLineFeed(FormatUtils.wordWrap(message, 150)), Type.HUMANIZED_MESSAGE); notification.setPosition(Position.MIDDLE_CENTER); notification.setDelayMsec(-1); String style = ValoTheme.NOTIFICATION_SUCCESS; if (type == Type.ERROR_MESSAGE) { style = ValoTheme.NOTIFICATION_FAILURE; } else if (type == Type.WARNING_MESSAGE) { style = ValoTheme.NOTIFICATION_WARNING; } notification.setStyleName( notification.getStyleName() + " " + ValoTheme.NOTIFICATION_CLOSABLE + " " + style); notification.show(Page.getCurrent()); } }