コード例 #1
0
        public PopulationAnalysisGroupingField CreateGroupingField(IGroupingDefinition groupingDefiniton, IPopulationAnalysisField populationAnalysisField)
        {
            var interval     = groupingDefiniton as IntervalGroupingDefinition;
            var numericField = populationAnalysisField as INumericValueField;

            updateDimension(numericField, interval);
            return(new PopulationAnalysisGroupingField(groupingDefiniton));
        }
コード例 #2
0
 protected override void Context()
 {
    base.Context();
    _groupingDefinition = A.Fake<IGroupingDefinition>();
    _populationAnalysisGroupingField = A.Fake<PopulationAnalysisGroupingField>();
    A.CallTo(() => _groupingFieldPresenter.CreateGrouping(_field, _populationDataCollector)).Returns(_groupingDefinition);
    A.CallTo(() => _populationAnalysisFieldFactory.CreateGroupingField(_groupingDefinition, _field)).Returns(_populationAnalysisGroupingField);
    A.CallTo(() => _groupingFieldPresenter.FieldName).Returns("SUPER NAME");
 }
        protected override void Context()
        {
            _view = A.Fake <IEditPopulationAnalysisGroupingFieldView>();
            _groupingDefinition               = A.Fake <IGroupingDefinition>();
            _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);
        }
コード例 #4
0
        public void Edit(IGroupingDefinition groupingDefinition)
        {
            _groupingDefinition = groupingDefinition.DowncastTo <ValueMappingGroupingDefinition>();
            uint sequence = 1;

            foreach (var value in _groupingDefinition.Mapping.Keys)
            {
                var dto = _mapping.FirstOrDefault(x => string.Equals(x.Value, value));
                if (dto == null)
                {
                    continue;
                }
                dto.UpdateFrom(_groupingDefinition.Mapping[value]);
                dto.Sequence = sequence++;
            }
            bindToView();
        }
コード例 #5
0
        public void Edit(IGroupingDefinition groupingDefinition)
        {
            _groupingDefinition = groupingDefinition.DowncastTo <NumberOfBinsGroupingDefinition>();
            _binSizeGroupingDTO.NumberOfBins  = _groupingDefinition.NumberOfBins;
            _binSizeGroupingDTO.StartColor    = _groupingDefinition.StartColor;
            _binSizeGroupingDTO.EndColor      = _groupingDefinition.EndColor;
            _binSizeGroupingDTO.NamingPattern = _groupingDefinition.NamingPattern;
            _binSizeGroupingDTO.Strategy      = _groupingDefinition.Strategy;

            foreach (var groupingItem in _groupingDefinition.Items)
            {
                var label = new GroupingItemDTO();
                label.UpdateFrom(groupingItem);
                _binSizeGroupingDTO.Labels.Add(label);
            }
            _binSizeGroupingDTO.Symbol = _binSizeGroupingDTO.Labels.First().Symbol;
            bindToView();
        }
コード例 #6
0
        public void Edit(IGroupingDefinition groupingDefinition)
        {
            _groupingDefinition = groupingDefinition.DowncastTo <FixedLimitsGroupingDefinition>();
            _fixedLimitDTOs.Clear();
            for (int i = 0; i < _groupingDefinition.Limits.Count; i++)
            {
                var dto = newDTO(maximumInDisplayUnit: _numericField.ValueInDisplayUnit(_groupingDefinition.Limits[i]));
                if (i > 0)
                {
                    dto.Minimum = _fixedLimitDTOs[i - 1].Maximum;
                }

                _fixedLimitDTOs.Add(dto);
            }

            updateFirstAndAddLastEntry(_groupingDefinition.Limits.Last());
            _fixedLimitDTOs.Each((dto, i) => dto.UpdateFrom(_groupingDefinition.Items[i]));

            bindToView();
        }
コード例 #7
0
 public PopulationAnalysisGroupingField(IGroupingDefinition groupingDefinition) : base(typeof(string))
 {
     GroupingDefinition = groupingDefinition;
 }
コード例 #8
0
 public IGroupingDefinitionPresenter MapFrom(IGroupingDefinition groupingDefinition)
 {
     return(MapFrom(GroupingDefinitions.For(groupingDefinition)));
 }
コード例 #9
0
 public static GroupingDefinitionItem For(IGroupingDefinition groupingDefinition)
 {
     return(_allGroupings.Keys.First(x => x.GroupingDefinitionType == groupingDefinition.GetType()));
 }