List of usage examples for com.vaadin.server FontAwesome TRASH_O
FontAwesome TRASH_O
To view the source code for com.vaadin.server FontAwesome TRASH_O.
Click Source Link
From source file:com.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private Layout displayPageBlock(final Page resource) { MVerticalLayout container = new MVerticalLayout().withFullWidth().withStyleName("page-item-block"); A pageHtml = new A( ProjectLinkBuilder.generatePageFullLink(CurrentProjectVariables.getProjectId(), resource.getPath())) .appendText(FontAwesome.FILE_WORD_O.getHtml() + " " + resource.getSubject()); ELabel pageLink = ELabel.h3(pageHtml.write()); container.with(pageLink, new SafeHtmlLabel(resource.getContent(), 400)); Label lastUpdateInfo = new ELabel(UserUIContext.getMessage(PageI18nEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(CurrentProjectVariables.getProjectId(), resource.getLastUpdatedUser(), true), UserUIContext.formatPrettyTime(resource.getLastUpdatedTime().getTime())), ContentMode.HTML) .withDescription(UserUIContext.formatDateTime(resource.getLastUpdatedTime().getTime())); lastUpdateInfo.addStyleName(UIConstants.META_INFO); container.addComponent(lastUpdateInfo); MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> EventBusFactory.getInstance() .post(new PageEvent.GotoEdit(PageListViewImpl.this, resource))).withIcon(FontAwesome.EDIT) .withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING); editBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { PageService pageService = AppContextUtil.getSpringBean(PageService.class); pageService.removeResource(resource.getPath()); resources.remove(resource); displayPages(resources); }/*from w w w.j a v a 2 s . c o m*/ }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING); deleteBtn.setVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES)); container.addComponent(new MHorizontalLayout(editBtn, deleteBtn)); return container; }
From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleProjectMember member) { HorizontalLayout blockContent = new HorizontalLayout(); blockContent.setStyleName("member-block"); if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) { blockContent.addStyleName("inactive"); }//from w w w. ja v a 2s. co m blockContent.setWidth("350px"); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); memberAvatar.setWidthUndefined(); blockContent.addComponent(memberAvatar); MVerticalLayout blockTop = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)) .withFullWidth(); MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, member))) .withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); editBtn.setDescription("Edit user '" + member.getDisplayName() + "' information"); MButton deleteBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectMemberService prjMemberService = AppContextUtil .getSpringBean(ProjectMemberService.class); prjMemberService.removeWithSession(member, UserUIContext.getUsername(), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null)); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); deleteBtn.setDescription("Remove user '" + member.getDisplayName() + "' out of this project"); MHorizontalLayout buttonControls = new MHorizontalLayout(editBtn, deleteBtn); blockTop.addComponent(buttonControls); blockTop.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT); A memberLink = new A( ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername())) .appendText(member.getMemberFullName()).setTitle(member.getMemberFullName()); ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS) .withFullWidth(); blockTop.with(memberNameLbl, ELabel.hr()); String roleLink = String.format("<a href=\"%s%s%s\"", MyCollabUI.getSiteUrl(), GenericLinkUtils.URL_PREFIX_PARAM, ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid())); ELabel memberRole = new ELabel("", ContentMode.HTML).withFullWidth() .withStyleName(UIConstants.TEXT_ELLIPSIS); if (member.isProjectOwner()) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", roleLink, UserUIContext.getMessage(ProjectRoleI18nEnum.OPT_ADMIN_ROLE_DISPLAY))); } else { memberRole.setValue( String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", roleLink, member.getRoleName())); } blockTop.addComponent(memberRole); if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.META_INFO).withFullWidth(); blockTop.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getJoindate()))) .withDescription(UserUIContext.formatDateTime(member.getJoindate())).withFullWidth(); blockTop.addComponent(memberSinceLabel); if (ProjectMemberStatusConstants.ACTIVE.equals(member.getStatus())) { ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastAccessTime()))) .withDescription(UserUIContext.formatDateTime(member.getLastAccessTime())); blockTop.addComponent(lastAccessTimeLbl); } String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " " + new Span().appendText("" + member.getNumOpenTasks()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) + " " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " " + new Span().appendText("" + member.getNumOpenBugs()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " " + FontAwesome.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + " " + FontAwesome.GIFT.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)); blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO)); blockContent.addComponent(blockTop); blockContent.setExpandRatio(blockTop, 1.0f); return blockContent; }
From source file:com.mycollab.module.project.view.task.components.TaskRowRenderer.java
License:Open Source License
private OptionPopupContent createPopupContent() { OptionPopupContent filterBtnLayout = new OptionPopupContent(); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { MButton editButton = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> { taskSettingPopupBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new TaskEvent.GotoEdit(TaskRowRenderer.this, task)); }).withIcon(FontAwesome.EDIT);/*from w w w .j a va2 s. c om*/ filterBtnLayout.addOption(editButton); filterBtnLayout.addSeparator(); } if (!task.isCompleted()) { if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { MButton closeBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE), clickEvent -> { task.setStatus(OptionI18nEnum.StatusI18nEnum.Closed.name()); task.setPercentagecomplete(100d); ProjectTaskService projectTaskService = AppContextUtil.getSpringBean(ProjectTaskService.class); projectTaskService.updateSelectiveWithSession(task, AppContext.getUsername()); taskSettingPopupBtn.setPopupVisible(false); closeTask(); EventBusFactory.getInstance().post(new TaskEvent.HasTaskChange(TaskRowRenderer.this, null)); }).withIcon(FontAwesome.CHECK_CIRCLE_O); filterBtnLayout.addOption(closeBtn); } } else { if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { MButton reOpenBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN), clickEvent -> { taskSettingPopupBtn.setPopupVisible(false); task.setStatus(OptionI18nEnum.StatusI18nEnum.Open.name()); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = AppContextUtil.getSpringBean(ProjectTaskService.class); projectTaskService.updateSelectiveWithSession(task, AppContext.getUsername()); reOpenTask(); EventBusFactory.getInstance().post(new TaskEvent.HasTaskChange(TaskRowRenderer.this, null)); }).withIcon(FontAwesome.UNLOCK); filterBtnLayout.addOption(reOpenBtn); } } filterBtnLayout.addSeparator(); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) { MButton deleteBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> { taskSettingPopupBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectTaskService projectTaskService = AppContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.removeWithSession(task, AppContext.getUsername(), AppContext.getAccountId()); deleteTask(); } }); }).withIcon(FontAwesome.TRASH_O); filterBtnLayout.addDangerOption(deleteBtn); } return filterBtnLayout; }
From source file:com.mycollab.module.project.view.task.TaskKanbanBoardViewImpl.java
License:Open Source License
public TaskKanbanBoardViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); toggleShowColumnsBtn = new MButton("", clickEvent -> { displayHiddenColumns = !displayHiddenColumns; reload();//from w w w . j a v a2s . c o m toggleShowButton(); }).withStyleName(WebThemes.BUTTON_LINK); groupWrapLayout.addComponent(toggleShowColumnsBtn); toggleShowButton(); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) { MButton addNewColumnBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN), clickEvent -> UI.getCurrent() .addWindow(new AddNewColumnWindow(this, ProjectTypeConstants.TASK, "status"))) .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION); groupWrapLayout.addComponent(addNewColumnBtn); } MButton deleteColumnBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.ACTION_DELETE_COLUMNS), clickEvent -> UI.getCurrent().addWindow(new DeleteColumnWindow(this, ProjectTypeConstants.TASK))) .withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER); deleteColumnBtn.setVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); MButton advanceDisplayBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST), clickEvent -> EventBusFactory.getInstance().post(new TicketEvent.GotoDashboard(this, null))) .withIcon(FontAwesome.NAVICON).withWidth("100px"); MButton kanbanBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_KANBAN)) .withIcon(FontAwesome.TH).withWidth("100px"); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new DDHorizontalLayout(); kanbanLayout.setHeight("100%"); kanbanLayout.addStyleName("kanban-layout"); kanbanLayout.setSpacing(true); kanbanLayout.setMargin(new MarginInfo(true, false, true, false)); kanbanLayout.setComponentHorizontalDropRatio(0.3f); kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER); // Enable dropping components kanbanLayout.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event .getTargetDetails(); Component dragComponent = transferable.getComponent(); if (dragComponent instanceof KanbanBlock) { KanbanBlock kanbanItem = (KanbanBlock) dragComponent; int newIndex = details.getOverIndex(); if (details.getDropLocation() == HorizontalDropLocation.RIGHT) { kanbanLayout.addComponent(kanbanItem); } else if (newIndex == -1) { kanbanLayout.addComponent(kanbanItem, 0); } else { kanbanLayout.addComponent(kanbanItem, newIndex); } //Update options index for this project List<Map<String, Integer>> indexMap = new ArrayList<>(); for (int i = 0; i < kanbanLayout.getComponentCount(); i++) { KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i); Map<String, Integer> map = new HashMap<>(2); map.put("id", blockItem.optionVal.getId()); map.put("index", i); indexMap.add(map); } if (indexMap.size() > 0) { optionValService.massUpdateOptionIndexes(indexMap, MyCollabUI.getAccountId()); } } } @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } }); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:com.mycollab.module.project.view.user.ProjectInfoComponent.java
License:Open Source License
public ProjectInfoComponent(SimpleProject project) { this.withMargin(false).withFullWidth(); Component projectIcon = ProjectAssetsUtil.buildProjectLogo(project.getShortname(), project.getId(), project.getAvatarid(), 64);/* w w w . ja va 2 s . co m*/ this.with(projectIcon).withAlign(projectIcon, Alignment.TOP_LEFT); ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class); breadCrumb.setProject(project); MVerticalLayout headerLayout = new MVerticalLayout().withSpacing(false) .withMargin(new MarginInfo(false, true, false, true)); MHorizontalLayout footer = new MHorizontalLayout().withStyleName(UIConstants.META_INFO, WebThemes.FLEX_DISPLAY); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel createdTimeLbl = ELabel .html(FontAwesome.CLOCK_O.getHtml() + " " + UserUIContext.formatPrettyTime(project.getCreatedtime())) .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(createdTimeLbl); billableHoursLbl = ELabel .html(FontAwesome.MONEY.getHtml() + " " + NumberUtils.roundDouble(2, project.getTotalBillableHours())) .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(billableHoursLbl); nonBillableHoursLbl = ELabel.html(FontAwesome.GIFT.getHtml() + " " + project.getTotalNonBillableHours()) .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(nonBillableHoursLbl); if (project.getLead() != null) { Div leadAvatar = new DivLessFormatter() .appendChild(new Img("", StorageFactory.getAvatarPath(project.getLeadAvatarId(), 16)) .setCSSClass(UIConstants.CIRCLE_BOX), DivLessFormatter.EMPTY_SPACE(), new A(ProjectLinkBuilder.generateProjectMemberFullLink(project.getId(), project.getLead())) .appendText(StringUtils.trim(project.getLeadFullName(), 30, true))) .setTitle(project.getLeadFullName()); ELabel leadLbl = ELabel .html(UserUIContext.getMessage(ProjectI18nEnum.FORM_LEADER) + ": " + leadAvatar.write()) .withWidthUndefined(); footer.addComponents(leadLbl); } if (project.getHomepage() != null) { ELabel homepageLbl = ELabel .html(FontAwesome.WECHAT.getHtml() + " " + new A(project.getHomepage()) .appendText(project.getHomepage()).setTarget("_blank").write()) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); homepageLbl.setDescription(UserUIContext.getMessage(ProjectI18nEnum.FORM_HOME_PAGE)); } if (project.getNumActiveMembers() > 0) { ELabel activeMembersLbl = ELabel.html(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers()) .withDescription(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(activeMembersLbl); } if (project.getAccountid() != null && !SiteConfiguration.isCommunityEdition()) { Div clientDiv = new Div(); if (project.getClientAvatarId() == null) { clientDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " "); } else { Img clientImg = new Img("", StorageFactory.getEntityLogoPath(MyCollabUI.getAccountId(), project.getClientAvatarId(), 16)).setCSSClass(UIConstants.CIRCLE_BOX); clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE()); } clientDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) .appendText(StringUtils.trim(project.getClientName(), 30, true))); ELabel accountBtn = ELabel.html(clientDiv.write()).withStyleName(WebThemes.BUTTON_LINK) .withWidthUndefined(); footer.addComponents(accountBtn); } if (!SiteConfiguration.isCommunityEdition()) { MButton tagBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_TAG), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoTagListView(this, null))) .withIcon(FontAwesome.TAGS) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(tagBtn); MButton favoriteBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_FAVORITES), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoFavoriteView(this, null))) .withIcon(FontAwesome.STAR) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(favoriteBtn); MButton eventBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_CALENDAR), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoCalendarView(this))) .withIcon(FontAwesome.CALENDAR) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(eventBtn); MButton ganttChartBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_GANTT_CHART), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoGanttChart(this, null))) .withIcon(FontAwesome.BAR_CHART_O) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(ganttChartBtn); } headerLayout.with(breadCrumb, footer); MHorizontalLayout topPanel = new MHorizontalLayout().withMargin(false); this.with(headerLayout, topPanel).expand(headerLayout).withAlign(topPanel, Alignment.TOP_RIGHT); if (project.isProjectArchived()) { MButton activeProjectBtn = new MButton( UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), clickEvent -> { ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class); project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Open.name()); projectService.updateSelectiveWithSession(project, UserUIContext.getUsername()); PageActionChain chain = new PageActionChain( new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); }).withStyleName(WebThemes.BUTTON_ACTION); topPanel.with(activeProjectBtn).withAlign(activeProjectBtn, Alignment.MIDDLE_RIGHT); } else { SearchTextField searchField = new SearchTextField() { public void doSearch(String value) { ProjectView prjView = UIUtils.getRoot(this, ProjectView.class); if (prjView != null) { prjView.displaySearchResult(value); } } @Override public void emptySearch() { } }; final PopupButton controlsBtn = new PopupButton(); controlsBtn.addStyleName(WebThemes.BOX); controlsBtn.setIcon(FontAwesome.ELLIPSIS_H); OptionPopupContent popupButtonsControl = new OptionPopupContent(); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) { MButton inviteMemberBtn = new MButton( UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), clickEvent -> { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoInviteMembers(this, null)); }).withIcon(FontAwesome.SEND); popupButtonsControl.addOption(inviteMemberBtn); } MButton settingBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS), clickEvent -> { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new ProjectNotificationEvent.GotoList(this, null)); }).withIcon(FontAwesome.COG); popupButtonsControl.addOption(settingBtn); popupButtonsControl.addSeparator(); if (UserUIContext.canAccess(RolePermissionCollections.CREATE_NEW_PROJECT)) { final MButton markProjectTemplateBtn = new MButton().withIcon(FontAwesome.ANCHOR); markProjectTemplateBtn.addClickListener(clickEvent -> { Boolean isTemplate = !MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE); project.setIstemplate(isTemplate); ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.class); prjService.updateWithSession(project, UserUIContext.getUsername()); if (project.getIstemplate()) { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE)); } else { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE)); } }); Boolean isTemplate = MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE); if (isTemplate) { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE)); } else { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE)); } popupButtonsControl.addOption(markProjectTemplateBtn); } if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) { MButton editProjectBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.EDIT), clickEvent -> { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new ProjectEvent.GotoEdit(ProjectInfoComponent.this, project)); }).withIcon(FontAwesome.EDIT); popupButtonsControl.addOption(editProjectBtn); } if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) { MButton archiveProjectBtn = new MButton( UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), clickEvent -> { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.WINDOW_WARNING_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectService projectService = AppContextUtil .getSpringBean(ProjectService.class); project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Archived.name()); projectService.updateSelectiveWithSession(project, UserUIContext.getUsername()); PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto( CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance() .post(new ProjectEvent.GotoMyProject(this, chain)); } }); }).withIcon(FontAwesome.ARCHIVE); popupButtonsControl.addOption(archiveProjectBtn); } if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) { popupButtonsControl.addSeparator(); MButton deleteProjectBtn = new MButton( UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), clickEvent -> { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectService projectService = AppContextUtil .getSpringBean(ProjectService.class); projectService.removeWithSession(CurrentProjectVariables.getProject(), UserUIContext.getUsername(), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(this, null)); } }); }).withIcon(FontAwesome.TRASH_O); popupButtonsControl.addDangerOption(deleteProjectBtn); } controlsBtn.setContent(popupButtonsControl); controlsBtn.setWidthUndefined(); topPanel.with(searchField, controlsBtn).withAlign(searchField, Alignment.TOP_RIGHT) .withAlign(controlsBtn, Alignment.TOP_RIGHT); } }
From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleUser member) { VerticalLayout blockContent = new VerticalLayout(); blockContent.setWidth("350px"); blockContent.setStyleName("member-block"); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { blockContent.addStyleName("inactive"); }/*from w w w . j a va 2s.c o m*/ MHorizontalLayout blockTop = new MHorizontalLayout().withFullWidth(); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); blockTop.addComponent(memberAvatar); MVerticalLayout memberInfo = new MVerticalLayout().withMargin(false); MHorizontalLayout buttonControls = new MHorizontalLayout(); buttonControls.setDefaultComponentAlignment(Alignment.TOP_RIGHT); buttonControls.setVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { MButton resendBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_RESEND_INVITATION), clickEvent -> { SendUserInvitationEvent invitationEvent = new SendUserInvitationEvent(member.getUsername(), null, member.getInviteUser(), MyCollabUI.getSubDomain(), MyCollabUI.getAccountId()); AsyncEventBus asyncEventBus = AppContextUtil.getSpringBean(AsyncEventBus.class); asyncEventBus.post(invitationEvent); NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_SUCCESS), UserUIContext.getMessage(UserI18nEnum.OPT_SEND_INVITATION_SUCCESSFULLY, member.getDisplayName())); }).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(resendBtn); } MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance() .post(new UserEvent.GotoEdit(UserListViewImpl.this, member))).withIcon(FontAwesome.EDIT) .withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(editBtn); MButton deleteBtn = new MButton("", clickEvent -> ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { UserService userService = AppContextUtil.getSpringBean(UserService.class); userService.pendingUserAccounts(Collections.singletonList(member.getUsername()), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new UserEvent.GotoList(UserListViewImpl.this, null)); } })).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(deleteBtn); memberInfo.addComponent(buttonControls); memberInfo.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT); A memberLink = new A( AccountLinkGenerator.generatePreviewFullUserLink(MyCollabUI.getSiteUrl(), member.getUsername())) .appendText(member.getDisplayName()); ELabel memberLinkLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS); memberInfo.addComponent(memberLinkLbl); memberInfo.addComponent(ELabel.hr()); if (member.getRoleid() != null) { String memberRoleLinkPrefix = String.format("<a href=\"%s\"", AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid())); ELabel memberRole = new ELabel(ContentMode.HTML).withStyleName(UIConstants.TEXT_ELLIPSIS); if (Boolean.TRUE.equals(member.getIsAccountOwner())) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", memberRoleLinkPrefix, UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER))); } else { memberRole.setValue(String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", memberRoleLinkPrefix, member.getRoleName())); } memberInfo.addComponent(memberRole); } else if (Boolean.TRUE.equals(member.getIsAccountOwner())) { Label memberRole = new Label(String.format("<a style=\"color: #B00000;\">%s</a>", UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)), ContentMode.HTML); memberInfo.addComponent(memberRole); } else { Label lbl = new Label(); lbl.setHeight("10px"); memberInfo.addComponent(lbl); } if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.TEXT_ELLIPSIS, UIConstants.META_INFO).withFullWidth(); memberInfo.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getRegisteredtime()))) .withDescription(UserUIContext.formatDateTime(member.getRegisteredtime())).withFullWidth(); memberInfo.addComponent(memberSinceLabel); ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastaccessedtime()))) .withDescription(UserUIContext.formatDateTime(member.getLastaccessedtime())); memberInfo.addComponent(lastAccessTimeLbl); blockTop.with(memberInfo).expand(memberInfo); blockContent.addComponent(blockTop); return blockContent; }
From source file:com.mycollab.module.user.ui.components.PreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) { optionBtn = new PopupButton(); optionBtn.addStyleName(WebThemes.BUTTON_OPTION); optionBtn.setIcon(FontAwesome.ELLIPSIS_H); if (permissionItem != null) { boolean canWrite = UserUIContext.canWrite(permissionItem); boolean canAccess = UserUIContext.canAccess(permissionItem); boolean canRead = UserUIContext.canRead(permissionItem); if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireAddForm(item); }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite); editButtons.addComponent(addBtn); }//w ww . j a v a 2s . c o m if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireEditForm(item); }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite); editButtons.addComponent(editBtn); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> { T item = previewForm.getBean(); previewForm.fireDeleteForm(item); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER) .withVisible(canAccess); editButtons.addComponent(deleteBtn); } layout.with(editButtons); if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) { ButtonGroup navigationBtns = new ButtonGroup(); MButton previousItem = new MButton("", clickEvent -> { T item = previewForm.getBean(); previewForm.fireGotoPrevious(item); }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_ACTION) .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM)) .withVisible(canRead); navigationBtns.addButton(previousItem); MButton nextItemBtn = new MButton("", clickEvent -> { T item = previewForm.getBean(); previewForm.fireGotoNextItem(item); }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_ACTION) .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM)) .withVisible(canRead); navigationBtns.addButton(nextItemBtn); layout.with(navigationBtns); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireCloneForm(item); }).withIcon(FontAwesome.ROAD).withVisible(canWrite); popupButtonsControl.addOption(cloneBtn); } if (popupButtonsControl.getComponentCount() > 0) { optionBtn.setContent(popupButtonsControl); layout.with(optionBtn); } } return layout; }
From source file:com.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java
License:Open Source License
private void addAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/* w ww . j av a 2s. co m*/ final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Link thumbnail = new Link(); if (StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } else { thumbnail.setIcon(VaadinResourceFactory.getResource(attachment.getThumbnail())); } if (MimeTypesUtil.isImageType(docName)) { thumbnail.setResource(VaadinResourceFactory.getResource(attachment.getPath())); new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true); } Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold")); Ul ul = new Ul().appendChild(new Li().appendText(UserUIContext.getMessage(FileI18nEnum.OPT_SIZE_VALUE, FileUtils.getVolumeDisplay(attachment.getSize())))).setStyle("line-height:1.5em"); ul.appendChild(new Li().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_LAST_MODIFIED, UserUIContext.formatPrettyTime(attachment.getLastModified().getTime())))); contentTooltip.appendChild(ul); thumbnail.setDescription(contentTooltip.write()); thumbnail.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); MCssLayout attachmentNameWrap = new MCssLayout() .withWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH).withStyleName("attachment-name-wrap"); Label attachmentName = new ELabel(docName).withStyleName(UIConstants.TEXT_ELLIPSIS); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); MButton trashBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(), true, MyCollabUI.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); MButton downloadBtn = new MButton().withIcon(FontAwesome.DOWNLOAD).withStyleName("attachment-control"); FileDownloader fileDownloader = new FileDownloader( VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); this.addComponent(attachmentLayout); }
From source file:com.mycollab.vaadin.web.ui.AttachmentPanel.java
License:Open Source License
private void displayFileName(File file, final String fileName) { final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout().withFullWidth(); MButton removeBtn = new MButton("", clickEvent -> { File tmpFile = fileStores.get(fileName); if (tmpFile != null) { tmpFile.delete();/*from w w w . j av a 2s . c o m*/ } fileStores.remove(fileName); AttachmentPanel.this.removeComponent(fileAttachmentLayout); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY); ELabel fileLbl = ELabel.html(fileName).withDescription(fileName).withStyleName(UIConstants.TEXT_ELLIPSIS); fileAttachmentLayout .with(ELabel.fontIcon(FileAssetsUtil.getFileIconResource(fileName)).withWidthUndefined(), fileLbl, new ELabel(" - " + FileUtils.getVolumeDisplay(file.length())) .withStyleName(UIConstants.META_INFO).withWidthUndefined(), removeBtn) .expand(fileLbl); this.addComponent(fileAttachmentLayout, 0); }
From source file:com.mycollab.vaadin.web.ui.ProjectPreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) { optionBtn = new PopupButton(); optionBtn.addStyleName(WebThemes.BUTTON_OPTION); optionBtn.setIcon(FontAwesome.ELLIPSIS_H); if (permissionItem != null) { boolean canWrite = CurrentProjectVariables.canWrite(permissionItem); boolean canAccess = CurrentProjectVariables.canAccess(permissionItem); boolean canRead = CurrentProjectVariables.canRead(permissionItem); if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) { MButton assignBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), clickEvent -> {//from ww w. j a v a2 s . com T item = previewForm.getBean(); previewForm.fireAssignForm(item); }).withIcon(FontAwesome.SHARE).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite); editButtons.addComponent(assignBtn); } if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireAddForm(item); }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite); editButtons.addComponent(addBtn); } if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireEditForm(item); }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite); editButtons.addComponent(editBtn); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> { T item = previewForm.getBean(); previewForm.fireDeleteForm(item); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER) .withVisible(canAccess); editButtons.addComponent(deleteBtn); } if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) { final PrintButton printBtn = new PrintButton(); printBtn.withListener(clickEvent -> { T item = previewForm.getBean(); previewForm.firePrintForm(printBtn, item); }).withStyleName(WebThemes.BUTTON_OPTION) .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_PRINT)) .withVisible(canRead); editButtons.addComponent(printBtn); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> { optionBtn.setPopupVisible(false); T item = previewForm.getBean(); previewForm.fireCloneForm(item); }).withIcon(FontAwesome.ROAD).withVisible(canWrite); popupButtonsControl.addOption(cloneBtn); } layout.with(editButtons); if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) { ButtonGroup navigationBtns = new ButtonGroup(); MButton previousItem = new MButton("", clickEvent -> { T item = previewForm.getBean(); previewForm.fireGotoPrevious(item); }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_OPTION) .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM)) .withVisible(canRead); navigationBtns.addButton(previousItem); MButton nextItemBtn = new MButton("", clickEvent -> { T item = previewForm.getBean(); previewForm.fireGotoNextItem(item); }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_OPTION) .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM)) .withVisible(canRead); navigationBtns.addButton(nextItemBtn); layout.addComponent(navigationBtns); } if (popupButtonsControl.getComponentCount() > 0) { optionBtn.setContent(popupButtonsControl); layout.addComponent(optionBtn); } } return layout; }