Example usage for com.vaadin.server FontAwesome OUTDENT

List of usage examples for com.vaadin.server FontAwesome OUTDENT

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome OUTDENT.

Prototype

FontAwesome OUTDENT

To view the source code for com.vaadin.server FontAwesome OUTDENT.

Click Source Link

Usage

From source file:com.dungnv.streetfood.ui.SlideShowItemUI.java

private void buildAction() {

    lbTitle.addStyleName("lb-status-active");

    String info = "";

    if (!StringUtils.isNullOrEmpty(item.getId())) {
        info += StringUtils.isNullOrEmpty(info)
                ? FontAwesome.OUTDENT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getId()
                : "&nbsp|" + FontAwesome.OUTDENT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getId();
    }/*from  w  ww.j  av a 2 s .  co m*/

    if (!StringUtils.isNullOrEmpty(item.getValidFromGmt())) {
        info += StringUtils.isNullOrEmpty(info)
                ? FontAwesome.OUTDENT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getValidFromGmt()
                : "&nbsp|" + FontAwesome.OUTDENT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getValidFromGmt();
    }

    if (!StringUtils.isNullOrEmpty(item.getValidToGmt())) {
        info += StringUtils.isNullOrEmpty(info)
                ? FontAwesome.OUTDENT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getValidToGmt()
                : "&nbsp|" + FontAwesome.OUTDENT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getValidToGmt();
    }

    if (!StringUtils.isNullOrEmpty(info)) {
        lbInfo.setCaption(info);
    }

    btnEdit.addClickListener((Button.ClickEvent event) -> {
        if (item != null) {
            SlideShowInsert slideShowInsert = new SlideShowInsert(item//
            , event.getButton().findAncestor(SlideShowView.class)//
            , Constants.ACTION.UPDATE);
            slideShowInsert.setWidth("80%");
            slideShowInsert.setHeight("90%");
            slideShowInsert.setModal(true);
            FWUtils.reloadWindow(slideShowInsert);
            UI.getCurrent().addWindow(slideShowInsert);
        }
    });

    btnDelete.addClickListener((Button.ClickEvent event) -> {
        ConfirmDialog.show(UI.getCurrent(), BundleUtils.getLanguage("lbl.confirm")//
        , BundleUtils.getLanguage("message.category.delete.confirm")//
        , BundleUtils.getLanguage("lbl.yes")//
        , BundleUtils.getLanguage("lbl.no")//
        , (ConfirmDialog cd) -> {
            if (cd.isConfirmed()) {
                UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName());
                ResultDTO result = ClientServiceImpl.getInstance().deleteSlideShow(user.getUsername()//
                , getLocale().getLanguage(), getLocale().getCountry(), null, Long.valueOf(itemId));
                if (result != null && Constants.SUCCESS.equals(result.getMessage())) {
                    mainView.onSearch(Boolean.TRUE);
                    UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class));
                } else {
                    Notification.show(
                            result == null || result.getKey() == null ? Constants.FAIL : result.getKey(),
                            Notification.Type.ERROR_MESSAGE);
                }
            }
        });
    });

}