Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dhbw.clippinggorilla.utilities.ui; import com.vaadin.server.Page; import com.vaadin.shared.Position; import com.vaadin.ui.Notification; import com.vaadin.ui.themes.ValoTheme; /** * * @author josua.frank */ public class VaadinUtils { public static void errorNotification(String caption) { errorNotification(caption, null); } public static void errorNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000); not.setPosition(Position.TOP_CENTER); not.setStyleName(ValoTheme.NOTIFICATION_FAILURE + " " + ValoTheme.NOTIFICATION_SMALL); not.show(Page.getCurrent()); } public static void infoNotification(String caption) { VaadinUtils.infoNotification(caption, null); } public static void infoNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000); not.setPosition(Position.BOTTOM_CENTER); not.show(Page.getCurrent()); } public static void middleInfoNotification(String caption) { middleInforNotification(caption, null); } public static void middleInforNotification(String caption, String descripton) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000); not.setPosition(Position.MIDDLE_CENTER); not.show(Page.getCurrent()); } }