예제 #1
0
        private IGroupingDefinitionPresenter retrieveGroupingPresenter(GroupingDefinitionItem groupingDefinitionItem)
        {
            if (!_presenterCache.Contains(groupingDefinitionItem))
            {
                var presenter = _groupingDefinitionPresenterMapper.MapFrom(groupingDefinitionItem);
                presenter.StatusChanged += groupingDefinitionPresenterChanged;
                _presenterCache[groupingDefinitionItem] = presenter;
                presenter.InitializeWith(_populationAnalysisField, _populationDataCollector);
                presenter.StartCreate();
            }

            return(_presenterCache[groupingDefinitionItem]);
        }
예제 #2
0
        protected override void Context()
        {
            _view = A.Fake <IEditPopulationAnalysisGroupingFieldView>();
            _groupingDefinition               = A.Fake <GroupingDefinition>();
            _presenterMapper                  = A.Fake <IGroupingDefinitionToGroupingDefinitionPresenterMapper>();
            _groupingField                    = A.Fake <PopulationAnalysisGroupingField>();
            _populationDataCollector          = A.Fake <IPopulationDataCollector>();
            _groupingDefinitionPresenter      = A.Fake <IGroupingDefinitionPresenter>();
            _groupingField.PopulationAnalysis = A.Fake <PopulationAnalysis>();
            _referenceField                   = A.Fake <IPopulationAnalysisField>();
            sut = new EditPopulationAnalysisGroupingFieldPresenter(_view, _presenterMapper);

            A.CallTo(() => _groupingField.ReferencedFieldName).Returns("ParameterField");
            A.CallTo(() => _groupingField.GroupingDefinition).Returns(_groupingDefinition);
            A.CallTo(() => _presenterMapper.MapFrom(_groupingDefinition)).Returns(_groupingDefinitionPresenter);
            A.CallTo(() => _groupingField.PopulationAnalysis.FieldByName(_groupingField.ReferencedFieldName)).Returns(_referenceField);
        }
예제 #3
0
        public bool Edit(PopulationAnalysisGroupingField groupingField, IPopulationDataCollector populationDataCollector)
        {
            _groupingPresenter = _groupingDefinitionPresenterMapper.MapFrom(groupingField.GroupingDefinition);
            _groupingPresenter.StatusChanged += (o, e) => ViewChanged();

            var referenceField = groupingField.PopulationAnalysis.FieldByName(groupingField.ReferencedFieldName);

            _groupingPresenter.InitializeWith(referenceField, populationDataCollector);
            _groupingPresenter.Edit(groupingField.GroupingDefinition);

            View.SetGroupingView(_groupingPresenter.BaseView);
            View.Caption = PKSimConstants.UI.EditGroupingFor(groupingField.Name, referenceField.Name);
            View.Display();
            if (_view.Canceled)
            {
                return(false);
            }

            _groupingPresenter.UpdateGroupingDefinition();
            return(true);
        }