Example usage for com.vaadin.ui Notification show

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

Introduction

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

Prototype

public static Notification show(String caption, String description, Type type) 

Source Link

Document

Shows a notification message the current page.

Usage

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.ApplicationLoginListener.java

License:Apache License

@Override
public void onLogin(final LoginEvent event) {
    loginRequest.setEmail(event.getUserName());
    loginRequest.setUserpassword(event.getPassword());
    loginRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());

    final LoginResponse response = (LoginResponse) applicationManager.service(loginRequest);
    if (ServiceResult.SUCCESS == response.getResult()) {
        LOGGER.info(LOG_MSG_LOGIN_REQUEST, event.getUserName());

        UI.getCurrent().getNavigator().navigateTo(UserViews.USERHOME_VIEW_NAME);
    } else {/*from  w  ww  .jav  a 2s .  c  o  m*/
        Notification.show(LOGIN_FAILED, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        LOGGER.info(LOG_MSG_LOGIN_REQUEST_FAILURE, event.getUserName());
    }

}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.CommitFormWrapperClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    try {/* w  w  w  .  ja  v a 2 s .  co m*/
        fieldGroup.commit();
    } catch (final CommitException e) {
        Notification.show(FORM_ERROR, e.getMessage(), Notification.Type.WARNING_MESSAGE);
        LOGGER.warn(FORM_ERROR, e);
    }
    buttonListener.buttonClick(event);
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.LogoutClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final ServiceResponse response = applicationManager.service(logoutRequest);

    if (ServiceResult.SUCCESS == response.getResult()) {
        UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
        UI.getCurrent().getSession().close();
        VaadinService.getCurrentRequest().getWrappedSession().invalidate();
    } else {//w  w w.ja v a2 s . com
        Notification.show(LOGOUT_FAILED, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        LOGGER.info(LOG_MSG_LOGOUT_FAILURE, logoutRequest.getSessionId());
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RegisterUserClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final ServiceResponse response = applicationManager.service(reqisterRequest);
    if (ServiceResult.SUCCESS == response.getResult()) {
        LOGGER.info(LOG_MSG_REGISTER_USER, reqisterRequest.getUsername());
        UI.getCurrent().getNavigator().navigateTo(UserViews.USERHOME_VIEW_NAME);
    } else {/* ww  w. j a  va2  s . co m*/
        Notification.show(REGISTER_FAILED, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        LOGGER.info(REGISTER_USER_FAILURE, reqisterRequest.getUsername());
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SearchDocumentClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final SearchDocumentResponse response = (SearchDocumentResponse) applicationManager
            .service(reqisterRequest);//from w ww.j  ava 2s  .  c om
    if (ServiceResult.SUCCESS == response.getResult()) {
        LOGGER.info(LOG_MSG_SEARCH_DOCUMENT, reqisterRequest.getSearchExpression());
        Notification.show(SEARCH_SUCCESS, "Found :" + response.getResultElement().size(),
                Notification.Type.HUMANIZED_MESSAGE);
        responseHandler.handle(response);

    } else {
        Notification.show(SEARCH_FAILED, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        LOGGER.info(LOG_MSG_SEARCH_DOCUMENT_FAILURE, reqisterRequest.getSearchExpression());
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SendEmailClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final ServiceResponse response = applicationManager.service(sendEmailRequest);
    if (ServiceResult.SUCCESS == response.getResult()) {
        LOGGER.info(LOG_MSG_SEND_EMAIL, sendEmailRequest.getEmail());
        UI.getCurrent().getNavigator().navigateTo(UserViews.USERHOME_VIEW_NAME);
    } else {//from   w w  w  .j  a v a 2  s .c o m
        Notification.show(SEND_EMAIL_FAILEDFAILED, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        LOGGER.info(SEND_EMAIL_FAILURE, sendEmailRequest.getEmail());
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SetGoogleAuthenticatorCredentialClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final SetGoogleAuthenticatorCredentialResponse response = (SetGoogleAuthenticatorCredentialResponse) applicationManager
            .service(googleAuthRequest);

    if (ServiceResult.SUCCESS == response.getResult()) {

        try {// w  ww .  j a  va2s . c o  m
            final URI keyUri = new URI(response.getOtpAuthTotpURL());
            final QRCode qrCode = new QRCode(QR_CODE, keyUri.toASCIIString());
            qrCode.setHeight(QR_CODE_IMAGE_SIZE);
            qrCode.setWidth(QR_CODE_IMAGE_SIZE);

            final Window mywindow = new Window(GOOGLE_AUTHENTICATOR_QR_CODE);
            mywindow.setHeight(MODAL_WINDOW_SIZE);
            mywindow.setWidth(MODAL_WINDOW_SIZE);

            mywindow.setPositionX(WINDOW_POSITION);
            mywindow.setPositionY(WINDOW_POSITION);

            final VerticalLayout panelContent = new VerticalLayout();

            mywindow.setContent(panelContent);
            panelContent.addComponent(qrCode);

            mywindow.setModal(true);
            UI.getCurrent().addWindow(mywindow);

        } catch (final URISyntaxException e) {
            LOGGER.warn(PROBLEM_DISPLAYING_QR_CODE, e);
            Notification.show(PROBLEM_DISPLAYING_QR_CODE, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        }

    } else {
        Notification.show(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR, ERROR_MESSAGE,
                Notification.Type.WARNING_MESSAGE);
        LOGGER.info(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR_SESSIONID, googleAuthRequest.getSessionId());
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateApplicationConfigurationClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final ServiceResponse response = applicationManager.service(request);
    if (ServiceResult.SUCCESS == response.getResult()) {
        LOGGER.info(LOG_UPDATE_APPLICATION_CONFIGURATION, request.getApplicationConfigurationId());

        UI.getCurrent().getNavigator().navigateTo(AdminViews.ADMIN_APPLICATIONS_CONFIGURATION_VIEW_NAME + "/"
                + request.getApplicationConfigurationId());

    } else {//from   w w  w  . j a  v a 2s. co m
        Notification.show(UPDATE_APPLICATION_CONFIGURATION_FAILED, ERROR_MESSAGE,
                Notification.Type.WARNING_MESSAGE);
        LOGGER.info(LOG_MSG_UPDATE_APPLICATION_CONFIGURATION_FAILURE, request.getApplicationConfigurationId());
    }
}

From source file:com.hybridbpm.ui.component.AbstractTabLayout.java

License:Apache License

@Override
public void buttonClick(final Button.ClickEvent event) {
    try {// w w w. j  a  v  a 2s .  com
        if (event.getButton().equals(btnAdd)) {
            addNew();
        } else if (event.getButton().equals(btnRefresh)) {
            refreshData();
        }
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.AbstractTableLayout.java

License:Apache License

@Override
public void buttonClick(final Button.ClickEvent event) {
    try {//from  w w  w  .j  a v a 2s.  c  o m
        if (event.getButton().equals(btnAdd)) {
            addNew();
        } else if (event.getButton().equals(btnRefresh)) {
            refreshTable();
        }
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}