List of usage examples for com.vaadin.ui Notification getStyleName
public String getStyleName()
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();/*www .ja v a 2 s. c o 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()); } }