com.mycollab.vaadin.UserUIContext.getUsername() - java examples

Here are the examples of the java api com.mycollab.vaadin.UserUIContext.getUsername() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

47 Examples 7

19 View Complete Implementation : StandupListPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    IReportContainer projectModule = (IReportContainer) container;
    projectModule.addView(view);
    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
    List<Integer> projectKeys = projectService.getOpenProjectKeysUserInvolved(UserUIContext.getUsername(), AppUI.getAccountId());
    if (CollectionUtils.isNotEmpty(projectKeys)) {
        LocalDate date = (LocalDate) data.getParams();
        view.display(projectKeys, date);
        ReportBreadcrumb breadCrumb = ViewManager.getCacheComponent(ReportBreadcrumb.clreplaced);
        breadCrumb.gotoStandupList(date);
    }
}

19 View Complete Implementation : ComponentAddWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void onSave(Component bean) {
    ComponentService componentService = AppContextUtil.getSpringBean(ComponentService.clreplaced);
    componentService.saveWithSession(bean, UserUIContext.getUsername());
    close();
}

19 View Complete Implementation : VersionAddWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void onSave(Version bean) {
    VersionService versionService = AppContextUtil.getSpringBean(VersionService.clreplaced);
    versionService.saveWithSession(bean, UserUIContext.getUsername());
    close();
}

19 View Complete Implementation : ComponentAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void save(Component item) {
    ComponentService componentService = AppContextUtil.getSpringBean(ComponentService.clreplaced);
    if (item.getId() == null) {
        item.setCreateduser(UserUIContext.getUsername());
        componentService.saveWithSession(item, UserUIContext.getUsername());
    } else {
        componentService.updateWithSession(item, UserUIContext.getUsername());
    }
}

19 View Complete Implementation : ProfileReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void process(BufferedImage image) {
    UserAvatarService userAvatarService = AppContextUtil.getSpringBean(UserAvatarService.clreplaced);
    userAvatarService.uploadAvatar(image, UserUIContext.getUsername(), UserUIContext.getUserAvatarId());
    UIUtils.reloadPage();
}

19 View Complete Implementation : AdRequestWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void turnOffAdd(SimpleUser user) {
    user.setRequestad(true);
    UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
    userService.updateSelectiveWithSession(user, UserUIContext.getUsername());
}

18 View Complete Implementation : StandupAddWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void onSave(StandupReportWithBLOBs standupReport) {
    if (standupReport.getId() == null) {
        standupReportService.saveWithSession(standupReport, UserUIContext.getUsername());
    } else {
        standupReportService.updateWithSession(standupReport, UserUIContext.getUsername());
    }
    EventBusFactory.getInstance().post(new StandUpEvent.DisplayStandupInProject(this, standupReport.getProjectid()));
    close();
}

18 View Complete Implementation : ProjectMemberEditPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void saveProjectMember(ProjectMember projectMember) {
    ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.clreplaced);
    if (projectMember.getId() == null) {
        throw new MyCollabException("User not exist in projectMember table, something goes wrong in DB");
    } else {
        projectMemberService.updateWithSession(projectMember, UserUIContext.getUsername());
    }
}

18 View Complete Implementation : CustomizeReportOutputWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Set<TableViewField> getViewColumns() {
    CustomViewStoreService customViewStoreService = AppContextUtil.getSpringBean(CustomViewStoreService.clreplaced);
    CustomViewStore viewLayoutDef = customViewStoreService.getViewLayoutDef(AppUI.getAccountId(), UserUIContext.getUsername(), viewId);
    if (!(viewLayoutDef instanceof NullCustomViewStore)) {
        try {
            return new HashSet<>(FieldDefreplacedyzer.toTableFields(viewLayoutDef.getViewinfo()));
        } catch (Exception e) {
            return getDefaultColumns();
        }
    } else {
        return getDefaultColumns();
    }
}

18 View Complete Implementation : AbstractPreviewItemComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private boolean isFavorite() {
    try {
        FavoriteItemService favoriteItemService = AppContextUtil.getSpringBean(FavoriteItemService.clreplaced);
        return favoriteItemService.isUserFavorite(UserUIContext.getUsername(), getType(), PropertyUtils.getProperty(beanItem, "id").toString());
    } catch (Exception e) {
        return false;
    }
}

17 View Complete Implementation : ToggleMilestoneSummaryField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void updateFieldValue(TextField editField) {
    removeComponent(editField);
    withComponents(replacedleLinkLbl, buttonControls).withStyleName("editable-field");
    String newValue = editField.getValue();
    if (StringUtils.isNotBlank(newValue) && !newValue.equals(milestone.getName())) {
        milestone.setName(newValue);
        replacedleLinkLbl.setValue(buildMilestoneLink());
        MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.clreplaced);
        milestoneService.updateSelectiveWithSession(BeanUtility.deepClone(milestone), UserUIContext.getUsername());
    }
    isRead = !isRead;
}

17 View Complete Implementation : PageAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void savePage(Page page) {
    ProjectPageService pageService = AppContextUtil.getSpringBean(ProjectPageService.clreplaced);
    pageService.savePage(page, UserUIContext.getUsername(), CurrentProjectVariables.getProjectId(), AppUI.getAccountId());
}

17 View Complete Implementation : VersionListPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void deleteSelectedItems() {
    if (!isSelectAll) {
        Collection<SimpleVersion> currentDataList = view.getPagedBeanGrid().gereplacedems();
        List<Version> keyList = new ArrayList<>();
        for (Version item : currentDataList) {
            if (item.isSelected()) {
                keyList.add(item);
            }
        }
        if (keyList.size() > 0) {
            versionService.mreplacedRemoveWithSession(keyList, UserUIContext.getUsername(), AppUI.getAccountId());
        }
    } else {
        versionService.removeByCriteria(searchCriteria, AppUI.getAccountId());
    }
    int totalCount = versionService.getTotalCount(searchCriteria);
    if (totalCount > 0) {
        doSearch(searchCriteria);
    } else {
        view.showNoItemView();
    }
}

17 View Complete Implementation : AdvancedInfoChangeWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void changeInfo() {
    user.setWebsite(txtWebsite.getValue());
    user.setCompany(txtCompany.getValue());
    user.setCountry((String) cboCountry.getValue());
    UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
    userService.updateWithSession(user, UserUIContext.getUsername());
    close();
    UIUtils.reloadPage();
}

17 View Complete Implementation : PasswordChangeWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void changePreplacedword() {
    txtNewPreplacedword.removeStyleName("errorField");
    txtConfirmPreplacedword.removeStyleName("errorField");
    if (!txtNewPreplacedword.getValue().equals(txtConfirmPreplacedword.getValue())) {
        NotificationUtil.showErrorNotification(UserUIContext.getMessage(UserI18nEnum.ERROR_PreplacedWORDS_ARE_NOT_MATCH));
        txtNewPreplacedword.addStyleName("errorField");
        txtConfirmPreplacedword.addStyleName("errorField");
        return;
    }
    try {
        PreplacedwordCheckerUtil.checkValidPreplacedword(txtNewPreplacedword.getValue());
    } catch (InvalidPreplacedwordException e) {
        NotificationUtil.showErrorNotification(e.getMessage());
    }
    user.setPreplacedword(EnDecryptHelper.encryptSaltPreplacedword(txtNewPreplacedword.getValue()));
    final UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
    userService.updateWithSession(user, UserUIContext.getUsername());
    close();
}

17 View Complete Implementation : BuildCriterionComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void saveSearchCriteria(String queryText) {
    List<SearchFieldInfo<S>> fieldInfos = buildSearchFieldInfos();
    if (CollectionUtils.isEmpty(fieldInfos)) {
        throw new UserInvalidInputException(UserUIContext.getMessage(ErrorI18nEnum.SELECT_AT_LEAST_ONE_CRITERIA));
    }
    SaveSearchResultService saveSearchResultService = AppContextUtil.getSpringBean(SaveSearchResultService.clreplaced);
    SaveSearchResult searchResult = new SaveSearchResult();
    searchResult.setSaveuser(UserUIContext.getUsername());
    searchResult.setSaccountid(AppUI.getAccountId());
    searchResult.setQuerytext(Queryreplacedyzer.toQueryParams(fieldInfos));
    searchResult.setType(searchCategory);
    searchResult.setQueryname(queryText);
    saveSearchResultService.saveWithSession(searchResult, UserUIContext.getUsername());
    buildFilterBox(queryText);
}

16 View Complete Implementation : ComponentListPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void deleteSelectedItems() {
    if (!isSelectAll) {
        Collection<SimpleComponent> currentDataList = view.getPagedBeanGrid().gereplacedems();
        List<Component> keyList = new ArrayList<>();
        for (SimpleComponent item : currentDataList) {
            if (item.isSelected()) {
                keyList.add(item);
            }
        }
        if (keyList.size() > 0) {
            componentService.mreplacedRemoveWithSession(keyList, UserUIContext.getUsername(), AppUI.getAccountId());
        }
    } else {
        componentService.removeByCriteria(searchCriteria, AppUI.getAccountId());
    }
    int totalCount = componentService.getTotalCount(searchCriteria);
    if (totalCount > 0) {
        doSearch(searchCriteria);
    } else {
        view.showNoItemView();
    }
}

16 View Complete Implementation : ProjectRoleAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void save(ProjectRole item) {
    ProjectRoleService roleService = AppContextUtil.getSpringBean(ProjectRoleService.clreplaced);
    SimpleProject project = CurrentProjectVariables.getProject();
    if (item.getId() == null) {
        roleService.saveWithSession(item, UserUIContext.getUsername());
    } else {
        roleService.updateWithSession(item, UserUIContext.getUsername());
    }
    roleService.savePermission(project.getId(), item.getId(), view.getPermissionMap(), AppUI.getAccountId());
}

16 View Complete Implementation : VersionAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void save(Version item) {
    VersionService versionService = AppContextUtil.getSpringBean(VersionService.clreplaced);
    if (item.getId() == null) {
        versionService.saveWithSession(item, UserUIContext.getUsername());
    } else {
        versionService.updateWithSession(item, UserUIContext.getUsername());
    }
}

16 View Complete Implementation : RoleAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void save(Role item) {
    RoleService roleService = AppContextUtil.getSpringBean(RoleService.clreplaced);
    item.setSaccountid(AppUI.getAccountId());
    if (item.getId() == null) {
        roleService.saveWithSession(item, UserUIContext.getUsername());
    } else {
        roleService.updateWithSession(item, UserUIContext.getUsername());
    }
    roleService.savePermission(item.getId(), view.getPermissionMap(), item.getSaccountid());
}

16 View Complete Implementation : AttachmentPanel.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void saveContentsToRepo(String attachmentPath) {
    if (MapUtils.isNotEmpty(fileStores)) {
        for (Map.Entry<String, File> entry : fileStores.entrySet()) {
            try {
                String fileName = entry.getKey();
                File file = entry.getValue();
                resourceService.saveContent(constructContent(fileName, attachmentPath), UserUIContext.getUsername(), new FileInputStream(file), AppUI.getAccountId());
                if (file.exists()) {
                    file.delete();
                }
            } catch (FileNotFoundException e) {
                LOG.error("Error when attach content in UI", e);
            }
        }
        removeAllAttachmentsDisplay();
    }
}

15 View Complete Implementation : ToggleBugSummaryField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void updateFieldValue(TextField editField) {
    removeComponent(editField);
    addComponent(replacedleLinkLbl);
    addComponent(buttonControls);
    addStyleName("editable-field");
    String newValue = editField.getValue();
    if (StringUtils.isNotBlank(newValue) && !newValue.equals(bug.getName())) {
        bug.setName(newValue);
        replacedleLinkLbl.setValue(buildBugLink());
        BugService bugService = AppContextUtil.getSpringBean(BugService.clreplaced);
        bugService.updateSelectiveWithSession(BeanUtility.deepClone(bug), UserUIContext.getUsername());
    }
    isRead = !isRead;
}

15 View Complete Implementation : ProjectRoleListPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void deleteSelectedItems() {
    if (!isSelectAll) {
        Collection<SimpleProjectRole> roles = view.getPagedBeanGrid().gereplacedems();
        List<ProjectRole> keyList = new ArrayList<>();
        for (ProjectRole item : roles) {
            if (item.isSelected()) {
                if (Boolean.TRUE.equals(item.getIssystemrole())) {
                    NotificationUtil.showErrorNotification(UserUIContext.getMessage(ProjectMemberI18nEnum.CAN_NOT_DELETE_ROLE_MESSAGE, item.getRolename()));
                } else {
                    keyList.add(item);
                }
            }
        }
        if (keyList.size() > 0) {
            projectRoleService.mreplacedRemoveWithSession(keyList, UserUIContext.getUsername(), AppUI.getAccountId());
            doSearch(searchCriteria);
            checkWhetherEnableTableActionControl();
        }
    } else {
        projectRoleService.removeByCriteria(searchCriteria, AppUI.getAccountId());
        doSearch(searchCriteria);
    }
}

15 View Complete Implementation : ToggleTaskSummaryField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void updateFieldValue(TextField editField) {
    removeComponent(editField);
    withComponents(replacedleLinkLbl, buttonControls).withStyleName("editable-field");
    String newValue = editField.getValue();
    if (StringUtils.isNotBlank(newValue) && !newValue.equals(task.getName())) {
        task.setName(newValue);
        replacedleLinkLbl.setValue(buildTaskLink());
        TaskService taskService = AppContextUtil.getSpringBean(TaskService.clreplaced);
        taskService.updateSelectiveWithSession(BeanUtility.deepClone(task), UserUIContext.getUsername());
    }
    isRead = !isRead;
}

15 View Complete Implementation : ProjectAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void saveProject(Project project) {
    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
    project.setSaccountid(AppUI.getAccountId());
    if (project.getId() == null) {
        projectService.saveWithSession(project, UserUIContext.getUsername());
    } else {
        projectService.updateWithSession(project, UserUIContext.getUsername());
        MyCollabSession.putCurrentUIVariable(MyCollabSession.CURRENT_PROJECT, project);
    }
}

15 View Complete Implementation : RoleListPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void deleteSelectedItems() {
    if (!isSelectAll) {
        Collection<SimpleRole> currentDataList = view.getPagedBeanGrid().gereplacedems();
        List<Role> keyList = new ArrayList<>();
        for (SimpleRole item : currentDataList) {
            if (item.isSelected()) {
                if (Boolean.TRUE.equals(item.getIssystemrole())) {
                    NotificationUtil.showErrorNotification(UserUIContext.getMessage(RoleI18nEnum.ERROR_CAN_NOT_DELETE_SYSTEM_ROLE, item.getRolename()));
                } else {
                    keyList.add(item);
                }
            }
        }
        if (keyList.size() > 0) {
            roleService.mreplacedRemoveWithSession(keyList, UserUIContext.getUsername(), AppUI.getAccountId());
            doSearch(searchCriteria);
        }
    } else {
        roleService.removeByCriteria(searchCriteria, AppUI.getAccountId());
        doSearch(searchCriteria);
    }
}

15 View Complete Implementation : UserAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void save(SimpleUser user) {
    boolean isRefreshable = false;
    if (user.getUsername() != null && user.getUsername().equals(UserUIContext.getUsername())) {
        isRefreshable = true;
    }
    UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
    user.setAccountId(AppUI.getAccountId());
    user.setSubDomain(AppUI.getSubDomain());
    if (StringUtils.isBlank(user.getStatus())) {
        user.setStatus(UserStatusConstants.EMAIL_VERIFIED_REQUEST);
    }
    if (StringUtils.isBlank(user.getRegisterstatus())) {
        user.setRegisterstatus(RegisterStatusConstants.NOT_LOG_IN_YET);
    }
    User existingUser = userService.findUserByUserName(user.getUsername());
    if (existingUser == null) {
        if (StringUtils.isBlank(user.getPreplacedword())) {
            user.setPreplacedword(RandomPreplacedwordGenerator.generateRandomPreplacedword());
        }
        String userPreplacedword = user.getPreplacedword();
        userService.saveUserAccount(user, user.getRoleId(), AppUI.getSubDomain(), AppUI.getAccountId(), UserUIContext.getUsername(), true);
        UI.getCurrent().addWindow(new NewUserAddedWindow(user, userPreplacedword));
    } else {
        userService.updateUserAccount(user, AppUI.getAccountId());
        EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null));
    }
    if (isRefreshable) {
        UIUtils.reloadPage();
    }
}

15 View Complete Implementation : AbstractPreviewItemComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void toggleFavorite() {
    try {
        if (isFavorite()) {
            favoriteBtn.removeStyleName("favorite-btn-selected");
            favoriteBtn.addStyleName("favorite-btn");
        } else {
            favoriteBtn.addStyleName("favorite-btn-selected");
            favoriteBtn.removeStyleName("favorite-btn");
        }
        FavoriteItem favoriteItem = new FavoriteItem();
        favoriteItem.setExtratypeid(CurrentProjectVariables.getProjectId());
        favoriteItem.setType(getType());
        favoriteItem.setTypeid(PropertyUtils.getProperty(beanItem, "id").toString());
        favoriteItem.setSaccountid(AppUI.getAccountId());
        favoriteItem.setCreateduser(UserUIContext.getUsername());
        FavoriteItemService favoriteItemService = AppContextUtil.getSpringBean(FavoriteItemService.clreplaced);
        favoriteItemService.saveOrDelete(favoriteItem);
    } catch (Exception e) {
        LOG.error("Error while set favorite flag to bean", e);
    }
}

14 View Complete Implementation : UserBulkInviteViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void sendInviteBulkUsers() {
    int rows = bulkInviteUsersLayout.getRows();
    List<Tuple2<String, String>> tuples = new ArrayList<>();
    for (int i = 1; i < rows; i++) {
        EmailField emailField = (EmailField) bulkInviteUsersLayout.getComponent(0, i);
        PreplacedwordField preplacedwordField = (PreplacedwordField) bulkInviteUsersLayout.getComponent(1, i);
        String email = emailField.getValue();
        String preplacedword = preplacedwordField.getValue();
        if (StringUtils.isBlank(email)) {
            continue;
        }
        if (StringUtils.isBlank(preplacedword)) {
            preplacedword = RandomPreplacedwordGenerator.generateRandomPreplacedword();
        }
        tuples.add(new Tuple2<>(email, preplacedword));
    }
    if (CollectionUtils.isNotEmpty(tuples)) {
        UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
        SimpleRole role = roleComboBox.getValue();
        userService.bulkInviteUsers(tuples, role.getId(), AppUI.getSubDomain(), AppUI.getAccountId(), UserUIContext.getUsername(), true);
    }
    EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null));
}

13 View Complete Implementation : ProjectMemberReadPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    boolean isCurrentUserAccess = false;
    if (data.getParams() instanceof String) {
        if (UserUIContext.getUsername().equals(data.getParams())) {
            isCurrentUserAccess = true;
        }
    }
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.USERS) || isCurrentUserAccess) {
        ProjectMemberService prjMemberService = AppContextUtil.getSpringBean(ProjectMemberService.clreplaced);
        SimpleProjectMember prjMember = null;
        if (data.getParams() instanceof Integer) {
            prjMember = prjMemberService.findById((Integer) data.getParams(), AppUI.getAccountId());
        } else if (data.getParams() instanceof String) {
            String username = (String) data.getParams();
            prjMember = prjMemberService.findMemberByUsername(username, CurrentProjectVariables.getProjectId(), AppUI.getAccountId());
        }
        if (prjMember != null) {
            ProjectView projectView = (ProjectView) container;
            projectView.gotoSubView(ProjectView.USERS_ENTRY, view);
            view.previewItem(prjMember);
            ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.clreplaced);
            breadCrumb.gotoUserRead(prjMember);
        } else {
            NotificationUtil.showRecordNotExistNotification();
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}

13 View Complete Implementation : ToggleTicketSummaryField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void updateFieldValue(TextField editField) {
    removeComponent(editField);
    addComponent(replacedleLinkLbl);
    addComponent(buttonControls);
    addStyleName("editable-field");
    String newValue = editField.getValue();
    if (StringUtils.isNotBlank(newValue) && !newValue.equals(ticket.getName())) {
        ticket.setName(newValue);
        replacedleLinkLbl.setValue(buildTicketLink());
        if (ticket.isBug()) {
            BugWithBLOBs bug = ProjectTicket.buildBug(ticket);
            BugService bugService = AppContextUtil.getSpringBean(BugService.clreplaced);
            bugService.updateSelectiveWithSession(bug, UserUIContext.getUsername());
        } else if (ticket.isTask()) {
            Task task = ProjectTicket.buildTask(ticket);
            TaskService taskService = AppContextUtil.getSpringBean(TaskService.clreplaced);
            taskService.updateSelectiveWithSession(task, UserUIContext.getUsername());
        } else if (ticket.isRisk()) {
            Risk risk = ProjectTicket.buildRisk(ticket);
            RiskService riskService = AppContextUtil.getSpringBean(RiskService.clreplaced);
            riskService.updateSelectiveWithSession(risk, UserUIContext.getUsername());
        }
    }
    isRead = !isRead;
}

13 View Complete Implementation : ProjectSearchItemsViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void displayResults(String value) {
    this.removeAllComponents();
    ELabel headerLbl = ELabel.h2("");
    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
    List<Integer> projectKeys = projectService.getOpenProjectKeysUserInvolved(UserUIContext.getUsername(), AppUI.getAccountId());
    if (projectKeys.size() > 0) {
        ProjectGenericItemSearchCriteria criteria = new ProjectGenericItemSearchCriteria();
        criteria.setPrjKeys(new SetSearchField<>(projectKeys));
        criteria.setTxtValue(StringSearchField.and(value));
        DefaultBeanPagedList<ProjectGenericItemService, ProjectGenericItemSearchCriteria, ProjectGenericItem> searchItemsTable = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectGenericItemService.clreplaced), new GenericItemRowDisplayHandler());
        int foundNum = searchItemsTable.setSearchCriteria(criteria);
        headerLbl.setValue(String.format(VaadinIcons.SEARCH.getHtml() + " " + UserUIContext.getMessage(ProjectI18nEnum.OPT_SEARCH_TERM), value, foundNum));
        this.with(headerLbl, searchItemsTable).expand(searchItemsTable);
    } else {
        this.with(new MCssLayout(new Label(UserUIContext.getMessage(GenericI18Enum.VIEW_NO_ITEM_replacedLE))).withFullWidth());
    }
}

12 View Complete Implementation : ResourcesDisplayComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void deleteResourceAction(final Collection<Resource> deletedResources) {
    ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
        if (confirmDialog.isConfirmed()) {
            for (Resource res : deletedResources) {
                if (res instanceof Folder) {
                    EventBusFactory.getInstance().post(new FileEvent.ResourceRemovedEvent(ResourcesDisplayComponent.this, res));
                }
                resourceService.removeResource(res.getPath(), UserUIContext.getUsername(), true, AppUI.getAccountId());
            }
            resourcesContainer.constructBody(baseFolder);
            NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS), UserUIContext.getMessage(FileI18nEnum.OPT_DELETE_RESOURCES_SUCCESSFULLY));
        }
    });
}

12 View Complete Implementation : PageListPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.PAGES)) {
        ProjectView pageContainer = (ProjectView) container;
        pageContainer.gotoSubView(ProjectView.PAGE_ENTRY, view);
        String path = (String) data.getParams();
        if (path == null) {
            path = CurrentProjectVariables.getCurrentPagePath();
        } else {
            CurrentProjectVariables.setCurrentPagePath(path);
        }
        List<PageResource> resources = pageService.getResources(path, UserUIContext.getUsername());
        if (!CollectionUtils.isEmpty(resources)) {
            view.displayDefaultPages(resources);
        } else {
            view.showNoItemView();
        }
        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.clreplaced);
        breadcrumb.gotoPageList();
    } else {
        throw new SecureAccessException();
    }
}

12 View Complete Implementation : TaskAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private int save(Task item) {
    TaskService taskService = AppContextUtil.getSpringBean(TaskService.clreplaced);
    item.setSaccountid(AppUI.getAccountId());
    item.setProjectid(CurrentProjectVariables.getProjectId());
    if (item.getPercentagecomplete() == null) {
        item.setPercentagecomplete(0d);
    } else if (item.getPercentagecomplete() == 100d) {
        item.setStatus(StatusI18nEnum.Closed.name());
    }
    if (item.getStatus() == null) {
        item.setStatus(StatusI18nEnum.Open.name());
    }
    if (item.getId() == null) {
        item.setCreateduser(UserUIContext.getUsername());
        int taskId = taskService.saveWithSession(item, UserUIContext.getUsername());
        TicketRelationService ticketRelationService = AppContextUtil.getSpringBean(TicketRelationService.clreplaced);
        ticketRelationService.saveComponentsOfTicket(taskId, ProjectTypeConstants.TASK, view.getComponents());
        ticketRelationService.saveAffectedVersionsOfTicket(taskId, ProjectTypeConstants.TASK, view.getAffectedVersions());
        List<String> followers = view.getFollowers();
        if (followers.size() > 0) {
            List<MonitorItem> monitorItems = new ArrayList<>();
            for (String follower : followers) {
                MonitorItem monitorItem = new MonitorItem();
                monitorItem.setSaccountid(AppUI.getAccountId());
                monitorItem.setType(ProjectTypeConstants.TASK);
                monitorItem.setTypeid(taskId + "");
                monitorItem.setUsername(follower);
                monitorItem.setExtratypeid(CurrentProjectVariables.getProjectId());
                monitorItems.add(monitorItem);
            }
            MonitorItemService monitorItemService = AppContextUtil.getSpringBean(MonitorItemService.clreplaced);
            monitorItemService.saveMonitorItems(monitorItems);
        }
    } else {
        taskService.updateWithSession(item, UserUIContext.getUsername());
        TicketRelationService ticketRelationService = AppContextUtil.getSpringBean(TicketRelationService.clreplaced);
        ticketRelationService.updateComponentsOfTicket(item.getId(), ProjectTypeConstants.TASK, view.getComponents());
        ticketRelationService.updateAffectedVersionsOfTicket(item.getId(), ProjectTypeConstants.TASK, view.getAffectedVersions());
    }
    AttachmentUploadField uploadField = view.getAttachUploadField();
    String attachPath = AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), item.getProjectid(), ProjectTypeConstants.TASK, "" + item.getId());
    uploadField.saveContentsToRepo(attachPath);
    return item.getId();
}

12 View Complete Implementation : ContactInfoChangeWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void changeUserInfo() {
    txtWorkPhone.removeStyleName("errorField");
    txtHomePhone.removeStyleName("errorField");
    user.setWorkphone(txtWorkPhone.getValue());
    user.setHomephone(txtHomePhone.getValue());
    user.setFacebookaccount(txtFaceBook.getValue());
    user.setTwitteraccount(txtTwitter.getValue());
    user.setSkypecontact(txtSkype.getValue());
    if (validateForm(user)) {
        UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
        userService.updateWithSession(user, UserUIContext.getUsername());
        close();
        UIUtils.reloadPage();
    }
}

11 View Complete Implementation : UserProjectDashboardViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void lazyLoadView() {
    removeAllComponents();
    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
    List<Integer> prjKeys = projectService.getOpenProjectKeysUserInvolved(UserUIContext.getUsername(), AppUI.getAccountId());
    if (CollectionUtils.isNotEmpty(prjKeys)) {
        ResponsiveLayout contentWrapper = new ResponsiveLayout(ResponsiveLayout.ContainerType.FIXED);
        contentWrapper.setSizeFull();
        addComponent(contentWrapper);
        ResponsiveRow row = new ResponsiveRow();
        AllMilestoneTimelineWidget milestoneTimelineWidget = new AllMilestoneTimelineWidget();
        TicketOverdueWidget ticketOverdueWidget = new TicketOverdueWidget();
        ActivityStreamComponent activityStreamComponent = new ActivityStreamComponent();
        UserUnresolvedTicketWidget unresolvedreplacedignmentThisWeekWidget = new UserUnresolvedTicketWidget();
        UserUnresolvedTicketWidget unresolvedreplacedignmentNextWeekWidget = new UserUnresolvedTicketWidget();
        ResponsiveColumn column1 = new ResponsiveColumn(12, 12, 6, 6);
        MVerticalLayout leftPanel = new MVerticalLayout(milestoneTimelineWidget, unresolvedreplacedignmentThisWeekWidget, unresolvedreplacedignmentNextWeekWidget, ticketOverdueWidget).withMargin(new MarginInfo(true, true, false, false)).withFullWidth();
        column1.setComponent(leftPanel);
        ResponsiveColumn column2 = new ResponsiveColumn(12, 12, 6, 6);
        column2.setComponent(activityStreamComponent);
        row.addColumn(column1);
        row.addColumn(column2);
        contentWrapper.addRow(row);
        activityStreamComponent.showFeeds(prjKeys);
        milestoneTimelineWidget.display(prjKeys);
        ticketOverdueWidget.showTicketsByStatus(prjKeys);
        unresolvedreplacedignmentThisWeekWidget.displayUnresolvedreplacedignmentsThisWeek(prjKeys);
        unresolvedreplacedignmentNextWeekWidget.displayUnresolvedreplacedignmentsNextWeek(prjKeys);
    } else {
        this.with(ELabel.h1(VaadinIcons.TASKS.getHtml()).withUndefinedWidth());
        this.with(ELabel.h2(UserUIContext.getMessage(GenericI18Enum.VIEW_NO_ITEM_replacedLE)).withUndefinedWidth());
        if (UserUIContext.canWrite(RolePermissionCollections.CREATE_NEW_PROJECT)) {
            MButton newProjectBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.NEW), clickEvent -> UI.getCurrent().addWindow(ViewManager.getCacheComponent(AbstractProjectAddWindow.clreplaced))).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.PLUS);
            with(newProjectBtn);
        }
        alignAll(Alignment.TOP_CENTER);
    }
}

10 View Complete Implementation : ProjectCustomPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    ProjectView projectView = (ProjectView) container;
    projectView.gotoSubView(ProjectView.CUSTOM_ENTRY, view);
    ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil.getSpringBean(ProjectNotificationSettingService.clreplaced);
    ProjectNotificationSetting notification = projectNotificationSettingService.findNotification(UserUIContext.getUsername(), CurrentProjectVariables.getProjectId(), AppUI.getAccountId());
    ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.clreplaced);
    breadCrumb.gotoProjectSetting();
    view.showNotificationSettings(notification);
}

9 View Complete Implementation : CommentRowDisplayHandler.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)).withFullWidth();
    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);
    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);
    MHorizontalLayout messageHeader = new MHorizontalLayout().withMargin(false).withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime()));
    timePostLbl.setStyleName(WebThemes.META_INFO);
    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_ICON_ONLY).withListener(clickEvent -> ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
            if (confirmDialog.isConfirmed()) {
                CommentService commentService = AppContextUtil.getSpringBean(CommentService.clreplaced);
                commentService.removeWithSession(comment, UserUIContext.getUsername(), AppUI.getAccountId());
                ((BeanList) host).removeRow(layout);
            }
        }));
        messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl);
    } else {
        messageHeader.with(timePostLbl).expand(timePostLbl);
    }
    rowLayout.addComponent(messageHeader);
    Label messageContent = new SafeHtmlLabel(comment.getComment());
    rowLayout.addComponent(messageContent);
    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withFullWidth();
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }
    layout.with(rowLayout).expand(rowLayout);
    return layout;
}

9 View Complete Implementation : ProjectLogoUploadWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void process(BufferedImage image) {
    SimpleProject project = CurrentProjectVariables.getProject();
    EnreplacedyUploaderService enreplacedyUploaderService = AppContextUtil.getSpringBean(EnreplacedyUploaderService.clreplaced);
    String newLogoId = enreplacedyUploaderService.upload(image, PathUtils.getProjectLogoPath(AppUI.getAccountId(), project.getId()), project.getAvatarid(), UserUIContext.getUsername(), AppUI.getAccountId(), new Integer[] { 16, 32, 48, 64, 100 });
    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
    project.setAvatarid(newLogoId);
    projectService.updateSelectiveWithSession(project, UserUIContext.getUsername());
    UIUtils.reloadPage();
}

9 View Complete Implementation : BugAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private int saveBug(SimpleBug bug) {
    BugService bugService = AppContextUtil.getSpringBean(BugService.clreplaced);
    bug.setProjectid(CurrentProjectVariables.getProjectId());
    bug.setSaccountid(AppUI.getAccountId());
    AsyncEventBus asyncEventBus = AppContextUtil.getSpringBean(AsyncEventBus.clreplaced);
    if (bug.getId() == null) {
        bug.setStatus(StatusI18nEnum.Open.name());
        bug.setCreateduser(UserUIContext.getUsername());
        int bugId = bugService.saveWithSession(bug, UserUIContext.getUsername());
        AttachmentUploadField uploadField = view.getAttachUploadField();
        String attachPath = AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), bug.getProjectid(), ProjectTypeConstants.BUG, "" + bugId);
        uploadField.saveContentsToRepo(attachPath);
        // save component
        TicketRelationService ticketRelationService = AppContextUtil.getSpringBean(TicketRelationService.clreplaced);
        ticketRelationService.saveAffectedVersionsOfTicket(bugId, ProjectTypeConstants.BUG, view.getAffectedVersions());
        ticketRelationService.saveFixedVersionsOfTicket(bugId, ProjectTypeConstants.BUG, view.getFixedVersion());
        ticketRelationService.saveComponentsOfTicket(bugId, ProjectTypeConstants.BUG, view.getComponents());
        asyncEventBus.post(new CleanCacheEvent(AppUI.getAccountId(), new Clreplaced[] { BugService.clreplaced }));
        List<String> followers = view.getFollowers();
        if (followers.size() > 0) {
            List<MonitorItem> monitorItems = new ArrayList<>();
            for (String follower : followers) {
                MonitorItem monitorItem = new MonitorItem();
                monitorItem.setSaccountid(AppUI.getAccountId());
                monitorItem.setType(ProjectTypeConstants.BUG);
                monitorItem.setTypeid(bugId + "");
                monitorItem.setUsername(follower);
                monitorItem.setExtratypeid(CurrentProjectVariables.getProjectId());
                monitorItems.add(monitorItem);
            }
            MonitorItemService monitorItemService = AppContextUtil.getSpringBean(MonitorItemService.clreplaced);
            monitorItemService.saveMonitorItems(monitorItems);
        }
    } else {
        bugService.updateWithSession(bug, UserUIContext.getUsername());
        AttachmentUploadField uploadField = view.getAttachUploadField();
        String attachPath = AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), bug.getProjectid(), ProjectTypeConstants.BUG, "" + bug.getId());
        uploadField.saveContentsToRepo(attachPath);
        int bugId = bug.getId();
        TicketRelationService ticketRelationService = AppContextUtil.getSpringBean(TicketRelationService.clreplaced);
        ticketRelationService.updateAffectedVersionsOfTicket(bugId, ProjectTypeConstants.BUG, view.getAffectedVersions());
        ticketRelationService.updateFixedVersionsOfTicket(bugId, ProjectTypeConstants.BUG, view.getFixedVersion());
        ticketRelationService.updateComponentsOfTicket(bugId, ProjectTypeConstants.BUG, view.getComponents());
        asyncEventBus.post(new CleanCacheEvent(AppUI.getAccountId(), new Clreplaced[] { BugService.clreplaced }));
    }
    return bug.getId();
}

9 View Complete Implementation : MilestoneAddPresenter.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private int saveMilestone(Milestone milestone) {
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.clreplaced);
    milestone.setProjectid(CurrentProjectVariables.getProjectId());
    milestone.setSaccountid(AppUI.getAccountId());
    if (milestone.getId() == null) {
        milestone.setCreateduser(UserUIContext.getUsername());
        milestoneService.saveWithSession(milestone, UserUIContext.getUsername());
    } else {
        milestoneService.updateWithSession(milestone, UserUIContext.getUsername());
    }
    AttachmentUploadField uploadField = view.getAttachUploadField();
    String attachPath = AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), milestone.getProjectid(), ProjectTypeConstants.MILESTONE, "" + milestone.getId());
    uploadField.saveContentsToRepo(attachPath);
    if (!SiteConfiguration.isCommunityEdition() && MilestoneStatus.Closed.name().equals(milestone.getStatus())) {
        ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria();
        searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
        searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.RISK, ProjectTypeConstants.TASK));
        searchCriteria.setMilestoneId(NumberSearchField.equal(milestone.getId()));
        searchCriteria.setOpen(new SearchField());
        ProjectTicketService genericTaskService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
        int openreplacedignmentsCount = genericTaskService.getTotalCount(searchCriteria);
        if (openreplacedignmentsCount > 0) {
            ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, AppUI.getSiteName()), UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_replacedIGNMENTS), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
                if (confirmDialog.isConfirmed()) {
                    genericTaskService.closeSubreplacedignmentOfMilestone(milestone.getId());
                }
            });
        }
    }
    return milestone.getId();
}

7 View Complete Implementation : PageEditFormFieldFactory.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected HasValue<?> onCreateField(Object propertyId) {
    Page page = attachForm.getBean();
    if (propertyId.equals("content")) {
        CKEditorConfig config = new CKEditorConfig();
        config.useCompactTags();
        config.setResizeDir(CKEditorConfig.RESIZE_DIR.HORIZONTAL);
        config.disableSpellChecker();
        config.disableResizeEditor();
        config.disableElementsPath();
        config.setToolbarCanCollapse(true);
        config.setWidth("100%");
        String appUrl = AppUI.getSiteUrl();
        String params = String.format("path=%s&createdUser=%s&sAccountId=%d", page.getPath(), UserUIContext.getUsername(), AppUI.getAccountId());
        if (appUrl.endsWith("/")) {
            config.setFilebrowserUploadUrl(String.format("%spage/upload?%s", appUrl, params));
        } else {
            config.setFilebrowserUploadUrl(String.format("%s/page/upload?%s", appUrl, params));
        }
        CKEditorTextField ckEditorTextField = new CKEditorTextField(config);
        ckEditorTextField.setHeight("450px");
        ckEditorTextField.setRequiredIndicatorVisible(true);
        return ckEditorTextField;
    } else if (propertyId.equals("status")) {
        page.setStatus(WikiI18nEnum.status_public.name());
        return new I18nValueComboBox<>(WikiI18nEnum.clreplaced, WikiI18nEnum.status_public, WikiI18nEnum.status_private, WikiI18nEnum.status_archieved).withWidth(WebThemes.FORM_CONTROL_WIDTH);
    } else if (propertyId.equals("subject")) {
        return new MTextField().withRequiredIndicatorVisible(true);
    }
    return null;
}

4 View Complete Implementation : BasicInfoChangeWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void changeUserInfo() {
    txtLastName.removeStyleName("errorField");
    txtEmail.removeStyleName("errorField");
    if (txtLastName.getValue().equals("")) {
        NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(GenericI18Enum.FORM_LASTNAME)));
        txtLastName.addStyleName("errorField");
        return;
    }
    if (txtEmail.getValue().equals("")) {
        NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL)));
        txtLastName.addStyleName("errorField");
        return;
    }
    user.setFirstname(txtFirstName.getValue());
    user.setLastname(txtLastName.getValue());
    user.setEmail(txtEmail.getValue());
    user.setBirthday(birthdayField.getValue());
    user.setLanguage(languageBox.getValue());
    user.setTimezone(timeZoneField.getValue());
    UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
    userService.updateWithSession(user, UserUIContext.getUsername());
    close();
    UIUtils.reloadPage();
}

1 View Complete Implementation : ProjectActivityComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Component buildCommentBlock(final SimpleComment comment) {
    MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withFullWidth();
    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);
    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);
    MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())).withStyleName(WebThemes.META_INFO);
    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton(VaadinIcons.TRASH).withListener(clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
                if (confirmDialog.isConfirmed()) {
                    CommentService commentService = AppContextUtil.getSpringBean(CommentService.clreplaced);
                    commentService.removeWithSession(comment, UserUIContext.getUsername(), AppUI.getAccountId());
                    activityBox.removeComponent(layout);
                }
            });
        }).withStyleName(WebThemes.BUTTON_ICON_ONLY);
        messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl);
    } else {
        messageHeader.with(timePostLbl).expand(timePostLbl);
    }
    rowLayout.addComponent(messageHeader);
    Label messageContent = new SafeHtmlLabel(comment.getComment());
    rowLayout.addComponent(messageContent);
    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withMargin(false).withSpacing(false).withFullWidth();
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay);
        rowLayout.addComponent(messageFooter);
    }
    layout.with(rowLayout).expand(rowLayout);
    return layout;
}

0 View Complete Implementation : UserWorkloadReportViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void displayProjectTickets(SimpleProject project) {
    selectedProject = project;
    if (selectedProject != null) {
        projectTicketsContentLayout.removeAllComponents();
        projectTicketsContentLayout.addComponent(buildProjectLink(project));
        if (UserUIContext.isAdmin()) {
            baseCriteria.setProjectIds(new SetSearchField<>(project.getId()));
            baseCriteria.setOrderFields(Arrays.asList(new OrderField("replacedignUser", SearchCriteria.ASC)));
        } else {
            PermissionMap permissionMap = projectRoleService.findProjectsPermission(UserUIContext.getUsername(), project.getId(), AppUI.getAccountId());
            List<String> ticketTypes = new ArrayList<>();
            if (permissionMap.canWrite(ProjectRolePermissionCollections.TASKS)) {
                ticketTypes.add(ProjectTypeConstants.TASK);
            }
            if (permissionMap.canWrite(ProjectRolePermissionCollections.BUGS)) {
                ticketTypes.add(ProjectTypeConstants.BUG);
            }
            if (permissionMap.canWrite(ProjectRolePermissionCollections.RISKS)) {
                ticketTypes.add(ProjectTypeConstants.RISK);
            }
            baseCriteria.setProjectIds(new SetSearchField<>(project.getId()));
            if (!ticketTypes.isEmpty()) {
                baseCriteria.setTypes(new SetSearchField<>(ticketTypes));
            }
        }
        if (UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("dueDate", sortDirection)));
            ticketGroupOrderComponent = new DueDateOrderComponent(ReadableTicketRowRenderer.clreplaced);
        } else if (UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("startdate", sortDirection)));
            ticketGroupOrderComponent = new StartDateOrderComponent(ReadableTicketRowRenderer.clreplaced);
        } else if (UserUIContext.getMessage(GenericI18Enum.OPT_PLAIN).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("lastupdatedtime", sortDirection)));
            ticketGroupOrderComponent = new SimpleListOrderComponent(ReadableTicketRowRenderer.clreplaced);
        } else if (UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("createdtime", sortDirection)));
            ticketGroupOrderComponent = new CreatedDateOrderComponent(ReadableTicketRowRenderer.clreplaced);
        } else if (UserUIContext.getMessage(GenericI18Enum.OPT_USER).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("replacedignUser", sortDirection)));
            ticketGroupOrderComponent = new UserOrderComponent(ReadableTicketRowRenderer.clreplaced);
        } else if (UserUIContext.getMessage(MilestoneI18nEnum.SINGLE).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("milestoneId", sortDirection)));
            ticketGroupOrderComponent = new MilestoneOrderGroup(ReadableTicketRowRenderer.clreplaced);
        } else {
            throw new MyCollabException("Do not support group view by " + groupByState);
        }
        projectTicketsContentLayout.addComponent(ticketGroupOrderComponent);
        ProjectTicketService projectTicketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
        int totalTasks = projectTicketService.getTotalTicketsCount(baseCriteria);
        currentPage = 0;
        int pages = totalTasks / 100;
        if (currentPage < pages) {
            MButton moreBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_MORE), clickEvent -> {
                int newTotalTickets = projectTicketService.getTotalTicketsCount(baseCriteria);
                int newNumPages = newTotalTickets / 100;
                currentPage++;
                List<ProjectTicket> otherTickets = (List<ProjectTicket>) projectTicketService.findTicketsByCriteria(new BasicSearchRequest<>(baseCriteria, currentPage + 1, 100));
                ticketGroupOrderComponent.insertTickets(otherTickets);
                if (currentPage >= newNumPages) {
                    wrapBody.removeComponent(wrapBody.getComponent(1));
                }
            }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ANGLE_DOUBLE_DOWN);
            wrapBody.addComponent(moreBtn);
        }
        List<ProjectTicket> tickets = (List<ProjectTicket>) projectTicketService.findTicketsByCriteria(new BasicSearchRequest<>(baseCriteria, currentPage + 1, 100));
        ticketGroupOrderComponent.insertTickets(tickets);
    }
}

0 View Complete Implementation : ProjectActivityStreamPagedList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void doSearch() {
    totalCount = projectActivityStreamService.getTotalActivityStream(((BasicSearchRequest<ActivityStreamSearchCriteria>) searchRequest).getSearchCriteria());
    totalPage = (totalCount - 1) / searchRequest.getNumberOfItems() + 1;
    if (searchRequest.getCurrentPage() > totalPage) {
        searchRequest.setCurrentPage(totalPage);
    }
    if (totalPage > 1) {
        if (controlBarWrapper != null) {
            removeComponent(controlBarWrapper);
        }
        this.addComponent(createPageControls());
    } else {
        if (getComponentCount() == 2) {
            removeComponent(getComponent(1));
        }
    }
    List<ProjectActivityStream> projectActivities = projectActivityStreamService.getProjectActivityStreams((BasicSearchRequest<ActivityStreamSearchCriteria>) searchRequest);
    this.removeAllComponents();
    LocalDate currentDate = LocalDate.of(2100, 1, 1);
    CssLayout currentFeedBlock = new CssLayout();
    AuditLogRegistry auditLogRegistry = AppContextUtil.getSpringBean(AuditLogRegistry.clreplaced);
    try {
        for (ProjectActivityStream activity : projectActivities) {
            if (ProjectTypeConstants.PAGE.equals(activity.getType())) {
                ProjectPageService pageService = AppContextUtil.getSpringBean(ProjectPageService.clreplaced);
                Page page = pageService.getPage(activity.getTypeid(), UserUIContext.getUsername());
                if (page != null) {
                    activity.setNamefield(page.getSubject());
                }
            }
            LocalDate itemCreatedDate = activity.getCreatedtime().toLocalDate();
            if (!currentDate.isEqual(itemCreatedDate)) {
                currentFeedBlock = new CssLayout();
                currentFeedBlock.setStyleName("feed-block");
                feedBlocksPut(currentDate, itemCreatedDate, currentFeedBlock);
                currentDate = itemCreatedDate;
            }
            StringBuilder content = new StringBuilder();
            String itemType = ProjectLocalizationTypeMap.getType(activity.getType());
            String replacedigneeParam = buildreplacedigneeValue(activity);
            String itemParam = buildItemValue(activity);
            if (ActivityStreamConstants.ACTION_CREATE.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_CREATE_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
            } else if (ActivityStreamConstants.ACTION_UPDATE.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_UPDATE_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
                if (activity.getreplacedoAuditLog() != null) {
                    content.append(auditLogRegistry.generatorDetailChangeOfActivity(activity));
                }
            } else if (ActivityStreamConstants.ACTION_COMMENT.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_COMMENT_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
                if (activity.getreplacedoAuditLog() != null) {
                    content.append("<ul><li>\"").append(StringUtils.trimHtmlTags(activity.getreplacedoAuditLog().getChangeset(), 200)).append("\"</li></ul>");
                }
            } else if (ActivityStreamConstants.ACTION_DELETE.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_DELETE_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
            }
            ELabel actionLbl = ELabel.html(content.toString()).withFullWidth();
            MCssLayout streamWrapper = new MCssLayout(actionLbl).withFullWidth().withStyleName("stream-wrapper");
            currentFeedBlock.addComponent(streamWrapper);
        }
    } catch (Exception e) {
        throw new MyCollabException(e);
    }
}