diff --git a/appveyor.yml b/appveyor.yml
index cb9a54d03..26afd7d98 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,15 +4,15 @@ image: Visual Studio 2019
version: '{build}'
init:
-- ps: Update-AppveyorBuild -Version "$($env:ospsuite_version).$($env:appveyor_build_version)"
+- ps: Update-AppveyorBuild -Version "$($env:ospsuite_nightly_version).$($env:appveyor_build_version)"
dotnet_csproj:
patch: true
file: '**\*.csproj'
- version: '$(ospsuite_version).$(build_number)'
- assembly_version: '$(ospsuite_version).$(build_number)'
- file_version: '$(ospsuite_version).$(build_number)'
- informational_version: '$(ospsuite_version).$(build_number)'
+ version: '$(ospsuite_nightly_version).$(build_number)'
+ assembly_version: '$(ospsuite_nightly_version).$(build_number)'
+ file_version: '$(ospsuite_nightly_version).$(build_number)'
+ informational_version: '$(ospsuite_nightly_version).$(build_number)'
before_build:
- nuget sources add -name bddhelper -source https://ci.appveyor.com/nuget/ospsuite-bddhelper
@@ -49,7 +49,7 @@ skip_commits:
branches:
only:
- - develop
+ - hotfix/11.3
test:
assemblies:
diff --git a/src/OSPSuite.Assets/UIConstants.cs b/src/OSPSuite.Assets/UIConstants.cs
index 2c3c4a0b8..84390cca5 100644
--- a/src/OSPSuite.Assets/UIConstants.cs
+++ b/src/OSPSuite.Assets/UIConstants.cs
@@ -203,6 +203,7 @@ public static class Captions
public static readonly string Yes = "Yes";
public static readonly string ReallyRemoveObservedDataFromSimulation = $"Really remove {ObjectTypes.ObservedData} from the simulation?\nHint: {ObjectTypes.ObservedData} will not be deleted from the project";
public static readonly string SimulationWasCanceled = "Simulation was canceled";
+ public static readonly string SelectMappingToShowObservedData = "Select mapping to show observed data";
public static string ShouldWatermarkBeUsedForChartExportToClipboard(string applicationName, string optionLocation)
{
diff --git a/src/OSPSuite.Core/Domain/IProject.cs b/src/OSPSuite.Core/Domain/IProject.cs
index c341dd0fc..fe1a07531 100644
--- a/src/OSPSuite.Core/Domain/IProject.cs
+++ b/src/OSPSuite.Core/Domain/IProject.cs
@@ -6,7 +6,7 @@
namespace OSPSuite.Core.Domain
{
- public interface IProject : IObjectBase, IWithChartTemplates, IWithCreationMetaData
+ public interface IProject : IObjectBase, IWithChartTemplates, IWithCreationMetaData, IWithHasChanged
{
///
/// Full path of project (empty if the project was not saved yet)
diff --git a/src/OSPSuite.Core/Domain/ParameterIdentifications/ParameterIdentification.cs b/src/OSPSuite.Core/Domain/ParameterIdentifications/ParameterIdentification.cs
index 95e50a3d1..64b464b17 100644
--- a/src/OSPSuite.Core/Domain/ParameterIdentifications/ParameterIdentification.cs
+++ b/src/OSPSuite.Core/Domain/ParameterIdentifications/ParameterIdentification.cs
@@ -7,7 +7,7 @@
namespace OSPSuite.Core.Domain.ParameterIdentifications
{
- public class ParameterIdentification : ObjectBase, IParameterAnalysable, IUsesObservedData
+ public class ParameterIdentification : ObjectBase, IParameterAnalysable, IUsesObservedData, IWithHasChanged
{
private readonly List _allSimulations = new List();
private readonly List _allIdentificationParameters = new List();
diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysis.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysis.cs
index c30750d8a..fe74f5e29 100644
--- a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysis.cs
+++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysis.cs
@@ -7,7 +7,7 @@
namespace OSPSuite.Core.Domain.SensitivityAnalyses
{
- public class SensitivityAnalysis : ObjectBase, IParameterAnalysable, IVisitor
+ public class SensitivityAnalysis : ObjectBase, IParameterAnalysable, IVisitor, IWithHasChanged
{
public virtual ISimulation Simulation { get; set; }
private readonly List _allSimulationAnalyses = new List();
diff --git a/src/OSPSuite.Core/Domain/Services/CloneManagerStrategy.cs b/src/OSPSuite.Core/Domain/Services/CloneManagerStrategy.cs
index 28a5d7603..9522ab160 100644
--- a/src/OSPSuite.Core/Domain/Services/CloneManagerStrategy.cs
+++ b/src/OSPSuite.Core/Domain/Services/CloneManagerStrategy.cs
@@ -22,14 +22,12 @@ public virtual T Clone(T objectToClone) where T : class, IUpdatable
if (objectToClone == null)
return null;
- var repository = objectToClone as DataRepository;
- if (repository != null)
+ if (objectToClone is DataRepository repository)
{
- return cloneDataRepository(objectToClone.DowncastTo()) as T;
+ return cloneDataRepository(repository) as T;
}
- var formulaToClone = objectToClone as IFormula;
- if (formulaToClone != null)
+ if (objectToClone is IFormula formulaToClone)
return CreateFormulaCloneFor(formulaToClone).DowncastTo();
var clone = _objectBaseFactory.CreateObjectBaseFrom(objectToClone);
@@ -41,6 +39,9 @@ public virtual T Clone(T objectToClone) where T : class, IUpdatable
//it is necessary to update the formula before the properties, since UpdatePropertiesFrom might use formula
clone.UpdatePropertiesFrom(objectToClone, this);
+ if (clone is IWithHasChanged withHasChanged)
+ withHasChanged.HasChanged = true;
+
return clone;
}
diff --git a/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs
index 3ce8f047d..bb65ef452 100644
--- a/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs
+++ b/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs
@@ -67,6 +67,8 @@ public interface ISimpleChartPresenter : IPresenter
/// Refresh the display after external changes were made to the chart
///
void Refresh();
+
+ void Clear();
}
public class SimpleChartPresenter : AbstractCommandCollectorPresenter, ISimpleChartPresenter
@@ -93,6 +95,8 @@ public SimpleChartPresenter(ISimpleChartView view, IChartDisplayPresenter chartD
AddSubPresenters(_chartDisplayPresenter);
}
+ public void Clear() => _chartDisplayPresenter.Clear();
+
public Action HotTracked
{
set => _chartDisplayPresenter.HotTracked = value;
@@ -136,15 +140,12 @@ private void bindToChart()
public CurveChart Plot(DataRepository dataRepository, Scalings scale)
{
Chart = _chartFactory.CreateChartFor(dataRepository, scale);
- setChartScalingForObservedData(new[] {dataRepository});
+ setChartScalingForObservedData(new[] { dataRepository });
bindToChart();
return Chart;
}
- public CurveChart Plot(DataRepository dataRepository)
- {
- return Plot(dataRepository, _presentationUserSettings.DefaultChartYScaling);
- }
+ public CurveChart Plot(DataRepository dataRepository) => Plot(dataRepository, _presentationUserSettings.DefaultChartYScaling);
public CurveChart PlotObservedData(IEnumerable observedData)
{
@@ -165,20 +166,11 @@ private void setChartScalingForObservedData(IReadOnlyList observ
Chart.DefaultYAxisScaling = Scalings.Linear;
}
- private bool shouldUseLinearScaling(IReadOnlyList observedData)
- {
- return observedData.Any(dataRepositoryHasFraction);
- }
+ private bool shouldUseLinearScaling(IReadOnlyList observedData) => observedData.Any(dataRepositoryHasFraction);
- private bool dataRepositoryHasFraction(DataRepository dataRepository)
- {
- return dataRepository.AllButBaseGrid().Any(x => x.IsFraction());
- }
+ private bool dataRepositoryHasFraction(DataRepository dataRepository) => dataRepository.AllButBaseGrid().Any(x => x.IsFraction());
- public CurveChart PlotObservedData(DataRepository observedData)
- {
- return PlotObservedData(new[] {observedData}).WithName(observedData.Name);
- }
+ public CurveChart PlotObservedData(DataRepository observedData) => PlotObservedData(new[] { observedData }).WithName(observedData.Name);
private void setScaleInView(CurveChart chart)
{
diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationDataSelectionPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationDataSelectionPresenter.cs
index a7255eb0d..fc7e88606 100644
--- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationDataSelectionPresenter.cs
+++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationDataSelectionPresenter.cs
@@ -1,17 +1,17 @@
using System;
-using OSPSuite.Utility.Events;
using OSPSuite.Core.Domain;
using OSPSuite.Core.Domain.ParameterIdentifications;
using OSPSuite.Core.Events;
using OSPSuite.Presentation.Views.ParameterIdentifications;
+using OSPSuite.Utility.Events;
namespace OSPSuite.Presentation.Presenters.ParameterIdentifications
{
public interface IParameterIdentificationDataSelectionPresenter : IParameterIdentificationItemPresenter,
- IListener,
- IListener,
- IListener,
- IListener,
+ IListener,
+ IListener,
+ IListener,
+ IListener,
IListener
{
event EventHandler SimulationAdded;
@@ -22,7 +22,7 @@ public class ParameterIdentificationDataSelectionPresenter : AbstractSubPresente
{
private readonly IParameterIdentificationSimulationSelectionPresenter _simulationSelectionPresenter;
private readonly IParameterIdentificationOutputMappingPresenter _outputMappingPresenter;
- private readonly IParameterIdentificationWeightedObservedDataCollectorPresenter _weightedObservedDataCollectorPresenter;
+ private readonly IParameterIdentificationWeightedObservedDataPresenter _weightedObservedDataPresenter;
private ParameterIdentification _parameterIdentification;
public event EventHandler SimulationAdded = delegate { };
public event EventHandler SimulationRemoved = delegate { };
@@ -30,15 +30,15 @@ public class ParameterIdentificationDataSelectionPresenter : AbstractSubPresente
public ParameterIdentificationDataSelectionPresenter(IParameterIdentificationDataSelectionView view,
IParameterIdentificationSimulationSelectionPresenter simulationSelectionPresenter,
IParameterIdentificationOutputMappingPresenter outputMappingPresenter,
- IParameterIdentificationWeightedObservedDataCollectorPresenter weightedObservedDataCollectorPresenter) : base(view)
+ IParameterIdentificationWeightedObservedDataPresenter weightedObservedDataPresenter) : base(view)
{
_simulationSelectionPresenter = simulationSelectionPresenter;
_outputMappingPresenter = outputMappingPresenter;
- _weightedObservedDataCollectorPresenter = weightedObservedDataCollectorPresenter;
+ _weightedObservedDataPresenter = weightedObservedDataPresenter;
view.AddSimulationSelectionView(_simulationSelectionPresenter.BaseView);
view.AddOutputMappingView(_outputMappingPresenter.BaseView);
- view.AddWeightedObservedDataCollectorView(_weightedObservedDataCollectorPresenter.BaseView);
- AddSubPresenters(_simulationSelectionPresenter, _outputMappingPresenter, _weightedObservedDataCollectorPresenter);
+ view.AddWeightedObservedDataCollectorView(_weightedObservedDataPresenter.BaseView);
+ AddSubPresenters(_simulationSelectionPresenter, _outputMappingPresenter, _weightedObservedDataPresenter);
_simulationSelectionPresenter.SimulationAdded += (o, e) => simulationAdded(e);
_simulationSelectionPresenter.SimulationRemoved += (o, e) => simulationRemoved(e);
@@ -48,20 +48,11 @@ public ParameterIdentificationDataSelectionPresenter(IParameterIdentificationDat
_outputMappingPresenter.ObservedDataSelected += (o, e) => observedDataSelected(e.WeightedObservedData);
}
- private void observedDataUnmapped(WeightedObservedData weightedObservedData)
- {
- _weightedObservedDataCollectorPresenter.RemoveObservedData(weightedObservedData);
- }
+ private void observedDataUnmapped(WeightedObservedData weightedObservedData) => _weightedObservedDataPresenter.Clear(weightedObservedData);
- private void observedDataSelected(WeightedObservedData weightedObservedData)
- {
- _weightedObservedDataCollectorPresenter.SelectObservedData(weightedObservedData);
- }
+ private void observedDataSelected(WeightedObservedData weightedObservedData) => _weightedObservedDataPresenter.Edit(weightedObservedData);
- private void observedDataMapped(WeightedObservedData weightedObservedData)
- {
- _weightedObservedDataCollectorPresenter.AddObservedData(weightedObservedData);
- }
+ private void observedDataMapped(WeightedObservedData weightedObservedData) => _weightedObservedDataPresenter.Edit(weightedObservedData);
private void simulationAdded(SimulationEventArgs e)
{
@@ -72,7 +63,6 @@ private void simulationAdded(SimulationEventArgs e)
private void updateOutputAndWeightsPresenters()
{
_outputMappingPresenter.Refresh();
- _weightedObservedDataCollectorPresenter.Refresh();
ViewChanged();
}
@@ -87,7 +77,6 @@ public void EditParameterIdentification(ParameterIdentification parameterIdentif
_parameterIdentification = parameterIdentification;
_simulationSelectionPresenter.EditParameterIdentification(_parameterIdentification);
_outputMappingPresenter.EditParameterIdentification(_parameterIdentification);
- _weightedObservedDataCollectorPresenter.EditParameterIdentification(_parameterIdentification);
}
public void Handle(ObservedDataAddedToAnalysableEvent eventToHandle)
@@ -104,10 +93,7 @@ private bool canHandle(AnalysableEvent analysableEvent)
return identificationUsesSimulation(analysableEvent.Analysable as ISimulation);
}
- private bool identificationUsesSimulation(ISimulation simulation)
- {
- return _parameterIdentification.UsesSimulation(simulation);
- }
+ private bool identificationUsesSimulation(ISimulation simulation) => _parameterIdentification.UsesSimulation(simulation);
public void Handle(ObservedDataRemovedFromAnalysableEvent eventToHandle)
{
@@ -124,21 +110,14 @@ public void Handle(RenamedEvent eventToHandle)
_outputMappingPresenter.Refresh();
}
- private bool canHandle(RenamedEvent eventToHandle)
- {
- return identificationUsesSimulation(eventToHandle.RenamedObject as ISimulation);
- }
+ private bool canHandle(RenamedEvent eventToHandle) => identificationUsesSimulation(eventToHandle.RenamedObject as ISimulation);
- public void Handle(SimulationRemovedEvent eventToHandle)
- {
- refreshSubPresenters();
- }
+ public void Handle(SimulationRemovedEvent eventToHandle) => refreshSubPresenters();
private void refreshSubPresenters()
{
_simulationSelectionPresenter.Refresh();
_outputMappingPresenter.Refresh();
- _weightedObservedDataCollectorPresenter.Refresh();
}
public void Handle(SimulationReplacedInParameterAnalyzableEvent eventToHandle)
@@ -147,9 +126,6 @@ public void Handle(SimulationReplacedInParameterAnalyzableEvent eventToHandle)
refreshSubPresenters();
}
- private bool canHandle(SimulationReplacedInParameterAnalyzableEvent eventToHandle)
- {
- return Equals(eventToHandle.ParameterAnalysable, _parameterIdentification);
- }
+ private bool canHandle(SimulationReplacedInParameterAnalyzableEvent eventToHandle) => Equals(eventToHandle.ParameterAnalysable, _parameterIdentification);
}
}
\ No newline at end of file
diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs
index 136e2434d..f0e5fa63a 100644
--- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs
+++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs
@@ -96,15 +96,12 @@ public void Refresh()
this.DoWithinLatch(() =>
{
UpdateCache();
- updateOutputMapppingList();
- _view.BindTo(_allOutputMappingDTOs);
+ updateOutputMappingList();
});
+ _view.BindTo(_allOutputMappingDTOs);
}
- public void UpdateCache()
- {
- _allAvailableOutputs.Clear();
- }
+ public void UpdateCache() => _allAvailableOutputs.Clear();
public void AddOutputMapping()
{
@@ -114,7 +111,7 @@ public void AddOutputMapping()
OnStatusChanged();
}
- private void updateOutputMapppingList()
+ private void updateOutputMappingList()
{
_allOutputMappingDTOs.Clear();
_parameterIdentification.AllOutputMappings.Each(x => _allOutputMappingDTOs.Add(mapFrom(x)));
@@ -137,20 +134,11 @@ public IEnumerable AllAvailableOutputs
}
}
- private SimulationQuantitySelectionDTO mapFrom(ISimulation simulation, IQuantity quantity)
- {
- return _simulationQuantitySelectionDTOMapper.MapFrom(simulation, quantity);
- }
+ private SimulationQuantitySelectionDTO mapFrom(ISimulation simulation, IQuantity quantity) => _simulationQuantitySelectionDTOMapper.MapFrom(simulation, quantity);
- private OutputMappingDTO mapFrom(OutputMapping outputMapping)
- {
- return _outputMappingDTOMapper.MapFrom(outputMapping, AllAvailableOutputs);
- }
+ private OutputMappingDTO mapFrom(OutputMapping outputMapping) => _outputMappingDTOMapper.MapFrom(outputMapping, AllAvailableOutputs);
- public IEnumerable AllObservedDataFor(OutputMappingDTO outputMappingDTO)
- {
- return allPossibleObservedDataForOutput(outputMappingDTO.Output);
- }
+ public IEnumerable AllObservedDataFor(OutputMappingDTO outputMappingDTO) => allPossibleObservedDataForOutput(outputMappingDTO.Output);
private IEnumerable allPossibleObservedDataForOutput(SimulationQuantitySelectionDTO outputSelectionDTO)
{
@@ -165,7 +153,7 @@ private IEnumerable allPossibleObservedDataForOutput(SimulationQ
public void ObservedDataSelectionChanged(OutputMappingDTO dto, DataRepository newObservedData, DataRepository oldObservedData)
{
- var allOutputsUsingObservedData = _allOutputMappingDTOs.Where(x => Equals(x.ObservedData, newObservedData)).Except(new[] {dto}).ToList();
+ var allOutputsUsingObservedData = _allOutputMappingDTOs.Where(x => Equals(x.ObservedData, newObservedData)).Except(new[] { dto }).ToList();
if (observedDataAlreadySelectedForSameOutput(dto.Output, newObservedData))
{
@@ -197,10 +185,7 @@ public void ObservedDataSelectionChanged(OutputMappingDTO dto, DataRepository ne
return allIds.Max() + 1;
}
- private bool observedDataAlreadySelectedForSameOutput(SimulationQuantitySelectionDTO outputDTO, DataRepository observedData)
- {
- return _allOutputMappingDTOs.Count(x => Equals(x.Output, outputDTO) && Equals(x.ObservedData, observedData)) > 1;
- }
+ private bool observedDataAlreadySelectedForSameOutput(SimulationQuantitySelectionDTO outputDTO, DataRepository observedData) => _allOutputMappingDTOs.Count(x => Equals(x.Output, outputDTO) && Equals(x.ObservedData, observedData)) > 1;
public void OutputSelectionChanged(OutputMappingDTO dto, SimulationQuantitySelectionDTO newOutput, SimulationQuantitySelectionDTO oldOutput)
{
@@ -214,10 +199,7 @@ public void OutputSelectionChanged(OutputMappingDTO dto, SimulationQuantitySelec
dto.Scaling = _parameterIdentificationTask.DefaultScalingFor(newOutput.Quantity);
}
- public void Select(OutputMappingDTO outputMappingDTO)
- {
- this.DoWithinLatch(() => ObservedDataSelected(this, new ObservedDataEventArgs(outputMappingDTO.WeightedObservedData)));
- }
+ public void Select(OutputMappingDTO outputMappingDTO) => this.DoWithinLatch(() => ObservedDataSelected(this, new ObservedDataEventArgs(outputMappingDTO.WeightedObservedData)));
public void RemoveOutputMapping(OutputMappingDTO outputMappingDTO)
{
@@ -234,9 +216,6 @@ private void raiseObservedDataUnmappedFor(WeightedObservedData weightedObservedD
ObservedDataUnmapped(this, new ObservedDataEventArgs(weightedObservedData));
}
- private void raiseObservedDataMappedFor(WeightedObservedData weightedObservedData)
- {
- ObservedDataMapped(this, new ObservedDataEventArgs(weightedObservedData));
- }
+ private void raiseObservedDataMappedFor(WeightedObservedData weightedObservedData) => ObservedDataMapped(this, new ObservedDataEventArgs(weightedObservedData));
}
}
\ No newline at end of file
diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorPresenter.cs
deleted file mode 100644
index f8f16e7e4..000000000
--- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorPresenter.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using OSPSuite.Core.Domain;
-using OSPSuite.Core.Domain.ParameterIdentifications;
-using OSPSuite.Presentation.Core;
-using OSPSuite.Presentation.Views;
-using OSPSuite.Presentation.Views.ParameterIdentifications;
-using OSPSuite.Utility;
-using OSPSuite.Utility.Collections;
-using OSPSuite.Utility.Events;
-using OSPSuite.Utility.Extensions;
-
-namespace OSPSuite.Presentation.Presenters.ParameterIdentifications
-{
- public interface IParameterIdentificationWeightedObservedDataCollectorPresenter : IPresenter, IParameterIdentificationPresenter, ILatchable
- {
- void AddObservedData(WeightedObservedData weightedObservedData);
- void SelectObservedData(WeightedObservedData weightedObservedData);
- void RemoveObservedData(WeightedObservedData weightedObservedData);
- void Refresh();
- void ObservedDataViewSelected(IView view);
- }
-
- public class ParameterIdentificationWeightedObservedDataCollectorPresenter : AbstractPresenter, IParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- private readonly IApplicationController _applicationController;
- private readonly IEventPublisher _eventPublisher;
- private ParameterIdentification _parameterIdentification;
- public bool IsLatched { get; set; }
-
- private readonly Cache _allObservedDataPresenters;
-
- public ParameterIdentificationWeightedObservedDataCollectorPresenter(IParameterIdentificationWeightedObservedDataCollectorView view, IApplicationController applicationController, IEventPublisher eventPublisher) : base(view)
- {
- _applicationController = applicationController;
- _eventPublisher = eventPublisher;
- _allObservedDataPresenters = new Cache(onMissingKey: x => null);
- }
-
- public void EditParameterIdentification(ParameterIdentification parameterIdentification)
- {
- _parameterIdentification = parameterIdentification;
- clear();
- var allWeightedObservedData = _parameterIdentification.AllOutputMappings.Select(x => x.WeightedObservedData).ToList();
- addWeightedObservedDataToView(allWeightedObservedData);
- SelectObservedData(allWeightedObservedData.FirstOrDefault());
- }
-
- private void addWeightedObservedDataToView(List allWeightedObservedData)
- {
- this.DoWithinLatch(() =>
- {
- using (new BatchUpdate(View))
- {
- allWeightedObservedData.Each(AddObservedData);
- }
- });
- }
-
- public void AddObservedData(WeightedObservedData weightedObservedData)
- {
- // You can get a null weighted observed data when a mapping has not been assigned observed data yet or if mapping is corrupted
- if (weightedObservedData?.ObservedData == null)
- return;
-
- if (_allObservedDataPresenters.Contains(weightedObservedData))
- return;
-
- var presenter = _applicationController.Start();
- _allObservedDataPresenters.Add(weightedObservedData, presenter);
- edit(weightedObservedData);
- _view.AddObservedDataView(presenter.View);
- SelectObservedData(weightedObservedData);
- }
-
- public void SelectObservedData(WeightedObservedData weightedObservedData)
- {
- if (IsLatched) return;
-
- var observedDataPresenter = edit(weightedObservedData);
- if (observedDataPresenter == null) return;
-
- _view.SelectObservedDataView(observedDataPresenter.View);
- }
-
- public void RemoveObservedData(WeightedObservedData weightedObservedData)
- {
- var presenter = _allObservedDataPresenters[weightedObservedData];
- if (presenter == null)
- return;
-
- _allObservedDataPresenters.Remove(weightedObservedData);
- removeObservedDataPresenter(presenter);
- }
-
- private void removeObservedDataPresenter(IParameterIdentificationWeightedObservedDataPresenter presenter)
- {
- presenter.ReleaseFrom(_eventPublisher);
- _view.RemoveObservedDataView(presenter.View);
- }
-
- public void Refresh()
- {
- EditParameterIdentification(_parameterIdentification);
- }
-
- public void ObservedDataViewSelected(IView view)
- {
- this.DoWithinLatch(() =>
- {
- var weightedObservedData = findObservedDataEditedBy(view);
- edit(weightedObservedData);
- });
- }
-
- private IParameterIdentificationWeightedObservedDataPresenter edit(WeightedObservedData weightedObservedData)
- {
- var observedDataPresenter = _allObservedDataPresenters[weightedObservedData];
- observedDataPresenter?.Edit(weightedObservedData);
-
- return observedDataPresenter;
- }
-
- private WeightedObservedData findObservedDataEditedBy(IView view)
- {
- return _allObservedDataPresenters.KeyValues.Where(x => Equals(x.Value.View, view)).Select(x => x.Key).FirstOrDefault();
- }
-
- private void clear()
- {
- using (new BatchUpdate(View))
- {
- _view.Clear();
- _allObservedDataPresenters.Each(p => p.ReleaseFrom(_eventPublisher));
- _allObservedDataPresenters.Clear();
- }
- }
-
- public override void ReleaseFrom(IEventPublisher eventPublisher)
- {
- try
- {
- clear();
- }
- finally
- {
- base.ReleaseFrom(eventPublisher);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataPresenter.cs
index 0b8e626bc..6bf6c8513 100644
--- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataPresenter.cs
+++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationWeightedObservedDataPresenter.cs
@@ -1,6 +1,5 @@
-using OSPSuite.Core.Domain;
-using OSPSuite.Core.Domain.Data;
-using OSPSuite.Core.Domain.ParameterIdentifications;
+using OSPSuite.Assets;
+using OSPSuite.Core.Domain;
using OSPSuite.Core.Events;
using OSPSuite.Presentation.Presenters.Charts;
using OSPSuite.Presentation.Views.ParameterIdentifications;
@@ -13,13 +12,17 @@ public interface IParameterIdentificationWeightedObservedDataPresenter : IPresen
void Edit(WeightedObservedData weightedObservedData);
string Caption { get; set; }
+
+ ///
+ /// Clears the display if the is the same as the one being displayed
+ ///
+ void Clear(WeightedObservedData weightedObservedData);
}
public class ParameterIdentificationWeightedObservedDataPresenter : AbstractPresenter, IParameterIdentificationWeightedObservedDataPresenter
{
private readonly IWeightedDataRepositoryDataPresenter _dataPresenter;
private readonly ISimpleChartPresenter _chartPresenter;
- private bool _alreadyEditing;
private WeightedObservedData _observedData;
public ParameterIdentificationWeightedObservedDataPresenter(IParameterIdentificationWeightedObservedDataView view, IWeightedDataRepositoryDataPresenter dataPresenter, ISimpleChartPresenter chartPresenter) : base(view)
@@ -31,11 +34,15 @@ public ParameterIdentificationWeightedObservedDataPresenter(IParameterIdentifica
view.AddDataView(_dataPresenter.BaseView);
view.AddChartView(_chartPresenter.BaseView);
+ clear();
}
public void Edit(WeightedObservedData weightedObservedData)
{
- if (_alreadyEditing) return;
+ if (_observedData == weightedObservedData || weightedObservedData == null)
+ return;
+
+ _view.SetTitle(weightedObservedData.DisplayName);
_observedData = weightedObservedData;
_dataPresenter.EditObservedData(weightedObservedData);
@@ -43,7 +50,22 @@ public void Edit(WeightedObservedData weightedObservedData)
_chartPresenter.LogLinSelectionEnabled = true;
_chartPresenter.HotTracked = hotTracked;
Caption = weightedObservedData.DisplayName;
- _alreadyEditing = true;
+ }
+
+ public void Clear(WeightedObservedData weightedObservedData)
+ {
+ if (_observedData != weightedObservedData)
+ return;
+
+ clear();
+ }
+
+ private void clear()
+ {
+ _view.SetTitle(Captions.SelectMappingToShowObservedData);
+ _observedData = null;
+ _chartPresenter.Clear();
+ _dataPresenter.Clear();
}
public string Caption
@@ -54,17 +76,13 @@ public string Caption
private void hotTracked(int rowIndex) => _dataPresenter.SelectRow(rowIndex);
- private bool shouldHandleEvent(ObservedDataEvent eventToHandle)
- {
- return Equals(eventToHandle.ObservedData, _observedData.ObservedData);
- }
+ private bool shouldHandleEvent(ObservedDataEvent eventToHandle) => Equals(eventToHandle.ObservedData, _observedData.ObservedData);
public void Handle(ObservedDataValueChangedEvent eventToHandle)
{
if (!shouldHandleEvent(eventToHandle))
return;
- _alreadyEditing = false;
Edit(_observedData);
}
}
diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs
index 998ac0644..e5376e47b 100644
--- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs
+++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs
@@ -3,7 +3,6 @@
using System.Linq;
using OSPSuite.Assets;
using OSPSuite.Core.Domain;
-using OSPSuite.Core.Domain.ParameterIdentifications;
using OSPSuite.Presentation.Mappers.ParameterIdentifications;
using OSPSuite.Presentation.Presenters.ObservedData;
using OSPSuite.Presentation.Views.ParameterIdentifications;
@@ -18,6 +17,7 @@ public interface IWeightedDataRepositoryDataPresenter : IBaseDataRepositoryDataP
void DisableRepositoryColumns();
void SelectRow(int rowIndex);
IEnumerable GetValidationMessagesForWeight(string weightValue);
+ void Clear();
}
public class WeightedDataRepositoryDataPresenter : BaseDataRepositoryDataPresenter, IWeightedDataRepositoryDataPresenter
@@ -30,10 +30,7 @@ public WeightedDataRepositoryDataPresenter(IWeightedDataRepositoryDataView view,
_weightedDataRepositoryToDataTableMapper = weightedDataRepositoryToDataTableMapper;
}
- protected override DataTable MapDataTableFromColumns()
- {
- return _weightedDataRepositoryToDataTableMapper.MapFrom(_weightedObservedData);
- }
+ protected override DataTable MapDataTableFromColumns() => _weightedDataRepositoryToDataTableMapper.MapFrom(_weightedObservedData);
public void EditObservedData(WeightedObservedData weightedObservedData)
{
@@ -41,11 +38,14 @@ public void EditObservedData(WeightedObservedData weightedObservedData)
EditObservedData(weightedObservedData.ObservedData);
}
- public void ChangeWeight(int weightIndex, float newWeight)
+ public void Clear()
{
- _weightedObservedData.Weights[weightIndex] = newWeight;
+ _weightedObservedData = null;
+ _view.Clear();
}
+ public void ChangeWeight(int weightIndex, float newWeight) => _weightedObservedData.Weights[weightIndex] = newWeight;
+
public bool ColumnIsInDataRepository(DataColumn column)
{
var columnId = GetColumnIdFromColumnIndex(_dataTable.Columns.IndexOf(column));
@@ -68,9 +68,9 @@ public void DisableRepositoryColumns()
public IEnumerable GetValidationMessagesForWeight(string weightValue)
{
if (!float.TryParse(weightValue, out var proposedValue))
- return new[] {Error.ValueIsRequired};
+ return new[] { Error.ValueIsRequired };
- return isValidWeight(proposedValue) ? Enumerable.Empty() : new[] {Error.WeightValueCannotBeNegative};
+ return isValidWeight(proposedValue) ? Enumerable.Empty() : new[] { Error.WeightValueCannotBeNegative };
}
private bool isValidWeight(float value) => value >= 0;
diff --git a/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataCollectorView.cs b/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataCollectorView.cs
deleted file mode 100644
index 67d8d1c6e..000000000
--- a/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataCollectorView.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using OSPSuite.Presentation.Core;
-using OSPSuite.Presentation.Presenters.ParameterIdentifications;
-
-namespace OSPSuite.Presentation.Views.ParameterIdentifications
-{
- public interface IParameterIdentificationWeightedObservedDataCollectorView : IView, IBatchUpdatable
- {
- void AddObservedDataView(IView view);
- void RemoveObservedDataView(IView view);
- void SelectObservedDataView(IView view);
- void Clear();
- }
-}
\ No newline at end of file
diff --git a/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataView.cs b/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataView.cs
index d36196216..0ac457592 100644
--- a/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataView.cs
+++ b/src/OSPSuite.Presentation/Views/ParameterIdentifications/IParameterIdentificationWeightedObservedDataView.cs
@@ -6,5 +6,6 @@ public interface IParameterIdentificationWeightedObservedDataView : IView(IContainer container, string path) where T :
return entity == null ? Array.Empty() : new[] {entity};
}
+ //last entry of path is the recursive wild cards => user probably want to get all possible children so
+ //we modify the path accordingly
+ if (pathArray.Last() == WILD_CARD_RECURSIVE)
+ pathArray = pathArray.Append(WILD_CARD).ToArray();
+
var regex = new Regex(createSearchPattern(pathArray), RegexOptions.IgnoreCase);
var parentContainerPath = $"{_entityPathResolver.FullPathFor(container)}{ObjectPath.PATH_DELIMITER}";
diff --git a/src/OSPSuite.UI/Binders/ArithmeticMeanAreaCurveBinder.cs b/src/OSPSuite.UI/Binders/ArithmeticMeanAreaCurveBinder.cs
index 036c35073..3b49c1b5c 100644
--- a/src/OSPSuite.UI/Binders/ArithmeticMeanAreaCurveBinder.cs
+++ b/src/OSPSuite.UI/Binders/ArithmeticMeanAreaCurveBinder.cs
@@ -14,9 +14,9 @@ public ArithmeticMeanAreaCurveBinder(Curve curve, ChartControl chartControl, Cur
{
}
- protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, float baseValue)
+ protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, BaseGrid baseGrid, int baseIndex)
{
- var stdDev = yDimension.BaseUnitValueToUnitValue(yUnit, Curve.yData.GetValue(baseValue));
+ var stdDev = yDimension.BaseUnitValueToUnitValue(yUnit, ValueInBaseUnit(Curve.yData, baseGrid, baseIndex));
if (!IsValidValue(stdDev))
stdDev = 0;
diff --git a/src/OSPSuite.UI/Binders/ArithmeticSTDCurveBinder.cs b/src/OSPSuite.UI/Binders/ArithmeticSTDCurveBinder.cs
index 37e16a87c..a7c78d188 100644
--- a/src/OSPSuite.UI/Binders/ArithmeticSTDCurveBinder.cs
+++ b/src/OSPSuite.UI/Binders/ArithmeticSTDCurveBinder.cs
@@ -14,10 +14,10 @@ public ArithmeticStdCurveBinder(Curve curve, ChartControl chartControl, CurveCha
{
}
- protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, float baseValue)
+ protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, BaseGrid baseGrid, int baseIndex)
{
var relatedColumn = yData.GetRelatedColumn(AuxiliaryType.ArithmeticStdDev);
- var stdDev = yDimension.BaseUnitValueToUnitValue(yUnit, relatedColumn.GetValue(baseValue));
+ var stdDev = yDimension.BaseUnitValueToUnitValue(yUnit, ValueInBaseUnit(relatedColumn, baseGrid, baseIndex));
if (!IsValidValue(stdDev))
stdDev = 0;
diff --git a/src/OSPSuite.UI/Binders/CurveBinder.cs b/src/OSPSuite.UI/Binders/CurveBinder.cs
index fde06bfdd..4bfafdcec 100644
--- a/src/OSPSuite.UI/Binders/CurveBinder.cs
+++ b/src/OSPSuite.UI/Binders/CurveBinder.cs
@@ -319,25 +319,25 @@ private void refreshData()
// works for different base grids
_dataTable.BeginLoadData();
- foreach (var baseValue in baseGrid.Values)
+ baseGrid.Values.Each((baseValue, baseIndex) =>
{
try
{
- double x = xDimension.BaseUnitValueToUnitValue(xUnit, xData.GetValue(baseValue));
- double y = yDimension.BaseUnitValueToUnitValue(yUnit, yData.GetValue(baseValue));
+ double x = xDimension.BaseUnitValueToUnitValue(xUnit, ValueInBaseUnit(xData, baseGrid, baseIndex));
+ double y = yDimension.BaseUnitValueToUnitValue(yUnit, ValueInBaseUnit(yData, baseGrid, baseIndex));
if (!isValidXValue(x) || !IsValidYValue(y))
- continue;
+ return;
var row = _dataTable.NewRow();
row[X] = x;
row[Y] = y;
- row[INDEX_OF_VALUE_IN_CURVE] = baseGrid.IndexOf(baseValue);
+ row[INDEX_OF_VALUE_IN_CURVE] = baseIndex;
if (HasLLOQ)
row[LLOQ_SUFFIX] = LLOQ;
- AddRelatedValuesToRow(row, yData, yDimension, yUnit, y, baseValue);
+ AddRelatedValuesToRow(row, yData, yDimension, yUnit, y, baseGrid, baseIndex);
_dataTable.Rows.Add(row);
}
@@ -345,8 +345,7 @@ private void refreshData()
{
//can happen when plotting X vs Y and using different base grid
}
- }
-
+ });
if (_xAxis.NumberMode == NumberModes.Relative)
setRelativeValues(X);
@@ -356,7 +355,19 @@ private void refreshData()
_dataTable.EndLoadData();
}
- protected abstract bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, float baseValue);
+ ///
+ /// If the BaseGrid is the same as then return the value
+ /// of at . Otherwise interpolate from the at
+ ///
+ protected static float ValueInBaseUnit(DataColumn dataColumn, BaseGrid baseGrid, int baseGridIndex)
+ {
+ if (baseGrid == dataColumn.BaseGrid)
+ return dataColumn.Values[baseGridIndex];
+
+ return dataColumn.GetValue(baseGrid[baseGridIndex]);
+ }
+
+ protected abstract bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, BaseGrid baseGrid, int baseIndex);
private BaseGrid activeBaseGrid(DataColumn xData, DataColumn yData)
{
diff --git a/src/OSPSuite.UI/Binders/GeometricMeanAreaCurveBinder.cs b/src/OSPSuite.UI/Binders/GeometricMeanAreaCurveBinder.cs
index 8228902e6..cf8b22333 100644
--- a/src/OSPSuite.UI/Binders/GeometricMeanAreaCurveBinder.cs
+++ b/src/OSPSuite.UI/Binders/GeometricMeanAreaCurveBinder.cs
@@ -15,9 +15,9 @@ public GeometricMeanAreaCurveBinder(Curve curve, ChartControl chartControl, Curv
{
}
- protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, float baseValue)
+ protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, BaseGrid baseGrid, int baseIndex)
{
- var stdDev = Curve.yData.GetValue(baseValue);
+ var stdDev = ValueInBaseUnit(Curve.yData, baseGrid, baseIndex);
if (!IsValidValue(stdDev) || stdDev == 0)
stdDev = 1;
diff --git a/src/OSPSuite.UI/Binders/GeometricStdCurveBinder.cs b/src/OSPSuite.UI/Binders/GeometricStdCurveBinder.cs
index 6395a4268..48e32ddfa 100644
--- a/src/OSPSuite.UI/Binders/GeometricStdCurveBinder.cs
+++ b/src/OSPSuite.UI/Binders/GeometricStdCurveBinder.cs
@@ -14,10 +14,10 @@ public GeometricStdCurveBinder(Curve curve, ChartControl chartControl, CurveChar
{
}
- protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, float baseValue)
+ protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, BaseGrid baseGrid, int baseIndex)
{
var relatedColumn = yData.GetRelatedColumn(AuxiliaryType.GeometricStdDev);
- var stdDev = relatedColumn.GetValue(baseValue);
+ var stdDev = ValueInBaseUnit(relatedColumn, baseGrid, baseIndex);
if (!IsValidValue(stdDev) || stdDev == 0)
stdDev = 1;
diff --git a/src/OSPSuite.UI/Binders/SingleValueCurveBinder.cs b/src/OSPSuite.UI/Binders/SingleValueCurveBinder.cs
index 53d868a3d..ca22274e4 100644
--- a/src/OSPSuite.UI/Binders/SingleValueCurveBinder.cs
+++ b/src/OSPSuite.UI/Binders/SingleValueCurveBinder.cs
@@ -3,6 +3,7 @@
using DevExpress.XtraCharts;
using OSPSuite.Core.Chart;
using OSPSuite.Core.Chart.Mappers;
+using OSPSuite.Core.Domain.Data;
using OSPSuite.Core.Domain.UnitSystem;
using DataColumn = OSPSuite.Core.Domain.Data.DataColumn;
@@ -22,7 +23,7 @@ protected override void RefreshSeries()
UpdateLineSeries(_lineSeries);
}
- protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, float baseValue)
+ protected override bool AddRelatedValuesToRow(DataRow row, DataColumn yData, IDimension yDimension, Unit yUnit, double y, BaseGrid baseGrid, int baseIndex)
{
//no related values here
return true;
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationOutputMappingView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationOutputMappingView.cs
index 4eb196ff4..7341ed17f 100644
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationOutputMappingView.cs
+++ b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationOutputMappingView.cs
@@ -1,10 +1,10 @@
using System.Collections.Generic;
-using OSPSuite.DataBinding.DevExpress;
-using OSPSuite.DataBinding.DevExpress.XtraGrid;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Views.Base;
using OSPSuite.Assets;
using OSPSuite.Core.Domain.Data;
+using OSPSuite.DataBinding.DevExpress;
+using OSPSuite.DataBinding.DevExpress.XtraGrid;
using OSPSuite.Presentation.DTO.ParameterIdentifications;
using OSPSuite.Presentation.Presenters.ParameterIdentifications;
using OSPSuite.Presentation.Views.ParameterIdentifications;
@@ -42,6 +42,7 @@ public void AttachPresenter(IParameterIdentificationOutputMappingPresenter prese
public void BindTo(IEnumerable outputMappingList)
{
_gridViewBinder.BindToSource(outputMappingList);
+ selectFocusedElement();
}
public override void InitializeBinding()
@@ -77,30 +78,35 @@ public override void InitializeBinding()
_gridViewBinder.Changed += NotifyViewChanged;
btnAddOutput.Click += (o, e) => OnEvent(_presenter.AddOutputMapping);
- _removeButtonRepository.ButtonClick += (o, e) => OnEvent(() => _presenter.RemoveOutputMapping(_gridViewBinder.FocusedElement));
+ _removeButtonRepository.ButtonClick += (o, e) => OnEvent(removeMapping);
gridView.FocusedRowChanged += (o, e) => OnEvent(gridViewRowChanged, e);
+ }
+ private void removeMapping()
+ {
+ _presenter.RemoveOutputMapping(_gridViewBinder.FocusedElement);
+ // The focused element could have changed after removing the mapping
+ selectFocusedElement();
}
private IFormatter observedDataDisplay(OutputMappingDTO outputMappingDTO) => new WeightedObservedDataFormatter(outputMappingDTO);
- private void gridViewRowChanged(FocusedRowChangedEventArgs e)
+ private void gridViewRowChanged(FocusedRowChangedEventArgs e) => selectFocusedElement();
+
+ private void selectFocusedElement() => selectItem(_gridViewBinder.FocusedElement);
+
+ private void selectItem(OutputMappingDTO selectedItem)
{
- var selectedItem = _gridViewBinder.ElementAt(e.FocusedRowHandle);
- if (selectedItem == null) return;
+ if (selectedItem == null)
+ return;
+
_presenter.Select(selectedItem);
}
- private RepositoryItem allOutputsRepository(OutputMappingDTO dto)
- {
- return RepositoryItemFor(_presenter.AllAvailableOutputs, _outputRepository);
- }
+ private RepositoryItem allOutputsRepository(OutputMappingDTO dto) => RepositoryItemFor(_presenter.AllAvailableOutputs, _outputRepository);
- private RepositoryItem allObservedDataRepository(OutputMappingDTO dto)
- {
- return RepositoryItemFor(_presenter.AllObservedDataFor(dto), _observedDataRepository);
- }
+ private RepositoryItem allObservedDataRepository(OutputMappingDTO dto) => RepositoryItemFor(_presenter.AllObservedDataFor(dto), _observedDataRepository);
protected RepositoryItem RepositoryItemFor(IEnumerable allItems, UxRepositoryItemComboBox listRepositoryItems)
{
@@ -118,9 +124,6 @@ public override void InitializeResources()
public override bool HasError => _gridViewBinder.HasError;
- public void CloseEditor()
- {
- gridView.CloseEditor();
- }
+ public void CloseEditor() => gridView.CloseEditor();
}
}
\ No newline at end of file
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.Designer.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.Designer.cs
deleted file mode 100644
index 8e0b602dd..000000000
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.Designer.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-namespace OSPSuite.UI.Views.ParameterIdentifications
-{
- partial class ParameterIdentificationWeightedObservedDataCollectorView
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.TabControl = new DevExpress.XtraTab.XtraTabControl();
- ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.TabControl)).BeginInit();
- this.SuspendLayout();
- //
- // tabObservedData
- //
- this.TabControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.TabControl.Location = new System.Drawing.Point(0, 0);
- this.TabControl.Name = "TabControl";
- this.TabControl.Size = new System.Drawing.Size(436, 415);
- this.TabControl.TabIndex = 0;
- //
- // ParameterIdentificationWeightedObservedDataCollectorView
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.TabControl);
- this.Name = "ParameterIdentificationWeightedObservedDataCollectorView";
- this.Size = new System.Drawing.Size(436, 415);
- ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.TabControl)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
- }
-}
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.cs
deleted file mode 100644
index 0a3911d4d..000000000
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System.Linq;
-using DevExpress.Utils;
-using DevExpress.XtraTab;
-using OSPSuite.Presentation.Presenters.ParameterIdentifications;
-using OSPSuite.Presentation.Views;
-using OSPSuite.Presentation.Views.ParameterIdentifications;
-using OSPSuite.UI.Controls;
-using OSPSuite.UI.Extensions;
-
-namespace OSPSuite.UI.Views.ParameterIdentifications
-{
- public partial class ParameterIdentificationWeightedObservedDataCollectorView : BaseUserControl, IParameterIdentificationWeightedObservedDataCollectorView, ITabbedView
- {
- private IParameterIdentificationWeightedObservedDataCollectorPresenter _presenter;
- public bool Updating { get; protected set; }
-
- public ParameterIdentificationWeightedObservedDataCollectorView()
- {
- InitializeComponent();
- }
-
- public void AttachPresenter(IParameterIdentificationWeightedObservedDataCollectorPresenter presenter)
- {
- _presenter = presenter;
- TabControl.SelectedPageChanging += onSelectedPageChanging;
- }
-
- private void onSelectedPageChanging(object sender, TabPageChangingEventArgs e)
- {
- OnEvent(() => _presenter.ObservedDataViewSelected(e.Page.Tag as IView));
- }
-
- public void AddObservedDataView(IView view)
- {
- try
- {
- TabControl.SelectedPageChanging -= onSelectedPageChanging;
- var page = this.AddTabbedView(TabControl.TabPages.Count, view);
- page.Tag = view;
- page.ShowCloseButton = DefaultBoolean.False;
- }
- finally
- {
- TabControl.SelectedPageChanging += onSelectedPageChanging;
- }
- }
-
- public void RemoveObservedDataView(IView view)
- {
- var tab = pageFor(view);
- removeTab(tab);
- }
-
- private XtraTabPage pageFor(IView view)
- {
- return TabControl.TabPages.FirstOrDefault(x => Equals(x.Tag, view));
- }
-
- public void SelectObservedDataView(IView view)
- {
- var page = pageFor(view);
- selectPage(page);
- }
-
- public void Clear()
- {
- TabControl.TabPages.Clear();
- }
-
- private void selectPage(XtraTabPage page)
- {
- if (page == null) return;
- TabControl.SelectedTabPage = page;
- }
-
- private void removeTab(XtraTabPage page)
- {
- if (page == null) return;
- TabControl.TabPages.Remove(page);
- }
-
- public void BeginUpdate()
- {
- TabControl.BeginUpdate();
- Updating = true;
- }
-
- public void EndUpdate()
- {
- TabControl.EndUpdate();
- Updating = false;
- }
-
- public XtraTabControl TabControl { get; private set; }
-
- }
-}
\ No newline at end of file
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.resx b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.resx
deleted file mode 100644
index b38e0ff0c..000000000
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataCollectorView.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
\ No newline at end of file
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.Designer.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.Designer.cs
index a391065c7..d750d16ff 100644
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.Designer.cs
+++ b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.Designer.cs
@@ -30,7 +30,7 @@ protected override void Dispose(bool disposing)
///
private void InitializeComponent()
{
- this.layoutControl = new UxLayoutControl();
+ this.layoutControl = new OSPSuite.UI.Controls.UxLayoutControl();
this.panelChart = new DevExpress.XtraEditors.PanelControl();
this.panelData = new DevExpress.XtraEditors.PanelControl();
this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup();
@@ -50,6 +50,7 @@ private void InitializeComponent()
//
// layoutControl
//
+ this.layoutControl.AllowCustomization = false;
this.layoutControl.Controls.Add(this.panelChart);
this.layoutControl.Controls.Add(this.panelData);
this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -63,55 +64,52 @@ private void InitializeComponent()
//
// panelChart
//
- this.panelChart.Location = new System.Drawing.Point(12, 267);
+ this.panelChart.Location = new System.Drawing.Point(12, 284);
this.panelChart.Name = "panelChart";
- this.panelChart.Size = new System.Drawing.Size(857, 327);
+ this.panelChart.Size = new System.Drawing.Size(857, 310);
this.panelChart.TabIndex = 5;
//
// panelData
//
- this.panelData.Location = new System.Drawing.Point(12, 12);
+ this.panelData.Location = new System.Drawing.Point(12, 33);
this.panelData.Name = "panelData";
- this.panelData.Size = new System.Drawing.Size(857, 246);
+ this.panelData.Size = new System.Drawing.Size(857, 237);
this.panelData.TabIndex = 4;
//
// layoutControlGroup
//
this.layoutControlGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
- this.layoutControlGroup.GroupBordersVisible = false;
this.layoutControlGroup.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutPanelChart,
this.layoutPanelData,
this.splitterItem1});
- this.layoutControlGroup.Location = new System.Drawing.Point(0, 0);
this.layoutControlGroup.Name = "Root";
this.layoutControlGroup.Size = new System.Drawing.Size(881, 606);
- this.layoutControlGroup.TextVisible = false;
//
// layoutPanelChart
//
this.layoutPanelChart.Control = this.panelData;
this.layoutPanelChart.Location = new System.Drawing.Point(0, 0);
this.layoutPanelChart.Name = "layoutPanelChart";
- this.layoutPanelChart.Size = new System.Drawing.Size(861, 250);
+ this.layoutPanelChart.Size = new System.Drawing.Size(861, 241);
this.layoutPanelChart.TextSize = new System.Drawing.Size(0, 0);
this.layoutPanelChart.TextVisible = false;
//
// layoutPanelData
//
this.layoutPanelData.Control = this.panelChart;
- this.layoutPanelData.Location = new System.Drawing.Point(0, 255);
+ this.layoutPanelData.Location = new System.Drawing.Point(0, 251);
this.layoutPanelData.Name = "layoutPanelData";
- this.layoutPanelData.Size = new System.Drawing.Size(861, 331);
+ this.layoutPanelData.Size = new System.Drawing.Size(861, 314);
this.layoutPanelData.TextSize = new System.Drawing.Size(0, 0);
this.layoutPanelData.TextVisible = false;
//
// splitterItem1
//
this.splitterItem1.AllowHotTrack = true;
- this.splitterItem1.Location = new System.Drawing.Point(0, 250);
+ this.splitterItem1.Location = new System.Drawing.Point(0, 241);
this.splitterItem1.Name = "splitterItem1";
- this.splitterItem1.Size = new System.Drawing.Size(861, 5);
+ this.splitterItem1.Size = new System.Drawing.Size(861, 10);
//
// ParameterIdentificationWeightedObservedDataView
//
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.cs
index f4fa895c8..088c60304 100644
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.cs
+++ b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationWeightedObservedDataView.cs
@@ -1,4 +1,5 @@
-using OSPSuite.Assets;
+using DevExpress.Utils;
+using OSPSuite.Assets;
using OSPSuite.Presentation.Presenters.ParameterIdentifications;
using OSPSuite.Presentation.Views;
using OSPSuite.Presentation.Views.ParameterIdentifications;
@@ -17,22 +18,20 @@ public ParameterIdentificationWeightedObservedDataView()
InitializeComponent();
layoutControl.Resize += (o, e) => OnEvent(layoutControlResized);
- VisibleChanged+= (o, e) =>OnEvent(ResizeView);
+ VisibleChanged += (o, e) => OnEvent(ResizeView);
}
- public void AttachPresenter(IParameterIdentificationWeightedObservedDataPresenter presenter)
- {
- _presenter = presenter;
- }
+ public void AttachPresenter(IParameterIdentificationWeightedObservedDataPresenter presenter) => _presenter = presenter;
- public void AddDataView(IView view)
- {
- panelData.FillWith(view);
- }
+ public void AddDataView(IView view) => panelData.FillWith(view);
- public void AddChartView(IView view)
+ public void AddChartView(IView view) => panelChart.FillWith(view);
+
+ public void SetTitle(string displayName)
{
- panelChart.FillWith(view);
+ layoutControlGroup.TextVisible = true;
+ layoutControlGroup.TextLocation = Locations.Top;
+ layoutControlGroup.Text = displayName;
}
public void ResizeView()
@@ -41,9 +40,6 @@ public void ResizeView()
layoutControl.Refresh();
}
- private void layoutControlResized()
- {
- ResizeView();
- }
+ private void layoutControlResized() => ResizeView();
}
}
\ No newline at end of file
diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs
index 8a01ec325..01bdf317d 100644
--- a/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs
+++ b/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs
@@ -4,7 +4,6 @@
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
-using DevExpress.XtraLayout.Utils;
using OSPSuite.Assets;
using OSPSuite.Presentation.Presenters.ParameterIdentifications;
using OSPSuite.Presentation.Views.ParameterIdentifications;
@@ -38,10 +37,7 @@ private void validateEditor(BaseContainerValidateEditorEventArgs e)
e.ErrorText = validationMessages.First();
}
- private void gridViewOnCellValueChanged(CellValueChangedEventArgs e)
- {
- _presenter.ChangeWeight(gridView.GetDataSourceRowIndex(e.RowHandle), e.Value.ConvertedTo());
- }
+ private void gridViewOnCellValueChanged(CellValueChangedEventArgs e) => _presenter.ChangeWeight(gridView.GetDataSourceRowIndex(e.RowHandle), e.Value.ConvertedTo());
public override void InitializeResources()
{
@@ -56,10 +52,7 @@ public override void BindTo(DataTable dataTable)
disableRepositoryColumns();
}
- public void DisplayColumnReadOnly(DataColumn column)
- {
- displayColumnReadOnly(column);
- }
+ public void DisplayColumnReadOnly(DataColumn column) => displayColumnReadOnly(column);
public void SelectRow(int rowIndex)
{
@@ -67,10 +60,9 @@ public void SelectRow(int rowIndex)
gridView.FocusedRowHandle = gridView.GetRowHandle(rowIndex);
}
- private void disableRepositoryColumns()
- {
- _presenter.DisableRepositoryColumns();
- }
+ public void Clear() => gridControl.DataSource = null;
+
+ private void disableRepositoryColumns() => _presenter.DisableRepositoryColumns();
private void displayColumnReadOnly(DataColumn column)
{
@@ -82,9 +74,6 @@ private void displayColumnReadOnly(DataColumn column)
gridViewColumn.AppearanceCell.BackColor = Colors.Disabled;
}
- private GridColumn gridViewColumnFromDataColumn(DataColumn column)
- {
- return gridView.Columns[column.ColumnName];
- }
+ private GridColumn gridViewColumnFromDataColumn(DataColumn column) => gridView.Columns[column.ColumnName];
}
}
\ No newline at end of file
diff --git a/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs
index b92b12176..1f2d421a9 100644
--- a/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs
+++ b/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs
@@ -3,6 +3,7 @@
using OSPSuite.BDDHelper;
using OSPSuite.BDDHelper.Extensions;
using OSPSuite.Core.Domain.Formulas;
+using OSPSuite.Core.Domain.ParameterIdentifications;
using OSPSuite.Core.Domain.Services;
using OSPSuite.Core.Domain.UnitSystem;
using OSPSuite.Helpers;
@@ -59,6 +60,22 @@ private IContainer createEntityToClone()
}
}
+ public class When_cloning_a_with_changes_object_that_does_not_have_changes : concern_for_CloneManagerForModel
+ {
+ private IWithHasChanged _clonedObject;
+
+ protected override void Because()
+ {
+ _clonedObject = sut.Clone(new ParameterIdentification());
+ }
+
+ [Observation]
+ public void should_return_a_cloned_object()
+ {
+ _clonedObject.HasChanged.ShouldBeTrue();
+ }
+ }
+
public class When_asked_to_clone_an_object : concern_for_CloneManagerForModel
{
[Observation]
diff --git a/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs b/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs
index f3dd2c522..5b68eccc2 100644
--- a/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs
+++ b/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs
@@ -6,6 +6,7 @@
using OSPSuite.Core.Domain.Builder;
using OSPSuite.Core.Domain.Descriptors;
using OSPSuite.Core.Domain.Formulas;
+using OSPSuite.Core.Domain.ParameterIdentifications;
using OSPSuite.Core.Domain.Services;
using OSPSuite.Core.Domain.UnitSystem;
@@ -1174,6 +1175,9 @@ public T CreateObjectBaseFrom(T sourceObject)
if (sourceObject.IsAnImplementationOf())
return new NormalDistributionFormula().WithDimension(_dimensionFactory.NoDimension).WithId(id).DowncastTo();
+ if(sourceObject.IsAnImplementationOf())
+ return new ParameterIdentification().WithId(id).DowncastTo();
+
return default(T);
}
diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationDataSelectionPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationDataSelectionPresenterSpecs.cs
index 599c1f02d..98c6b1a93 100644
--- a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationDataSelectionPresenterSpecs.cs
+++ b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationDataSelectionPresenterSpecs.cs
@@ -16,15 +16,15 @@ public abstract class concern_for_ParameterIdentificationDataSelectionPresenter
protected ParameterIdentification _parameterIdentification;
protected ISimulation _simulation;
protected IParameterIdentificationOutputMappingPresenter _outputMappingPresenter;
- protected IParameterIdentificationWeightedObservedDataCollectorPresenter _weightedObservedDataCollectorPresenter;
+ protected IParameterIdentificationWeightedObservedDataPresenter _weightedObservedDataPresenter;
protected override void Context()
{
_view = A.Fake();
_simulationSelectionPresenter = A.Fake();
_outputMappingPresenter = A.Fake();
- _weightedObservedDataCollectorPresenter= A.Fake();
- sut = new ParameterIdentificationDataSelectionPresenter(_view, _simulationSelectionPresenter, _outputMappingPresenter, _weightedObservedDataCollectorPresenter);
+ _weightedObservedDataPresenter= A.Fake();
+ sut = new ParameterIdentificationDataSelectionPresenter(_view, _simulationSelectionPresenter, _outputMappingPresenter, _weightedObservedDataPresenter);
_simulation = A.Fake().WithId("Sim");
_parameterIdentification = new ParameterIdentification();
@@ -47,12 +47,6 @@ public void should_initialize_the_output_mapping_presenter_with_the_parameter_id
{
A.CallTo(() => _outputMappingPresenter.EditParameterIdentification(_parameterIdentification)).MustHaveHappened();
}
-
- [Observation]
- public void should_initialize_the_weighted_observed_data_collector_presenter_with_the_parameter_identification()
- {
- A.CallTo(() => _weightedObservedDataCollectorPresenter.EditParameterIdentification(_parameterIdentification)).MustHaveHappened();
- }
}
public class When_the_parameter_identification_data_presenter_is_being_notified_that_a_simulation_was_added_to_the_parameter_identification : concern_for_ParameterIdentificationDataSelectionPresenter
@@ -67,12 +61,6 @@ public void should_refresh_the_output_mapping()
{
A.CallTo(() => _outputMappingPresenter.Refresh()).MustHaveHappened();
}
-
- [Observation]
- public void should_refresh_the_simulation_selection_presenter()
- {
- A.CallTo(() => _weightedObservedDataCollectorPresenter.Refresh()).MustHaveHappened();
- }
}
public class When_the_parameter_identification_data_presenter_is_notified_that_a_weighted_observed_data_was_selected : concern_for_ParameterIdentificationDataSelectionPresenter
@@ -93,7 +81,7 @@ protected override void Because()
[Observation]
public void should_select_the_corresponding_observed_data()
{
- A.CallTo(() => _weightedObservedDataCollectorPresenter.SelectObservedData(_weightedObservedData)).MustHaveHappened();
+ A.CallTo(() => _weightedObservedDataPresenter.Edit(_weightedObservedData)).MustHaveHappened();
}
}
@@ -104,12 +92,6 @@ protected override void Because()
sut.Handle(new SimulationReplacedInParameterAnalyzableEvent(_parameterIdentification, _simulation, A.Fake()));
}
- [Observation]
- public void should_refresh_the_observed_data_presenter()
- {
- A.CallTo(() => _weightedObservedDataCollectorPresenter.Refresh()).MustHaveHappened();
- }
-
[Observation]
public void should_refresh_the_simulation_selection_presenter()
{
@@ -130,12 +112,6 @@ protected override void Because()
sut.Handle(new SimulationRemovedEvent(_simulation));
}
- [Observation]
- public void should_refresh_the_observed_data_presenter()
- {
- A.CallTo(() => _weightedObservedDataCollectorPresenter.Refresh()).MustHaveHappened();
- }
-
[Observation]
public void should_refresh_the_simulation_selection_presenter()
{
diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationWeightedObservedDataCollectorPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationWeightedObservedDataCollectorPresenterSpecs.cs
deleted file mode 100644
index ec5873078..000000000
--- a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationWeightedObservedDataCollectorPresenterSpecs.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-using FakeItEasy;
-using OSPSuite.BDDHelper;
-using OSPSuite.Core.Domain;
-using OSPSuite.Core.Domain.ParameterIdentifications;
-using OSPSuite.Helpers;
-using OSPSuite.Presentation.Core;
-using OSPSuite.Presentation.Presenters.ParameterIdentifications;
-using OSPSuite.Presentation.Views.ParameterIdentifications;
-using OSPSuite.Utility.Events;
-
-namespace OSPSuite.Presentation.Presentation
-{
- public abstract class concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter : ContextSpecification
- {
- protected IEventPublisher _eventPublisher;
- protected IParameterIdentificationWeightedObservedDataCollectorView _view;
- protected IApplicationController _applicationController;
- protected ParameterIdentification _parameterIdentification;
- protected OutputMapping _outputMapping;
- protected WeightedObservedData _weightedObservedData;
- protected IParameterIdentificationWeightedObservedDataPresenter _presenter;
-
- protected override void Context()
- {
- _eventPublisher = A.Fake();
- _view = A.Fake();
- _applicationController = A.Fake();
- sut = new ParameterIdentificationWeightedObservedDataCollectorPresenter(_view, _applicationController, _eventPublisher);
-
- _parameterIdentification = new ParameterIdentification();
- _weightedObservedData = new WeightedObservedData(DomainHelperForSpecs.ObservedData());
- _outputMapping = new OutputMapping {WeightedObservedData = _weightedObservedData};
- _parameterIdentification.AddOutputMapping(_outputMapping);
-
- _presenter = A.Fake();
- A.CallTo(() => _applicationController.Start()).Returns(_presenter);
- }
- }
-
- public class When_the_weighted_observed_data_collector_presenter_is_edtiting_a_parameter_identification : concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- protected override void Because()
- {
- sut.EditParameterIdentification(_parameterIdentification);
- }
-
- [Observation]
- public void should_add_a_sub_view_for_each_mapped_observed_data()
- {
- A.CallTo(() => _view.AddObservedDataView(_presenter.View)).MustHaveHappened();
- }
-
- [Observation]
- public void should_edit_the_weighted_observed_data()
- {
- A.CallTo(() => _presenter.Edit(_weightedObservedData)).MustHaveHappened();
- }
- }
-
- public class When_the_weighted_observed_data_collector_presenter_is_editing_a_parmaeter_identification_with_an_output_using_an_invalid_weighted_observed_data : concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- protected override void Context()
- {
- base.Context();
-#pragma warning disable 618
- _weightedObservedData = new WeightedObservedData();
-#pragma warning restore 618
- _outputMapping.WeightedObservedData = _weightedObservedData;
- }
-
- protected override void Because()
- {
- sut.EditParameterIdentification(_parameterIdentification);
- }
-
- [Observation]
- public void should_not_add_a_view_for_this_observed_data()
- {
- A.CallTo(() => _presenter.Edit(_weightedObservedData)).MustNotHaveHappened();
- }
- }
-
- public class When_the_weighted_observed_data_collector_presenter_is_told_to_remove_some_observed_data_from_its_view : concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- protected override void Context()
- {
- base.Context();
- sut.EditParameterIdentification(_parameterIdentification);
- }
-
- protected override void Because()
- {
- sut.RemoveObservedData(_weightedObservedData);
- }
-
- [Observation]
- public void should_remove_the_underlying_presenter_from_the_view()
- {
- A.CallTo(() => _view.RemoveObservedDataView(_presenter.View)).MustHaveHappened();
- }
-
- [Observation]
- public void should_release_the_presenter_from_the_event_publisher()
- {
- A.CallTo(() => _presenter.ReleaseFrom(_eventPublisher)).MustHaveHappened();
- }
- }
-
- public class When_the_observed_data_collector_is_told_that_a_view_displayed_weighted_observed_data_was_selected : concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- protected override void Context()
- {
- base.Context();
- sut.EditParameterIdentification(_parameterIdentification);
- }
-
- protected override void Because()
- {
- sut.ObservedDataViewSelected(_presenter.View);
- }
-
- [Observation]
- public void should_edit_the_corresponding_presenter()
- {
- A.CallTo(() => _presenter.Edit(_weightedObservedData)).MustHaveHappened();
- }
- }
-
- public class When_the_weighted_observed_data_collector_presenter_is_told_to_select_some_given_weighted_observed_data : concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- protected override void Context()
- {
- base.Context();
- sut.EditParameterIdentification(_parameterIdentification);
- }
-
- protected override void Because()
- {
- sut.SelectObservedData(_weightedObservedData);
- }
-
- [Observation]
- public void should_activate_the_view_registered_for_those_observed_data()
- {
- A.CallTo(() => _view.SelectObservedDataView(_presenter.View)).MustHaveHappened();
- }
-
- [Observation]
- public void should_edit_the_corresponding_presenter()
- {
- A.CallTo(() => _presenter.Edit(_weightedObservedData)).MustHaveHappened();
- }
- }
-
- public class When_the_weighted_observed_data_presenter_is_being_released : concern_for_ParameterIdentificationWeightedObservedDataCollectorPresenter
- {
- protected override void Context()
- {
- base.Context();
- sut.EditParameterIdentification(_parameterIdentification);
- }
-
- protected override void Because()
- {
- sut.ReleaseFrom(_eventPublisher);
- }
-
- [Observation]
- public void should_also_release_all_sub_presenters()
- {
- A.CallTo(() => _presenter.ReleaseFrom(_eventPublisher)).MustHaveHappened();
- }
- }
-}
\ No newline at end of file
diff --git a/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs
index efdef3f2e..833ff5336 100644
--- a/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs
+++ b/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs
@@ -168,6 +168,7 @@ public void should_return_the_matching_parameters()
sut.AllParametersMatching(_organism, Constants.WILD_CARD_RECURSIVE).ShouldOnlyContain(_organism.GetAllChildren());
sut.AllParametersMatching(_liver, Constants.WILD_CARD_RECURSIVE).ShouldOnlyContain(_liver.GetAllChildren());
sut.AllParametersMatching(_organism, Constants.WILD_CARD).ShouldOnlyContain(_organism.GetChildren());
+ sut.AllParametersMatching(_organism, pathFrom(Constants.WILD_CARD_RECURSIVE)).ShouldOnlyContain(_organism.GetAllChildren());
}
}