Example usage for com.vaadin.server FontAwesome EYE

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

Introduction

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

Prototype

FontAwesome EYE

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

Click Source Link

Usage

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

private void buildAction() {

    String info = !StringUtils.isNullOrEmpty(item.getId())
            ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId()
                    + "</b>"
            : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>";

    info += !StringUtils.isNullOrEmpty(item.getViewCount())
            ? "&nbsp|" + FontAwesome.EYE.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getViewCount()
            : "&nbsp|" + FontAwesome.EYE.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    if (!StringUtils.isNullOrEmpty(info)) {
        lbInfo.setCaption(info);/*from ww  w.  j a v  a2s  .  co m*/
    }

    btnLink.addClickListener((Button.ClickEvent event) -> {
        if (item != null) {
            ArticleLink dishLink = new ArticleLink(item);
            dishLink.setWidth("80%");
            dishLink.setHeight("75%");
            dishLink.setModal(true);
            FWUtils.reloadWindow(dishLink);
            UI.getCurrent().addWindow(dishLink);
        }
    });

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

    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().deleteArticle(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);
                }
            }
        });
    });

}

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

private void buildAction() {

    if ("1".equals(item.getDishStatus())) {
        lbTitle.addStyleName("lb-status-active");
    } else {/*from   ww  w  .ja  va2  s  .  c o  m*/
        lbTitle.addStyleName("lb-status-inActive");
    }

    String info = !StringUtils.isNullOrEmpty(item.getId())
            ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId()
                    + "</b>"
            : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>";

    info += !StringUtils.isNullOrEmpty(item.getRating())
            ? "&nbsp|" + FontAwesome.STAR_O.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getRating()
            : "&nbsp|" + FontAwesome.STAR_O.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    info += !StringUtils.isNullOrEmpty(item.getViewCount())
            ? "&nbsp|" + FontAwesome.EYE.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getViewCount()
            : "&nbsp|" + FontAwesome.EYE.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    info += !StringUtils.isNullOrEmpty(item.getCommentCount())
            ? "&nbsp|" + FontAwesome.COMMENTS.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getCommentCount()
            : "&nbsp|" + FontAwesome.COMMENTS.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    info += !StringUtils.isNullOrEmpty(item.getShareCount())
            ? "&nbsp|" + FontAwesome.SHARE_ALT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getShareCount()
            : "&nbsp|" + FontAwesome.SHARE_ALT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

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

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

    btnLink.addClickListener((Button.ClickEvent event) -> {
        if (item != null) {
            DishLink dishLink = new DishLink(item);
            dishLink.setWidth("80%");
            dishLink.setHeight("75%");
            dishLink.setModal(true);
            FWUtils.reloadWindow(dishLink);
            UI.getCurrent().addWindow(dishLink);
        }
    });

    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().deleteDish(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);
                }
            }
        });
    });

}

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

private void buildAction() {

    if ("1".equals(item.getRestaurantStatus())) {
        lbTitle.addStyleName("lb-status-active");
    } else {//from   w w w  .  j  a v a2s . co  m
        lbTitle.addStyleName("lb-status-inActive");
    }

    String info = !StringUtils.isNullOrEmpty(item.getId())
            ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId()
                    + "</b>"
            : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>";

    info += !StringUtils.isNullOrEmpty(item.getRating())
            ? "&nbsp|" + FontAwesome.STAR_O.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getRating()
            : "&nbsp|" + FontAwesome.STAR_O.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    info += !StringUtils.isNullOrEmpty(item.getViewCount())
            ? "&nbsp|" + FontAwesome.EYE.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getViewCount()
            : "&nbsp|" + FontAwesome.EYE.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    info += !StringUtils.isNullOrEmpty(item.getCommentCount())
            ? "&nbsp|" + FontAwesome.COMMENTS.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getCommentCount()
            : "&nbsp|" + FontAwesome.COMMENTS.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";

    info += !StringUtils.isNullOrEmpty(item.getShareCount())
            ? "&nbsp|" + FontAwesome.SHARE_ALT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getShareCount()
            : "&nbsp|" + FontAwesome.SHARE_ALT.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--";
    //        
    //        info += !StringUtils.isNullOrEmpty(item.getOperatingTimeStart())
    //                ? "&nbsp|" + FontAwesome.CLOCK_O.getHtml() + "&nbsp&nbsp:&nbsp&nbsp" + item.getOperatingTimeStart() + " / "
    //                : "&nbsp|" + FontAwesome.CLOCK_O.getHtml() + "&nbsp&nbsp:&nbsp&nbsp--:--" + " / ";
    //        
    //        info += !StringUtils.isNullOrEmpty(item.getOperatingTimeEnd())
    //                ?  item.getOperatingTimeEnd() : "--:--" ;

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

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

    btnLink.addClickListener((Button.ClickEvent event) -> {
        if (item != null) {
            RestaurantLink restaurantLink = new RestaurantLink(item);
            restaurantLink.setWidth("80%");
            restaurantLink.setHeight("75%");
            restaurantLink.setModal(true);
            FWUtils.reloadWindow(restaurantLink);
            UI.getCurrent().addWindow(restaurantLink);
        }
    });

    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().deleteRestaurant(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);
                }
            }
        });
    });

}

From source file:com.esofthead.mycollab.community.module.project.view.bug.BugPopupFieldFactoryImpl.java

License:Open Source License

@Override
public AbstractComponent createFollowersPopupField(SimpleBug bug) {
    return new MetaFieldBuilder().withCaptionAndIcon(FontAwesome.EYE, "" + bug.getNumFollowers())
            .withDescription(AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS)).build();
}

From source file:com.esofthead.mycollab.community.module.project.view.task.TaskPopupFieldFactoryImpl.java

License:Open Source License

@Override
public AbstractComponent createFollowersPopupField(SimpleTask task) {
    return new MetaFieldBuilder()
            .withCaptionAndIcon(FontAwesome.EYE, "" + NumberUtils.zeroIfNull(task.getNumFollowers()))
            .withDescription(AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS)).build();
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmFollowersComp.java

License:Open Source License

public void displayFollowers(final V bean) {
    this.bean = bean;
    this.removeAllComponents();

    MHorizontalLayout header = new MHorizontalLayout();
    Label followerHeader = new Label(
            FontAwesome.EYE.getHtml() + " " + AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS),
            ContentMode.HTML);//w w w.ja  va  2 s.co m
    followerHeader.setStyleName("info-hdr");
    header.addComponent(followerHeader);

    if (hasEditPermission()) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditWatchersWindow(bean);

                    }
                });
        editBtn.setStyleName("link");
        header.addComponent(editBtn);
    }

    this.addComponent(header);
    header.addComponent(new Label("/"));

    currentUserFollow = isUserWatching(bean);

    final Button toogleWatching = new Button("");
    toogleWatching.setStyleName("link");
    toogleWatching.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (currentUserFollow) {
                unfollowItem(AppContext.getUsername(), bean);
                currentUserFollow = false;
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
            } else {
                followItem(AppContext.getUsername(), bean);
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
                currentUserFollow = true;
            }

            updateTotalFollowers(bean);
        }
    });
    header.addComponent(toogleWatching);

    if (currentUserFollow) {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
    } else {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
    }

    MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withWidth("100%");

    this.addComponent(layout);

    int totalFollowers = getTotalFollowers(bean);
    followersBtn = new Button(AppContext.getMessage(FollowerI18nEnum.OPT_NUM_FOLLOWERS, totalFollowers),
            new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    if (hasReadPermission()) {
                        showEditWatchersWindow(bean);
                    }

                }
            });
    followersBtn.setStyleName("link");
    layout.addComponent(followersBtn);
}

From source file:com.esofthead.mycollab.module.project.ui.components.ProjectFollowersComp.java

License:Open Source License

public void displayFollowers(final V bean) {
    this.bean = bean;
    this.removeAllComponents();
    this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true));

    MHorizontalLayout header = new MHorizontalLayout().withSpacing(true);
    Label followerHeader = new Label(
            FontAwesome.EYE.getHtml() + " " + AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS),
            ContentMode.HTML);/*from  w w w .  j  a  v  a  2s .  co  m*/
    followerHeader.setStyleName("info-hdr");
    header.addComponent(followerHeader);

    if (hasEditPermission()) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditWatchersWindow(bean);

                    }
                });
        editBtn.setStyleName("link");
        editBtn.addStyleName("info-hdr");
        header.addComponent(editBtn);
    }

    this.addComponent(header);
    Label sep = new Label("/");
    sep.setStyleName("info-hdr");
    header.addComponent(sep);

    currentUserFollow = isUserWatching(bean);

    final Button toogleWatching = new Button("");
    toogleWatching.setStyleName("link");
    toogleWatching.addStyleName("info-hdr");
    toogleWatching.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (currentUserFollow) {
                unfollowItem(AppContext.getUsername(), bean);
                currentUserFollow = false;
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
            } else {
                followItem(AppContext.getUsername(), bean);
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
                currentUserFollow = true;
            }

            updateTotalFollowers(bean);
        }
    });
    header.addComponent(toogleWatching);

    if (currentUserFollow) {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
    } else {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
    }

    MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true)
            .withMargin(new MarginInfo(false, false, false, true));
    this.addComponent(layout);

    int totalFollowers = getTotalFollowers(bean);
    followersBtn = new Button(AppContext.getMessage(FollowerI18nEnum.OPT_NUM_FOLLOWERS, totalFollowers),
            new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    if (hasReadPermission()) {
                        showEditWatchersWindow(bean);
                    }

                }
            });
    followersBtn.setStyleName("link");
    layout.addComponent(followersBtn);
}

From source file:com.esofthead.mycollab.module.project.view.FollowingTicketViewImpl.java

License:Open Source License

public FollowingTicketViewImpl() {
    this.setWidth("100%");

    final MVerticalLayout headerWrapper = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withWidth("100%").withStyleName("projectfeed-hdr-wrapper");

    final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%");

    final Label layoutHeader = new Label(FontAwesome.EYE.getHtml() + " My Following Tickets", ContentMode.HTML);
    layoutHeader.addStyleName("h2");
    header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader);

    headerWrapper.addComponent(header);/*  w  w w . ja v a2  s .  c o m*/
    this.addComponent(headerWrapper);

    MHorizontalLayout controlBtns = new MHorizontalLayout().withSpacing(false)
            .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%");

    final MVerticalLayout contentWrapper = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withWidth("100%");
    contentWrapper.addStyleName("content-wrapper");

    contentWrapper.addComponent(controlBtns);
    this.addComponent(contentWrapper);

    final Button backBtn = new Button(AppContext.getMessage(FollowerI18nEnum.BUTTON_BACK_TO_WORKBOARD));
    backBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoProjectModule(FollowingTicketViewImpl.this, null));
        }
    });

    backBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    backBtn.setIcon(FontAwesome.ARROW_LEFT);

    controlBtns.addComponent(backBtn);
    controlBtns.setExpandRatio(backBtn, 1.0f);

    Button exportBtn = new Button("Export", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            exportButtonControl.setPopupVisible(true);
        }
    });
    exportButtonControl = new SplitButton(exportBtn);
    exportButtonControl.setWidthUndefined();
    exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);

    VerticalLayout popupButtonsControl = new VerticalLayout();
    exportButtonControl.setContent(popupButtonsControl);

    Button exportPdfBtn = new Button("Pdf");
    FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
    pdfDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    exportPdfBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportPdfBtn);

    Button exportExcelBtn = new Button("Excel");
    FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    exportExcelBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportExcelBtn);

    controlBtns.addComponent(exportButtonControl);

    searchPanel = new FollowingTicketSearchPanel();
    contentWrapper.addComponent(searchPanel);

    this.ticketTable = new FollowingTicketTableDisplay();
    this.ticketTable.addStyleName("full-border-table");
    this.ticketTable.setMargin(new MarginInfo(true, false, false, false));
    contentWrapper.addComponent(this.ticketTable);
}

From source file:com.esofthead.mycollab.module.project.view.UserDashboardViewImpl.java

License:Open Source License

@Override
protected void displayView() {
    this.removeAllComponents();

    this.withMargin(false).withWidth("100%");

    final CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.setStyleName("projectfeed-hdr-wrapper");

    final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%");
    header.addStyleName("projectfeed-hdr");

    Button avatar = UserAvatarControlFactory.createUserAvatarEmbeddedButton(AppContext.getUserAvatarId(), 64);
    avatar.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//w ww  . j ava 2s  . c  o  m
        public void buttonClick(final ClickEvent event) {
            String userFullLinkStr = AccountLinkGenerator.generatePreviewFullUserLink(AppContext.getSiteUrl(),
                    AppContext.getUsername());
            getUI().getPage().open(userFullLinkStr, null);
        }
    });

    header.addComponent(avatar);

    final MVerticalLayout headerContent = new MVerticalLayout()
            .withMargin(new MarginInfo(false, false, false, true));
    headerContent.addStyleName("projectfeed-hdr-content");

    final Label headerLabel = new Label(AppContext.getSession().getDisplayName());
    headerLabel.setStyleName(Reindeer.LABEL_H1);

    final MHorizontalLayout headerContentTop = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, false, true, false));
    headerContentTop.with(headerLabel).withAlign(headerLabel, Alignment.TOP_LEFT);

    if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) {
        final Button createProjectBtn = new Button(
                AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_NEW_PROJECT), new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final Button.ClickEvent event) {
                        final ProjectAddWindow projectNewWindow = new ProjectAddWindow();
                        UI.getCurrent().addWindow(projectNewWindow);
                    }
                });
        createProjectBtn.setIcon(FontAwesome.PLUS);
        createProjectBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        headerContentTop.addComponent(createProjectBtn);
        headerContentTop.setComponentAlignment(createProjectBtn, Alignment.MIDDLE_LEFT);
    }

    followingTicketsLink = new LabelLink(AppContext.getMessage(FollowerI18nEnum.OPT_MY_FOLLOWING_TICKETS, 0),
            AppContext.getSiteUrl() + "#project/following");

    followingTicketsLink.setIconLink(FontAwesome.EYE);

    LabelLink timeTrackingLink = new LabelLink(AppContext.getMessage(TimeTrackingI18nEnum.TIME_RECORD_HEADER),
            AppContext.getSiteUrl() + "#project/timetracking");
    timeTrackingLink.setIconLink(ProjectAssetsManager.getAsset(ProjectTypeConstants.TIME));

    final MHorizontalLayout headerContentBottom = new MHorizontalLayout().withMargin(false)
            .with(followingTicketsLink, timeTrackingLink);

    headerContent.with(headerContentTop, headerContentBottom);

    header.with(headerContent).expand(headerContent);
    headerWrapper.addComponent(header);

    this.addComponent(headerWrapper);

    final MHorizontalLayout layout = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%");

    ActivityStreamComponent activityStreamComponent = new ActivityStreamComponent();
    final MVerticalLayout leftPanel = new MVerticalLayout().withSpacing(false)
            .withMargin(new MarginInfo(false, true, false, false)).withWidth("100%")
            .with(activityStreamComponent);

    final MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false).withWidth("565px");
    MyProjectListComponent myProjectListComponent = new MyProjectListComponent();
    TaskStatusComponent taskStatusComponent = new TaskStatusComponent();
    rightPanel.with(myProjectListComponent, taskStatusComponent);

    layout.with(leftPanel, rightPanel).expand(leftPanel);

    final CssLayout contentWrapper = new CssLayout();
    contentWrapper.setWidth("100%");
    contentWrapper.addStyleName("content-wrapper");
    this.addComponent(contentWrapper);
    contentWrapper.addComponent(layout);

    final ProjectService prjService = ApplicationContextUtil.getSpringBean(ProjectService.class);
    prjKeys = prjService.getProjectKeysUserInvolved(AppContext.getUsername(), AppContext.getAccountId());
    if (CollectionUtils.isNotEmpty(prjKeys)) {
        activityStreamComponent.showFeeds(prjKeys);
        myProjectListComponent.displayDefaultProjectsList();
        displayFollowingTicketsCount();
    }

    taskStatusComponent.showProjectTasksByStatus(prjKeys);

}

From source file:com.hybridbpm.ui.MainMenu.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(valoMenuToggleButton)) {
        if (getStyleName().contains(STYLE_VISIBLE)) {
            removeStyleName(STYLE_VISIBLE);
        } else {//from w  ww  .j ava2s . c  om
            addStyleName(STYLE_VISIBLE);
        }
    } else if (event.getButton().equals(developerButton)) {
        HybridbpmUI.setDeveloperMode(!HybridbpmUI.getDeveloperMode());
        developerButton.setIcon(HybridbpmUI.getDeveloperMode() ? FontAwesome.EYE : FontAwesome.EYE_SLASH);
        developerButton.setDescription(
                HybridbpmUI.getDeveloperMode() ? "Turn off developer mode" : "Turn on developer mode");
        HybridbpmUI.getCurrent().buildMenu(HybridbpmUI.getCurrent().getNavigator().getState(), true,
                HybridbpmUI.getCurrent().getNavigator().getState());
    }
}