Java 类com.vaadin.ui.HasComponents 实例源码

项目:limbr    文件:ComponentFinder.java   
@SuppressWarnings("unchecked")
public static <T extends Component> T find(HasComponents parent, Class<T> clazz, ComponentMatcher matcher) {
    for (Component component : parent) {
        if (component instanceof HasComponents) {
            T found = find((HasComponents)component, clazz, matcher);
            if (found != null) {
                return found;
            }
        } else {
            if (clazz.isInstance(component) && matcher.matches(component)) {
                return (T)component;
            }
        }
    }

    return null;
}
项目:VaadHL    文件:VaadHLi18n.java   
@SuppressWarnings("unchecked")
public void changeAll(HasComponents root) {
    for (Component child : root) {
        if (child instanceof HasComponents) {
            changeAll((HasComponents) child);
        } else {
            String s;
            s = valueI18(child, "caption");
            if (s != null)
                child.setCaption(s);

            if (child instanceof Property) {
                s = valueI18(child, "value");
                if (s != null)
                    ((Property<String>) child).setValue(s);
            }

        }
    }
}
项目:mycollab    文件:TicketPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    IPresenter<?> presenter;

    if (data == null || data instanceof TicketScreenData.GotoDashboard) {
        presenter = PresenterResolver.getPresenter(TicketListPresenter.class);
    } else if (data instanceof TaskScreenData.Read) {
        presenter = PresenterResolver.getPresenter(TaskReadPresenter.class);
    } else if (data instanceof TaskScreenData.Add || data instanceof TaskScreenData.Edit) {
        presenter = PresenterOptionUtil.getPresenter(ITaskAddPresenter.class);
    } else if (data instanceof BugScreenData.Read) {
        presenter = PresenterResolver.getPresenter(BugReadPresenter.class);
    } else if (data instanceof BugScreenData.Add || data instanceof BugScreenData.Edit) {
        presenter = PresenterOptionUtil.getPresenter(IBugAddPresenter.class);
    } else if (data instanceof RiskScreenData.Read || data instanceof RiskScreenData.Add || data instanceof
            RiskScreenData.Edit) {
        presenter = PresenterResolver.getPresenter(IRiskPresenter.class);
    } else {
        throw new MyCollabException("Do not support param: " + data);
    }

    presenter.go(container, data);
}
项目:mycollab    文件:ActivityRootPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    super.onGo(container, data);
    AbstractPresenter presenter;

    if (ClassUtils.instanceOf(data, AssignmentScreenData.Read.class, AssignmentScreenData.Add.class,
            AssignmentScreenData.Edit.class, MeetingScreenData.Add.class,
            MeetingScreenData.Edit.class, MeetingScreenData.Read.class,
            CallScreenData.Read.class, CallScreenData.Add.class, CallScreenData.Edit.class,
            ActivityScreenData.GotoActivityList.class)) {
        presenter = PresenterResolver.getPresenter(ActivityPresenter.class);
    } else {
        presenter = PresenterResolver.getPresenter(ActivityCalendarPresenter.class);
    }

    presenter.go(view, data);
}
项目:mycollab    文件:MilestoneReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.MILESTONES)) {
        if (data.getParams() instanceof Integer) {
            MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
            SimpleMilestone milestone = milestoneService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (milestone != null) {
                getView().previewItem(milestone);
                super.onGo(container, data);

                AppUI.addFragment(String.format("project/milestone/preview/%s", GenericLinkUtils.encodeParam(CurrentProjectVariables.getProjectId(), milestone.getId())),
                        milestone.getName());

                AppEventBus.getInstance().post(new UpdateNotificationItemReadStatusEvent(UserUIContext.getUsername(),
                        ModuleNameConstants.PRJ, ProjectTypeConstants.MILESTONE, milestone.getId().toString()));
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        } else {
            throw new MyCollabException("Unhanddle this case yet");
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:MilestonePresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    IPresenter<?> presenter;

    if (data instanceof MilestoneScreenData.Search) {
        presenter = PresenterResolver.getPresenter(MilestoneListPresenter.class);
    } else if (data instanceof MilestoneScreenData.Add || data instanceof MilestoneScreenData.Edit) {
        presenter = PresenterOptionUtil.getPresenter(IMilestoneAddPresenter.class);
    } else if (data instanceof MilestoneScreenData.Read) {
        presenter = PresenterResolver.getPresenter(MilestoneReadPresenter.class);
    } else {
        throw new MyCollabException("Do not support screen data " + data);
    }

    presenter.go(container, data);
}
项目:mycollab    文件:BugReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.BUGS)) {
        if (data.getParams() instanceof Integer) {
            BugService bugService = AppContextUtil.getSpringBean(BugService.class);
            SimpleBug bug = bugService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (bug != null) {
                getView().previewItem(bug);
                super.onGo(container, data);

                AppEventBus.getInstance().post(new UpdateNotificationItemReadStatusEvent(UserUIContext.getUsername(),
                        ModuleNameConstants.PRJ, ProjectTypeConstants.BUG, bug.getId().toString()));
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:UserListPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    UserContainer userContainer = (UserContainer) container;
    userContainer.removeAllComponents();
    userContainer.addComponent(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();
}
项目:mycollab    文件:TaskReadPresenter.java   
@Override
protected void onGo(final HasComponents container, final ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) {
        if (data.getParams() instanceof Integer) {
            ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
            SimpleTask task = taskService.findById((Integer) data.getParams(), AppUI.getAccountId());

            if (task != null) {
                getView().previewItem(task);
                super.onGo(container, data);

                AppEventBus.getInstance().post(new UpdateNotificationItemReadStatusEvent(UserUIContext.getUsername(),
                        ModuleNameConstants.PRJ, ProjectTypeConstants.TASK, task.getId().toString()));
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:OpportunityReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_OPPORTUNITY)) {

        if (data.getParams() instanceof Integer) {
            OpportunityService opportunityService = AppContextUtil.getSpringBean(OpportunityService.class);
            SimpleOpportunity opportunity = opportunityService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (opportunity != null) {
                getView().previewItem(opportunity);
                super.onGo(container, data);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:AccountReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_ACCOUNT)) {
        if (data.getParams() instanceof Integer) {
            AccountService accountService = AppContextUtil.getSpringBean(AccountService.class);
            SimpleAccount account = accountService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (account != null) {
                getView().previewItem(account);
                super.onGo(container, data);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:CampaignReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_CAMPAIGN)) {
        if (data.getParams() instanceof Integer) {
            CampaignService campaignService = AppContextUtil.getSpringBean(CampaignService.class);
            SimpleCampaign campaign = campaignService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (campaign != null) {
                getView().previewItem(campaign);
                super.onGo(container, data);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:CallReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_CALL)) {
        SimpleCall call;
        if (data.getParams() instanceof Integer) {
            CallService callService = AppContextUtil.getSpringBean(CallService.class);
            call = callService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (call == null) {
                NotificationUtil.showRecordNotExistNotification();
                return;
            }
        } else {
            throw new MyCollabException("Invalid data: " + data);
        }
        getView().previewItem(call);
        super.onGo(container, data);

        AppUI.addFragment(CrmLinkGenerator.generateCallPreviewLink(call.getId()), UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                UserUIContext.getMessage(CallI18nEnum.SINGLE), call.getSubject()));
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:MeetingReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_MEETING)) {

        SimpleMeeting meeting;
        if (data.getParams() instanceof Integer) {
            MeetingService meetingService = AppContextUtil.getSpringBean(MeetingService.class);
            meeting = meetingService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (meeting == null) {
                NotificationUtil.showRecordNotExistNotification();
                return;
            }
        } else {
            throw new MyCollabException("Invalid data: " + data);
        }
        getView().previewItem(meeting);
        super.onGo(container, data);

        AppUI.addFragment(CrmLinkGenerator.generateMeetingPreviewLink(meeting.getId()), UserUIContext
                .getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                        "Meeting", meeting.getSubject()));
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:AssignmentReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_TASK)) {

        SimpleCrmTask task;
        if (data.getParams() instanceof Integer) {
            TaskService taskService = AppContextUtil.getSpringBean(TaskService.class);
            task = taskService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (task == null) {
                NotificationUtil.showRecordNotExistNotification();
                return;
            }
        } else {
            throw new MyCollabException("Invalid data " + data);
        }
        getView().previewItem(task);
        super.onGo(container, data);

        AppUI.addFragment(CrmLinkGenerator.generateTaskPreviewLink(task.getId()),
                UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                        UserUIContext.getMessage(TaskI18nEnum.SINGLE), task.getSubject()));
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:UserPermissionManagementPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    AccountModule accountModule = (AccountModule) container;
    accountModule.gotoSubView(SettingUIConstants.USERS);

    AbstractPresenter<?> presenter;
    if ((data == null) || (data instanceof UserScreenData.Read)
            || (data instanceof UserScreenData.Search)
            || (data instanceof UserScreenData.Add)
            || (data instanceof UserScreenData.Edit)) {
        presenter = PresenterResolver.getPresenter(UserPresenter.class);
    } else if ((data instanceof RoleScreenData.Read)
            || (data instanceof RoleScreenData.Add)
            || (data instanceof RoleScreenData.Edit)
            || (data instanceof RoleScreenData.Search)) {
        presenter = PresenterResolver.getPresenter(RolePresenter.class);
    } else {
        throw new MyCollabException("There is no presenter handle data " + BeanUtility.printBeanObj(data));
    }

    presenter.go(view, data);
}
项目:mycollab    文件:CaseReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_CASE)) {

        if (data.getParams() instanceof Integer) {
            CaseService caseService = AppContextUtil.getSpringBean(CaseService.class);
            SimpleCase cases = caseService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (cases != null) {
                getView().previewItem(cases);
                super.onGo(container, data);
            } else {
                NotificationUtil.showRecordNotExistNotification();
            }
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:MeetingReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_MEETING)) {
        SimpleMeeting meeting;
        if (data.getParams() instanceof Integer) {
            MeetingService meetingService = AppContextUtil.getSpringBean(MeetingService.class);
            meeting = meetingService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (meeting == null) {
                NotificationUtil.showRecordNotExistNotification();
                return;
            }
        } else {
            throw new MyCollabException("Invalid data: " + data);
        }

        super.onGo(container, data);
        view.previewItem(meeting);

        AppUI.addFragment(CrmLinkGenerator.generateMeetingPreviewLink(meeting.getId()),
                UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                        UserUIContext.getMessage(MeetingI18nEnum.SINGLE), meeting.getSubject()));
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:AssignmentReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (UserUIContext.canRead(RolePermissionCollections.CRM_TASK)) {
        SimpleCrmTask task;
        if (data.getParams() instanceof Integer) {
            TaskService taskService = AppContextUtil.getSpringBean(TaskService.class);
            task = taskService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (task == null) {
                NotificationUtil.showRecordNotExistNotification();
                return;
            }
        } else {
            throw new MyCollabException("Invalid data " + data);
        }

        super.onGo(container, data);
        view.previewItem(task);
        AppUI.addFragment(CrmLinkGenerator.generateTaskPreviewLink(task.getId()),
                UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                        UserUIContext.getMessage(TaskI18nEnum.SINGLE), task.getSubject()));

    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:MessageReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.MESSAGES)) {
        MessageContainer messageContainer = (MessageContainer) container;
        messageContainer.navigateToContainer(ProjectTypeConstants.MESSAGE);
        messageContainer.setContent(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);

                AppEventBus.getInstance().post(new UpdateNotificationItemReadStatusEvent(UserUIContext.getUsername(),
                        ModuleNameConstants.PRJ, ProjectTypeConstants.MESSAGE, message.getId().toString()));
            }
        } else {
            throw new MyCollabException("Unhanddle this case yet");
        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:LeadConvertReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    CrmModule.navigateItem(CrmTypeConstants.LEAD);
    if (UserUIContext.canRead(RolePermissionCollections.CRM_LEAD)) {
        if (data.getParams() instanceof SimpleLead) {
            SimpleLead lead = (SimpleLead) data.getParams();
            super.onGo(container, data);
            view.previewItem(lead);

            AppUI.addFragment(CrmLinkGenerator.generateLeadPreviewLink(lead.getId()),
                    UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE, UserUIContext.getMessage(LeadI18nEnum.SINGLE),
                            lead.getLeadName()));
        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:MilestonePresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    ProjectView projectViewContainer = (ProjectView) container;
    projectViewContainer.gotoSubView(ProjectTypeConstants.MILESTONE);

    IPresenter presenter;
    if (data instanceof MilestoneScreenData.Search) {
        presenter = PresenterResolver.getPresenter(MilestoneListPresenter.class);
    } else if (data instanceof MilestoneScreenData.Add || data instanceof MilestoneScreenData.Edit) {
        presenter = PresenterResolver.getPresenter(MilestoneAddPresenter.class);
    } else if (data instanceof MilestoneScreenData.Read) {
        presenter = PresenterResolver.getPresenter(MilestoneReadPresenter.class);
    } else if (data instanceof MilestoneScreenData.Roadmap) {
        presenter = PresenterResolver.getPresenter(MilestoneRoadmapPresenter.class);
    } else if (data instanceof MilestoneScreenData.Kanban) {
        presenter = PresenterResolver.getPresenter(IMilestoneKanbanPresenter.class);
    } else {
        throw new MyCollabException("Do not support screen data " + data);
    }

    presenter.go(view, data);
}
项目:mycollab    文件:ContactListPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    CrmModule.navigateItem(CrmTypeConstants.CONTACT);
    if (UserUIContext.canRead(RolePermissionCollections.CRM_CONTACT)) {
        searchCriteria = (ContactSearchCriteria) data.getParams();
        int totalCount = contactService.getTotalCount(searchCriteria);
        if (totalCount > 0) {
            this.displayListView(container, data);
            doSearch(searchCriteria);
        } else {
            this.displayNoExistItems(container, data);
        }

        AppUI.addFragment("crm/contact/list", UserUIContext.getMessage(ContactI18nEnum.LIST));
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:AccountListPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    CrmModule.navigateItem(CrmTypeConstants.ACCOUNT);
    if (UserUIContext.canRead(RolePermissionCollections.CRM_ACCOUNT)) {
        searchCriteria = (AccountSearchCriteria) data.getParams();
        int totalCount = accountService.getTotalCount(searchCriteria);
        if (totalCount > 0) {
            this.displayListView(container, data);
            doSearch(searchCriteria);
        } else {
            this.displayNoExistItems(container, data);
        }

        AppUI.addFragment("crm/account/list", UserUIContext.getMessage(AccountI18nEnum.LIST));
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:LeadReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    CrmModule.navigateItem(CrmTypeConstants.LEAD);
    if (UserUIContext.canRead(RolePermissionCollections.CRM_LEAD)) {
        if (data.getParams() instanceof SimpleLead) {
            SimpleLead lead = (SimpleLead) data.getParams();
            super.onGo(container, data);
            view.previewItem(lead);
            AppUI.addFragment(CrmLinkGenerator.generateLeadPreviewLink(lead.getId()),
                    UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                            UserUIContext.getMessage(LeadI18nEnum.SINGLE), lead.getLeadName()));

        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:BugPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    ProjectView projectViewContainer = (ProjectView) container;
    TicketContainer ticketContainer = (TicketContainer) projectViewContainer.gotoSubView(ProjectTypeConstants.TICKET);
    ticketContainer.setContent(view);
    view.removeAllComponents();

    AbstractPresenter<?> presenter;

    if (data instanceof BugScreenData.Add || data instanceof BugScreenData.Edit) {
        presenter = PresenterResolver.getPresenter(BugAddPresenter.class);
    } else if (data instanceof BugScreenData.Read) {
        presenter = PresenterResolver.getPresenter(BugReadPresenter.class);
    } else {
        throw new MyCollabException("Do not support screen data");
    }

    presenter.go(view, data);
}
项目:mycollab    文件:BugReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.BUGS)) {
        if (data.getParams() instanceof Integer) {
            BugService bugService = AppContextUtil.getSpringBean(BugService.class);
            SimpleBug bug = bugService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (bug != null) {
                BugContainer bugContainer = (BugContainer) container;
                bugContainer.removeAllComponents();
                bugContainer.addComponent(view);
                view.previewItem(bug);

                ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
                breadcrumb.gotoBugRead(bug);

                AppEventBus.getInstance().post(new UpdateNotificationItemReadStatusEvent(UserUIContext.getUsername(),
                        ModuleNameConstants.PRJ, ProjectTypeConstants.BUG, bug.getId().toString()));
            } else {
                throw new ResourceNotFoundException();
            }
        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:ComponentAddPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)) {
        ProjectComponentContainer componentContainer = (ProjectComponentContainer) container;
        componentContainer.removeAllComponents();
        componentContainer.addComponent(view);

        Component component = (Component) data.getParams();
        view.editItem(component);

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

        if (component.getId() == null) {
            breadcrumb.gotoComponentAdd();
        } else {
            breadcrumb.gotoComponentEdit(component);
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:ComponentListPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.COMPONENTS)) {
        ProjectComponentContainer trackerContainer = (ProjectComponentContainer) container;
        trackerContainer.removeAllComponents();
        trackerContainer.addComponent(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();
    }
}
项目:mycollab    文件:ProjectMemberListPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.USERS)) {
        ProjectUserContainer userGroupContainer = (ProjectUserContainer) container;
        userGroupContainer.setContent(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();
    }
}
项目:mycollab    文件:VersionAddPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)) {
        VersionContainer versionContainer = (VersionContainer) container;
        versionContainer.addComponent(view);
        Version version = (Version) data.getParams();
        view.editItem(version);

        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (version.getId() == null) {
            breadcrumb.gotoVersionAdd();
        } else {
            breadcrumb.gotoVersionEdit(version);
        }
    } else {
        NotificationUtil.showMessagePermissionAlert();
    }
}
项目:mycollab    文件:VersionPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    view.removeAllComponents();
    AbstractPresenter<?> presenter;

    if (data instanceof VersionScreenData.Add) {
        presenter = PresenterResolver.getPresenter(VersionAddPresenter.class);
    } else if (data instanceof VersionScreenData.Edit) {
        presenter = PresenterResolver.getPresenter(VersionAddPresenter.class);
    } else if (data instanceof VersionScreenData.Search) {
        presenter = PresenterResolver.getPresenter(VersionListPresenter.class);
    } else if (data instanceof VersionScreenData.Read) {
        presenter = PresenterResolver.getPresenter(VersionReadPresenter.class);
    } else if (data == null) {
        VersionSearchCriteria criteria = new VersionSearchCriteria();
        criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId()));
        data = new VersionScreenData.Search(criteria);
        presenter = PresenterResolver.getPresenter(VersionListPresenter.class);
    } else {
        throw new MyCollabException("Do not support screen data");
    }

    presenter.go(view, data);

}
项目:mycollab    文件:OpportunityReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    CrmModule.navigateItem(CrmTypeConstants.OPPORTUNITY);
    if (UserUIContext.canRead(RolePermissionCollections.CRM_OPPORTUNITY)) {
        if (data.getParams() instanceof Integer) {
            OpportunityService opportunityService = AppContextUtil.getSpringBean(OpportunityService.class);
            SimpleOpportunity opportunity = opportunityService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (opportunity != null) {
                super.onGo(container, data);
                view.previewItem(opportunity);

                AppUI.addFragment(CrmLinkGenerator.generateOpportunityPreviewLink(opportunity.getId()),
                        UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                                UserUIContext.getMessage(OpportunityI18nEnum.SINGLE), opportunity.getOpportunityname()));
            } else {
                throw new ResourceNotFoundException();
            }
        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:ComponentPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    view.removeAllComponents();
    AbstractPresenter<?> presenter;

    if (data instanceof ComponentScreenData.Add) {
        presenter = PresenterResolver.getPresenter(ComponentAddPresenter.class);
    } else if (data instanceof ComponentScreenData.Edit) {
        presenter = PresenterResolver.getPresenter(ComponentAddPresenter.class);
    } else if (data instanceof ComponentScreenData.Search) {
        presenter = PresenterResolver.getPresenter(ComponentListPresenter.class);
    } else if (data instanceof ComponentScreenData.Read) {
        presenter = PresenterResolver.getPresenter(ComponentReadPresenter.class);
    } else if (data == null) {
        ComponentSearchCriteria criteria = new ComponentSearchCriteria();
        criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId()));
        data = new ComponentScreenData.Search(criteria);
        presenter = PresenterResolver.getPresenter(ComponentListPresenter.class);
    } else {
        throw new MyCollabException("Do not support screen data");
    }

    presenter.go(view, data);
}
项目:mycollab    文件:VersionListPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.VERSIONS)) {
        VersionContainer versionContainer = (VersionContainer) container;
        versionContainer.removeAllComponents();
        versionContainer.addComponent(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();
    }
}
项目:mycollab    文件:ProjectRoleAddPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.ROLES)) {
        ProjectRoleContainer roleContainer = (ProjectRoleContainer) container;
        roleContainer.removeAllComponents();
        roleContainer.addComponent(view);

        ProjectRole role = (ProjectRole) data.getParams();

        view.editItem(role);
        ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (role.getId() == null) {
            breadcrumb.gotoRoleAdd();
        } else {
            breadcrumb.gotoRoleEdit(role);
        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:CaseReadPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    CrmModule.navigateItem(CrmTypeConstants.CASE);
    if (UserUIContext.canRead(RolePermissionCollections.CRM_CASE)) {
        if (data.getParams() instanceof Integer) {
            CaseService caseService = AppContextUtil.getSpringBean(CaseService.class);
            SimpleCase cases = caseService.findById((Integer) data.getParams(), AppUI.getAccountId());
            if (cases != null) {
                super.onGo(container, data);
                view.previewItem(cases);

                AppUI.addFragment(CrmLinkGenerator.generateCasePreviewLink(cases.getId()),
                        UserUIContext.getMessage(GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE,
                                UserUIContext.getMessage(CaseI18nEnum.SINGLE), cases.getSubject()));
            } else {
                throw new ResourceNotFoundException();
            }
        }
    } else {
        throw new SecureAccessException();
    }
}
项目:mycollab    文件:ProjectMemberEditPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) {
        ProjectUserContainer userGroupContainer = (ProjectUserContainer) container;
        userGroupContainer.setContent(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();
    }

}
项目:mycollab    文件:ProjectViewPresenter.java   
@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) {
                CurrentProjectVariables.setProject(project);
                view.initView(project);
            } else {
                throw new UserNotBelongProjectException();
            }
        }
    }
}
项目:mycollab    文件:TaskAddPresenter.java   
@Override
protected void onGo(HasComponents container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        TicketContainer ticketContainer = (TicketContainer) container;
        ticketContainer.navigateToContainer(ProjectTypeConstants.TASK);
        ticketContainer.setContent(view);
        SimpleTask task = (SimpleTask) data.getParams();

        ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
        if (task.getId() == null) {
            breadCrumb.gotoTaskAdd();
        } else {
            breadCrumb.gotoTaskEdit(task);
        }
        view.editItem(task);
    } else {
        throw new SecureAccessException();
    }
}