com.vaadin.ui.HasComponents Java Examples

The following examples show how to use com.vaadin.ui.HasComponents. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.TICKET_ENTRY, view);
        SimpleTask task = (SimpleTask) data.getParams();

        ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (task.getId() == null) {
            breadCrumb.gotoTaskAdd();
            task.setSaccountid(AppUI.getAccountId());
        } else {
            breadCrumb.gotoTaskEdit(task);
        }
        view.editItem(task);
    } else {
        throw new SecureAccessException();
    }
}
 
Example #2
Source File: UserListPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    AccountModule accountModule = (AccountModule) container;
    accountModule.gotoSubView(SettingUIConstants.USERS, view);

    UserSearchCriteria criteria;
    if (data == null) {
        criteria = new UserSearchCriteria();
        criteria.setSaccountid(new NumberSearchField(AppUI.getAccountId()));
        criteria.setRegisterStatuses(new SetSearchField<>(RegisterStatusConstants.ACTIVE,
                RegisterStatusConstants.NOT_LOG_IN_YET));
    } else {
        criteria = (UserSearchCriteria) data.getParams();
    }

    view.setSearchCriteria(criteria);

    AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
    breadcrumb.gotoUserList();
}
 
Example #3
Source File: RoleReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.ACCOUNT_ROLE)) {
        RoleService roleService = AppContextUtil.getSpringBean(RoleService.class);
        SimpleRole role = roleService.findById((Integer) data.getParams(), AppUI.getAccountId());
        if (role != null) {
            AccountModule accountModule = (AccountModule) container;
            accountModule.gotoSubView(SettingUIConstants.ROLES, view);
            view.previewItem(role);

            AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
            breadcrumb.gotoRoleRead(role);
        } else {
            NotificationUtil.showRecordNotExistNotification();
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #4
Source File: ProjectAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    ProjectDashboardContainer projectViewContainer = (ProjectDashboardContainer) container;
    projectViewContainer.setContent(view);

    Project project = (Project) data.getParams();

    if (project.getId() == null) {
        project.setSaccountid(AppUI.getAccountId());
        AppUI.addFragment("project/add", UserUIContext.getMessage(GenericI18Enum.BROWSER_ADD_ITEM_TITLE,
                UserUIContext.getMessage(ProjectI18nEnum.SINGLE)));
    } else {
        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        breadcrumb.gotoProjectEdit();
    }
    view.editItem(project);
}
 
Example #5
Source File: RoleAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_ROLE)) {
        AccountModule accountModule = (AccountModule) container;
        accountModule.gotoSubView(SettingUIConstants.ROLES, view);

        Role role = (Role) data.getParams();
        AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);

        if (role.getId() == null) {
            role.setSaccountid(AppUI.getAccountId());
            breadcrumb.gotoRoleAdd();
        } else {
            breadcrumb.gotoRoleEdit(role);
        }
        view.editItem(role);
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #6
Source File: UserReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.ACCOUNT_USER)) {
        String username = (String) data.getParams();

        UserService userService = AppContextUtil.getSpringBean(UserService.class);
        SimpleUser user = userService.findUserByUserNameInAccount(username, AppUI.getAccountId());
        if (user != null) {
            AccountModule accountModule = (AccountModule) container;
            accountModule.gotoSubView(SettingUIConstants.USERS, view);
            view.previewItem(user);

            AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
            breadcrumb.gotoUserRead(user);
        } else {
            NotificationUtil.showErrorNotification(UserUIContext.getMessage(UserI18nEnum.ERROR_NO_USER_IN_ACCOUNT, username));
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #7
Source File: MainViewPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    // if user type remember URL, instead of going to main page, to to his url
    String url = ((DesktopApplication) UI.getCurrent()).getCurrentFragmentUrl();
    view.display();
    if (!UserUIContext.getInstance().getIsValidAccount()) {
        EventBusFactory.getInstance().post(new ShellEvent.GotoUserAccountModule(this, new String[]{"billing"}));
    } else {
        if (!StringUtils.isBlank(url)) {
            if (url.startsWith("/")) {
                url = url.substring(1);
            }
            ShellUrlResolver.ROOT.resolveFragment(url);
        } else {
            SimpleUser pref = UserUIContext.getUser();
            if (ModuleNameConstants.ACCOUNT.equals(pref.getLastModuleVisit())) {
                EventBusFactory.getInstance().post(new ShellEvent.GotoUserAccountModule(this, null));
            } else {
                EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
            }
        }
    }
}
 
Example #8
Source File: MilestoneReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.MILESTONES)) {
        ProjectView projectView = (ProjectView) container;

        if (data.getParams() instanceof Integer) {
            MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
            SimpleMilestone milestone = milestoneService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (milestone != null) {
                projectView.gotoSubView(ProjectView.MILESTONE_ENTRY, view);
                view.previewItem(milestone);

                ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadcrumb.gotoMilestoneRead(milestone);
            } else {
                throw new ResourceNotFoundException();
            }
        } else {
            throw new MyCollabException("Unhandle this case yet");
        }
    } else {
        throw new SecureAccessException();
    }
}
 
Example #9
Source File: MilestoneAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.MILESTONE_ENTRY, view);

        SimpleMilestone milestone = (SimpleMilestone) data.getParams();

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (milestone.getId() == null) {
            milestone.setSaccountid(AppUI.getAccountId());
            breadcrumb.gotoMilestoneAdd();
        } else {
            breadcrumb.gotoMilestoneEdit(milestone);
        }
        view.editItem(milestone);
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #10
Source File: MessageReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.MESSAGES)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.MESSAGE_ENTRY, view);

        if (data.getParams() instanceof Integer) {
            MessageService messageService = AppContextUtil.getSpringBean(MessageService.class);
            SimpleMessage message = messageService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (message != null) {
                view.previewItem(message);

                ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadCrumb.gotoMessage(message);
            }
        } else {
            throw new MyCollabException("Unhanddle this case yet");
        }
    } else {
        throw new SecureAccessException();
    }
}
 
Example #11
Source File: ReportPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    BoardContainer boardContainer = (BoardContainer) container;
    boardContainer.gotoSubView("Reports", view);

    if (data instanceof StandupScreenData.Search) {
        StandupListPresenter presenter = PresenterResolver.getPresenter(StandupListPresenter.class);
        presenter.go(view, data);
    } else if (data instanceof ReportScreenData.GotoUserWorkload) {
        UserWorkloadReportPresenter userWorkloadReportPresenter = PresenterResolver.getPresenter(UserWorkloadReportPresenter.class);
        userWorkloadReportPresenter.go(view, data);
    } else {
        view.showDashboard();
        ReportBreadcrumb breadcrumb = ViewManager.getCacheComponent(ReportBreadcrumb.class);
        breadcrumb.gotoReportDashboard();
    }
}
 
Example #12
Source File: BugAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.TICKET_ENTRY, view);

        SimpleBug bug = (SimpleBug) data.getParams();

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (bug.getId() == null) {
            breadcrumb.gotoBugAdd();
            bug.setSaccountid(AppUI.getAccountId());
        } else {
            breadcrumb.gotoBugEdit(bug);
        }
        view.editItem(bug);
    } else {
        throw new SecureAccessException();
    }
}
 
Example #13
Source File: BugReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.BUGS)) {
        SimpleBug bug = null;
        if (data.getParams() instanceof Integer) {
            BugService bugService = AppContextUtil.getSpringBean(BugService.class);
            bug = bugService.findById((Integer) data.getParams(), AppUI.getAccountId());
        } else if (data.getParams() instanceof SimpleBug) {
            bug = (SimpleBug) data.getParams();
        }
        if (bug != null) {
            ProjectView projectView = (ProjectView) container;
            projectView.gotoSubView(ProjectView.TICKET_ENTRY, view);
            view.previewItem(bug);

            ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
            breadcrumb.gotoBugRead(bug);
        } else {
            throw new ResourceNotFoundException();
        }
    } else {
        throw new SecureAccessException();
    }
}
 
Example #14
Source File: ComponentAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.COMPONENT_ENTRY, view);

        Component component = (Component) data.getParams();
        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);

        if (component.getId() == null) {
            component.setSaccountid(AppUI.getAccountId());
            component.setProjectid(CurrentProjectVariables.getProject().getId());
            component.setStatus(StatusI18nEnum.Open.name());
            breadcrumb.gotoComponentAdd();
        } else {
            breadcrumb.gotoComponentEdit(component);
        }
        view.editItem(component);
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #15
Source File: VersionReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.VERSIONS)) {
        if (data.getParams() instanceof Integer) {
            VersionService componentService = AppContextUtil.getSpringBean(VersionService.class);
            Version version = componentService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (version != null) {
                ProjectView projectView = (ProjectView) container;
                projectView.gotoSubView(ProjectView.VERSION_ENTRY, view);
                view.previewItem(version);

                ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadcrumb.gotoVersionRead(version);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        } else {
            throw new MyCollabException("Unhanddle this case yet");
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #16
Source File: ComponentListPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.COMPONENTS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.COMPONENT_ENTRY, view);

        searchCriteria = (ComponentSearchCriteria) data.getParams();
        int totalCount = componentService.getTotalCount(searchCriteria);

        if (totalCount > 0) {
            doSearch(searchCriteria);
        } else {
            view.showNoItemView();
        }

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        breadcrumb.gotoComponentList();
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #17
Source File: ProjectMemberListPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.USERS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.USERS_ENTRY, view);

        ProjectMemberSearchCriteria criteria;
        if (data.getParams() == null) {
            criteria = new ProjectMemberSearchCriteria();
            criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
            criteria.setStatuses(new SetSearchField<>(ProjectMemberStatusConstants.ACTIVE, ProjectMemberStatusConstants.NOT_ACCESS_YET));
            criteria.setSaccountid(new NumberSearchField(AppUI.getAccountId()));
        } else {
            criteria = (ProjectMemberSearchCriteria) data.getParams();
        }
        view.setSearchCriteria(criteria);

        ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        breadCrumb.gotoUserList();
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #18
Source File: ComponentReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.COMPONENTS)) {
        if (data.getParams() instanceof Integer) {
            ComponentService componentService = AppContextUtil.getSpringBean(ComponentService.class);
            SimpleComponent component = componentService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (component != null) {
                ProjectView projectView = (ProjectView) container;
                projectView.gotoSubView(ProjectView.COMPONENT_ENTRY, view);
                view.previewItem(component);

                ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadcrumb.gotoComponentRead(component);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        } else {
            throw new MyCollabException("Unhandle this case yet");
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #19
Source File: PageListPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@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.class);
        breadcrumb.gotoPageList();
    } else {
        throw new SecureAccessException();
    }
}
 
Example #20
Source File: VersionAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.VERSION_ENTRY, view);
        Version version = (Version) data.getParams();

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (version.getId() == null) {
            version.setSaccountid(AppUI.getAccountId());
            version.setProjectid(CurrentProjectVariables.getProjectId());
            version.setStatus(StatusI18nEnum.Open.name());
            breadcrumb.gotoVersionAdd();
        } else {
            breadcrumb.gotoVersionEdit(version);
        }
        view.editItem(version);
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #21
Source File: PageAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.PAGE_ENTRY, view);

        Page page = (Page) data.getParams();
        view.editItem(page);

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (page.getPath().equals("")) {
            breadcrumb.gotoPageAdd();
        } else {
            breadcrumb.gotoPageEdit(page);
        }
    } else {
        throw new SecureAccessException();
    }
}
 
Example #22
Source File: VersionListPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.VERSIONS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.VERSION_ENTRY, view);

        searchCriteria = (VersionSearchCriteria) data.getParams();
        int totalCount = versionService.getTotalCount(searchCriteria);

        if (totalCount > 0) {
            doSearch(searchCriteria);
        } else {
            view.showNoItemView();
        }

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        breadcrumb.gotoVersionList();
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #23
Source File: ProjectRoleAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.ROLES)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.ROLE_ENTRY, view);

        ProjectRole role = (ProjectRole) data.getParams();
        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (role.getId() == null) {
            role.setSaccountid(AppUI.getAccountId());
            role.setProjectid(CurrentProjectVariables.getProject().getId());
            breadcrumb.gotoRoleAdd();
        } else {
            breadcrumb.gotoRoleEdit(role);
        }
        view.editItem(role);
    } else {
        throw new SecureAccessException();
    }
}
 
Example #24
Source File: ProjectRoleReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    ProjectView projectView = (ProjectView) container;

    if (data.getParams() instanceof Integer) {
        SimpleProjectRole role = projectRoleService.findById((Integer) data.getParams(), AppUI.getAccountId());
        if (role == null) {
            NotificationUtil.showRecordNotExistNotification();
        } else {
            projectView.gotoSubView(ProjectView.ROLE_ENTRY, view);
            view.previewItem(role);
            ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
            breadCrumb.gotoRoleRead(role);
        }
    } else {
        throw new MyCollabException("Do not support screen data: " + data);
    }
}
 
Example #25
Source File: ProjectMemberEditPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.SETTING, view);

        SimpleProjectMember member = (SimpleProjectMember) data.getParams();
        view.editItem(member);

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (member.getId() == null) {
            breadcrumb.gotoUserAdd();
        } else {
            breadcrumb.gotoUserEdit(member);
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }

}
 
Example #26
Source File: TaskReadPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) {
        ProjectView projectView = (ProjectView) container;
        projectView.gotoSubView(ProjectView.TICKET_ENTRY, view);

        SimpleTask task = null;
        if (data.getParams() instanceof Integer) {
            TaskService taskService = AppContextUtil.getSpringBean(TaskService.class);
            task = taskService.findById((Integer) data.getParams(), AppUI.getAccountId());
        } else if (data.getParams() instanceof SimpleTask) {
            task = (SimpleTask) data.getParams();
        }

        if (task != null) {
            view.previewItem(task);
            ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
            breadCrumb.gotoTaskRead(task);
        } else {
            NotificationUtil.showRecordNotExistNotification();
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
 
Example #27
Source File: BoardContainerPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    ProjectModule module = (ProjectModule) container;
    module.setContent(view);

    IPresenter<?> presenter;
    if (data instanceof ProjectScreenData.GotoList) {
        presenter = PresenterResolver.getPresenter(ProjectListPresenter.class);

    } else if (data instanceof ReportScreenData.GotoConsole || data instanceof ReportScreenData.GotoWeeklyTiming
            || data instanceof ReportScreenData.GotoUserWorkload || data instanceof ReportScreenData.GotoTimesheet
            || data instanceof StandupScreenData.Search) {
        presenter = PresenterResolver.getPresenter(IReportPresenter.class);
    } else if (data instanceof ClientScreenData.Add || data instanceof ClientScreenData.Edit || data instanceof ClientScreenData.Read || data instanceof ClientScreenData.Search) {
        presenter = PresenterResolver.getPresenter(IClientPresenter.class);
    } else if (data instanceof ProjectModuleScreenData.SearchItem) {
        presenter = PresenterResolver.getPresenter(ProjectSearchItemPresenter.class);
    } else {
        presenter = PresenterResolver.getPresenter(UserProjectDashboardPresenter.class);
    }
    presenter.go(view, data);
}
 
Example #28
Source File: ProjectViewPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void onGo(HasComponents container, ScreenData<?> data) {
    ProjectModule prjContainer = (ProjectModule) container;
    prjContainer.setContent(view);
    if (data.getParams() instanceof Integer) {
        ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
        SimpleProject project = projectService.findById((Integer) data.getParams(), AppUI.getAccountId());

        if (project == null) {
            throw new ResourceNotFoundException();
        } else {
            ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class);
            boolean userBelongToProject = projectMemberService.isUserBelongToProject(UserUIContext.getUsername(), project.getId(),
                    AppUI.getAccountId());
            if (userBelongToProject || UserUIContext.isAdmin()) {
                CurrentProjectVariables.setProject(project);
                view.initView(project);
            } else {
                throw new UserNotBelongProjectException();
            }
        }
    }
}
 
Example #29
Source File: UserAddPresenter.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    AccountModule accountModule = (AccountModule) container;
    accountModule.gotoSubView(SettingUIConstants.USERS, view);

    SimpleUser user = (SimpleUser) data.getParams();

    AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);

    if (user.getUsername() == null) {
        user.setAccountId(AppUI.getAccountId());
        view.editItem(user, false);
        breadcrumb.gotoUserAdd();
    } else {
        breadcrumb.gotoUserEdit(user);
        view.editItem(user);
    }
}
 
Example #30
Source File: ForgotPasswordPresenter.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    MainWindowContainer windowContainer = (MainWindowContainer) container;
    windowContainer.setContent(view);

    ExtMailService extMailService = AppContextUtil.getSpringBean(ExtMailService.class);
    if (!extMailService.isMailSetupValid()) {
        NotificationUtil.showErrorNotification(UserUIContext.getMessage(ShellI18nEnum.WINDOW_SMTP_CONFIRM_SETUP_FOR_USER));
    }

    AppUI.addFragment("user/forgotpassword", UserUIContext.getMessage(ShellI18nEnum.OPT_FORGOT_PASSWORD_VIEW_TITLE));
}