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, Type type) 

Source Link

Document

Shows a notification message the current page.

Usage

From source file:com.dungnv.streetfood.view.DishLink.java

private void setActionRestaurant() {
    tuiRestaurant.getBtnSave().addClickListener(new Button.ClickListener() {
        @Override/*from w w  w  . j a  v  a  2 s  . c  o m*/
        public void buttonClick(Button.ClickEvent event) {
            restaurantRightContainer.removeAllContainerFilters();
            List<RestaurantDTO> list = restaurantRightContainer.getItemIds();
            List<String> listId = new ArrayList<>();
            if (list != null) {
                list.stream().forEach((dto) -> {
                    listId.add(dto.getId());
                });
            }

            ResultDTO result = ClientServiceImpl.getInstance().insertListRestaurantToDish(user.getUsername()//
            , getLocale().getLanguage(), getLocale().getCountry(), null, dto.getId(), listId);
            if (result != null && Constants.SUCCESS.equals(result.getMessage())) {
                UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class));
            } else {
                Notification.show(result == null || result.getKey() == null ? Constants.FAIL : result.getKey(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });
}

From source file:com.dungnv.streetfood.view.DishLink.java

private void setActionArticle() {
    tuiArticle.getBtnSave().addClickListener(new Button.ClickListener() {
        @Override/*from  w w  w .j a v a  2 s. com*/
        public void buttonClick(Button.ClickEvent event) {
            articleRightContainer.removeAllContainerFilters();
            List<ArticleDTO> list = articleRightContainer.getItemIds();
            List<String> listId = new ArrayList<>();
            if (list != null) {
                list.stream().forEach((dto) -> {
                    listId.add(dto.getId());
                });
            }

            ResultDTO result = ClientServiceImpl.getInstance().insertListArticleToDish(user.getUsername()//
            , getLocale().getLanguage(), getLocale().getCountry(), null, dto.getId(), listId);
            if (result != null && Constants.SUCCESS.equals(result.getMessage())) {
                UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class));
            } else {
                Notification.show(result == null || result.getKey() == null ? Constants.FAIL : result.getKey(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });
}

From source file:com.dungnv.streetfood.view.RestaurantInsert.java

@Override
public void wizardCompleted(WizardCompletedEvent event) {
    UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName());
    ResultDTO result = null;/* ww w  .j  a  va  2s. c  om*/
    if (null != action) {
        switch (action) {
        case INSERT:
            result = ClientServiceImpl.getInstance().insertRestaurant(user.getUsername()//
                    , getLocale().getLanguage(), getLocale().getCountry(), null, dto);
            break;
        case UPDATE:
            result = ClientServiceImpl.getInstance().updateRestaurant(user.getUsername()//
                    , getLocale().getLanguage(), getLocale().getCountry(), null, dto);
            break;
        default:
            UI.getCurrent().removeWindow(event.getWizard().findAncestor(Window.class));
            return;
        }
    }

    if (result != null && Constants.SUCCESS.equals(result.getMessage())) {
        view.onSearch(Boolean.TRUE);
        UI.getCurrent().removeWindow(event.getWizard().findAncestor(Window.class));
    } else {
        Notification.show(result == null || result.getKey() == null ? Constants.FAIL : result.getKey(),
                Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.dungnv.streetfood.view.RestaurantLink.java

private void setActionArticle() {
    tuiArticle.getBtnSave().addClickListener(new Button.ClickListener() {
        @Override/*from www  .j a  va  2s . com*/
        public void buttonClick(Button.ClickEvent event) {
            articleRightContainer.removeAllContainerFilters();
            List<ArticleDTO> list = articleRightContainer.getItemIds();
            List<String> listId = new ArrayList<>();
            if (list != null) {
                list.stream().forEach((dto) -> {
                    listId.add(dto.getId());
                });
            }

            ResultDTO result = ClientServiceImpl.getInstance().insertListArticleToRestaurant(user.getUsername()//
            , getLocale().getLanguage(), getLocale().getCountry(), null, dto.getId(), listId);
            if (result != null && Constants.SUCCESS.equals(result.getMessage())) {
                UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class));
            } else {
                Notification.show(result == null || result.getKey() == null ? Constants.FAIL : result.getKey(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });
}

From source file:com.dungnv.streetfood.view.SlideShowInsert.java

@Override
public void wizardCompleted(WizardCompletedEvent event) {
    UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName());
    ResultDTO result = null;//  w w w.  j  a  va2s  .  co m
    if (null != action) {
        switch (action) {
        case INSERT:
            result = ClientServiceImpl.getInstance().insertSlideShow(user.getUsername()//
                    , getLocale().getLanguage(), getLocale().getCountry(), null, dto);
            break;
        case UPDATE:
            result = ClientServiceImpl.getInstance().updateSlideShow(user.getUsername()//
                    , getLocale().getLanguage(), getLocale().getCountry(), null, dto);
            break;
        default:
            UI.getCurrent().removeWindow(event.getWizard().findAncestor(Window.class));
            return;
        }
    }

    if (result != null && Constants.SUCCESS.equals(result.getMessage())) {
        view.onSearch(Boolean.TRUE);
        UI.getCurrent().removeWindow(event.getWizard().findAncestor(Window.class));
    } else {
        Notification.show(result == null || result.getKey() == null ? Constants.FAIL : result.getKey(),
                Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.etest.connection.ErrorDBNotification.java

public static void errorNotificationOnDBAccess(String error) {
    Notification.show(error, Notification.Type.ERROR_MESSAGE);
}

From source file:com.etest.connection.ShowErrorNotification.java

public static void error(String error) {
    Label label = new Label();
    label.setWidth("400px");
    label.setValue(error);//from w  w w  .  j  av  a  2  s.  c o  m
    label.setContentMode(ContentMode.HTML);
    Notification.show(label.getValue(), Notification.Type.ERROR_MESSAGE);
}

From source file:com.etest.connection.ShowErrorNotification.java

public static void warning(String error) {
    Notification.show(error, Notification.Type.WARNING_MESSAGE);
}

From source file:com.etest.connection.ShowErrorNotification.java

public static void tray(String error) {
    Notification.show(error, Notification.Type.TRAY_NOTIFICATION);
}

From source file:com.etest.global.ShowErrorNotification.java

public static void error(String error) {
    Notification.show(error, Notification.Type.ERROR_MESSAGE);
}