Example usage for com.vaadin.ui Notification POSITION_BOTTOM_RIGHT

List of usage examples for com.vaadin.ui Notification POSITION_BOTTOM_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Notification POSITION_BOTTOM_RIGHT.

Prototype

Position POSITION_BOTTOM_RIGHT

To view the source code for com.vaadin.ui Notification POSITION_BOTTOM_RIGHT.

Click Source Link

Usage

From source file:com.expressui.core.MainApplication.java

License:Open Source License

/**
 * Shows message in tray area./*  ww w .  ja  v a2  s  . c o  m*/
 *
 * @param delayMSec delay in milliseconds to display message
 * @param message   message to display
 */
public void showTrayMessage(int delayMSec, String message) {
    Window.Notification notification = new Window.Notification(message,
            Window.Notification.TYPE_TRAY_NOTIFICATION);
    notification.setPosition(Window.Notification.POSITION_BOTTOM_RIGHT);
    notification.setDelayMsec(delayMSec);
    notification.setHtmlContentAllowed(true);
    getInstance().showNotification(notification);
}

From source file:VaadinIRC.main.java

License:Open Source License

/**
 * Shows login panel for the user./*  w  ww. j av  a 2 s  . c om*/
 */
private void showLoginPanel() {
    loginPanel = new Panel("Login");
    loginPanel.setWidth(250, Sizeable.UNITS_PIXELS);
    loginPanel.setHeight(200, Sizeable.UNITS_PIXELS);
    LoginForm login = new LoginForm();
    loginPanel.addComponent(login);
    window.addComponent(loginPanel);
    VerticalLayout windowLayout = (VerticalLayout) window.getLayout();
    windowLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);

    login.addListener(new LoginListener() {
        public void onLogin(LoginEvent event) {
            String username = event.getLoginParameter("username");
            String password = event.getLoginParameter("password");
            if (username.equals(settings.AUTHENTICATION_USERNAME)
                    && password.equals(settings.AUTHENTICATION_PASSWORD)) {
                window.removeComponent(loginPanel);
                startMainApplication();
            } else {
                Notification notification = new Notification("Wrong username or password.",
                        Notification.TYPE_ERROR_MESSAGE);
                notification.setPosition(Notification.POSITION_BOTTOM_RIGHT);
                notification.setDelayMsec(250);
                window.showNotification(notification);
            }
        }
    });
}