Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; @@ -44,12 +45,20 @@ private IFailureMechanism failureMechanism; /// + /// Creates a display object for which is added to the + /// on the . + /// + /// The for which to create a + /// display object. + /// A display object which can be added as a row to the . + protected abstract object CreateFailureMechanismSectionResultRow(T sectionResult); + + /// /// Creates a new instance of . /// protected FailureMechanismResultView() { InitializeComponent(); - InitializeDataGridView(); failureMechanismObserver = new Observer(UpdataDataGridViewDataSource); failureMechanismSectionResultObservers = new List(); @@ -118,17 +127,11 @@ } /// - /// Gets all the columns that should be added to the on the - /// . - /// - /// An of . - protected abstract void AddDataGridColumns(); - - /// /// Updates the data source of the data grid view with the current known failure mechanism section results. /// protected void UpdataDataGridViewDataSource() { + UpdateFailureMechanismSectionResultsObservers(); DataGridViewControl.EndEdit(); DataGridViewControl.SetDataSource(failureMechanismSectionResult.Select(CreateFailureMechanismSectionResultRow).ToList()); } @@ -143,29 +146,25 @@ return DataGridViewControl.GetRowFromIndex(rowIndex).DataBoundItem; } - /// - /// Creates a display object for which is added to the - /// on the . - /// - /// The for which to create a - /// display object. - /// A display object which can be added as a row to the . - protected abstract object CreateFailureMechanismSectionResultRow(T sectionResult); - private IEnumerable FailureMechanismSectionResult { set { - ClearSectionResultObservers(); failureMechanismSectionResult = value; - if (failureMechanismSectionResult != null) - { - AddSectionResultObservers(); - } + UpdateFailureMechanismSectionResultsObservers(); } } + private void UpdateFailureMechanismSectionResultsObservers() + { + ClearSectionResultObservers(); + if (failureMechanismSectionResult != null) + { + AddSectionResultObservers(); + } + } + private void AddSectionResultObservers() { foreach (var sectionResult in failureMechanismSectionResult) @@ -185,10 +184,5 @@ } failureMechanismSectionResultObservers.Clear(); } - - private void InitializeDataGridView() - { - AddDataGridColumns(); - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs =================================================================== diff -u -rf5a2d607a5b8053b232c1f3ad572a0acba6a4e3a -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision f5a2d607a5b8053b232c1f3ad572a0acba6a4e3a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -131,9 +131,6 @@ } public class TestFailureMechanismResultView : FailureMechanismResultView { - protected override void AddDataGridColumns() - { - } protected override object CreateFailureMechanismSectionResultRow(FailureMechanismSectionResult sectionResult) { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs =================================================================== diff -u -rf5a2d607a5b8053b232c1f3ad572a0acba6a4e3a -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision f5a2d607a5b8053b232c1f3ad572a0acba6a4e3a) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -54,6 +54,8 @@ calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); + + AddDataGridColumns(); } public override IFailureMechanism FailureMechanism @@ -82,7 +84,7 @@ base.Dispose(disposing); } - protected override void AddDataGridColumns() + private void AddDataGridColumns() { DataGridViewControl.AddTextBoxColumn( TypeUtils.GetMemberName(sr => sr.Name), Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs =================================================================== diff -u -r5150f97d1c5e019d39723b22ff200e48b2112e71 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision 5150f97d1c5e019d39723b22ff200e48b2112e71) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -53,6 +53,8 @@ calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); + + AddDataGridColumns(); } public override IFailureMechanism FailureMechanism @@ -81,7 +83,7 @@ base.Dispose(disposing); } - protected override void AddDataGridColumns() + private void AddDataGridColumns() { DataGridViewControl.AddTextBoxColumn( TypeUtils.GetMemberName(sr => sr.Name), Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -61,30 +61,90 @@ - UserControl AssessmentSectionView.cs - + UserControl - + + FailureMechanismContributionView.cs + + + + + + + + + + + + + + + + + + + + UserControl - + UserControl - - FailureMechanismContributionView.cs + + UserControl - - + UserControl - + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + + + UserControl + Fisheye: Tag ce8424c77c708edc0bb2150a9a6a0e75dad629fa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/ArbitraryProbabilityFailureMechanismResultView.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag ce8424c77c708edc0bb2150a9a6a0e75dad629fa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/ArbitraryProbabilityFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag ce8424c77c708edc0bb2150a9a6a0e75dad629fa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/NumericFailureMechanismResultView.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag ce8424c77c708edc0bb2150a9a6a0e75dad629fa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/NumericFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/ArbitraryProbabilityFailureMechanismSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/ArbitraryProbabilityFailureMechanismSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/ArbitraryProbabilityFailureMechanismSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,133 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Base.Properties; +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + /// + /// Container of a , which takes care of the + /// representation of properties in a grid. + /// + public class ArbitraryProbabilityFailureMechanismSectionResultRow + { + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// Throw when is + /// null. + public ArbitraryProbabilityFailureMechanismSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + SectionResult = sectionResult; + } + + /// + /// Gets the name of the failure mechanism section. + /// + public string Name + { + get + { + return SectionResult.Section.Name; + } + } + + /// + /// Gets or sets the value representing whether the section passed the layer 0 assessment. + /// + public bool AssessmentLayerOne + { + get + { + return SectionResult.AssessmentLayerOne; + } + set + { + SectionResult.AssessmentLayerOne = value; + SectionResult.NotifyObservers(); + } + } + + /// + /// Gets or sets the value representing the result of the layer 2a assessment. + /// + /// Thrown when is null. + /// Thrown when either: + /// + /// is not in the range [0,1]. + /// doesn't represent a value which can be parsed to a double value. + /// + /// + public string AssessmentLayerTwoA + { + get + { + var d = (RoundedDouble) (1/SectionResult.AssessmentLayerTwoA); + return string.Format(Resources.ProbabilityPerYearFormat, d); + } + set + { + if (value == null) + { + throw new ArgumentNullException("value",Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null); + } + try + { + SectionResult.AssessmentLayerTwoA = (RoundedDouble) double.Parse(value); + } + catch (OverflowException) + { + throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large); + } + catch (FormatException) + { + throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value); + } + } + } + + /// + /// Gets or sets the value representing the result of the layer 3 assessment. + /// + public RoundedDouble AssessmentLayerThree + { + get + { + return SectionResult.AssessmentLayerThree; + } + set + { + SectionResult.AssessmentLayerThree = value; + } + } + + private ArbitraryProbabilityFailureMechanismSectionResult SectionResult { get; set; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/ClosingStructureSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/ClosingStructureSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/ClosingStructureSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class ClosingStructureSectionResultRow : ArbitraryProbabilityFailureMechanismSectionResultRow + { + public ClosingStructureSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/DuneErosionSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/DuneErosionSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/DuneErosionSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class DuneErosionSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public DuneErosionSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverErosionOutwardsSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverErosionOutwardsSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverErosionOutwardsSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class GrassCoverErosionOutwardsSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public GrassCoverErosionOutwardsSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverSlipOffInwardsSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverSlipOffInwardsSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverSlipOffInwardsSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class GrassCoverSlipOffInwardsSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public GrassCoverSlipOffInwardsSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverSlipOffOutwardsSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverSlipOffOutwardsSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/GrassCoverSlipOffOutwardsSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class GrassCoverSlipOffOutwardsSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public GrassCoverSlipOffOutwardsSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MacrostabilityInwardsSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MacrostabilityInwardsSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MacrostabilityInwardsSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class MacrostabilityInwardsSectionResultRow : ArbitraryProbabilityFailureMechanismSectionResultRow + { + public MacrostabilityInwardsSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MacrostabilityOutwardsSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MacrostabilityOutwardsSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MacrostabilityOutwardsSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class MacrostabilityOutwardsSectionResultRow : ArbitraryProbabilityFailureMechanismSectionResultRow + { + public MacrostabilityOutwardsSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MicrostabilitySectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MicrostabilitySectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/MicrostabilitySectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class MicrostabilitySectionResultRow : SimpleFailureMechanismSectionResultRow + { + public MicrostabilitySectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/NumericFailureMechanismSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/NumericFailureMechanismSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/NumericFailureMechanismSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,109 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + /// + /// Container of a , which takes care of the + /// representation of properties in a grid. + /// + public class NumericFailureMechanismSectionResultRow + { + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// Throw when is + /// null. + public NumericFailureMechanismSectionResultRow(NumericFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + SectionResult = sectionResult; + } + + /// + /// Gets the name of the failure mechanism section. + /// + public string Name + { + get + { + return SectionResult.Section.Name; + } + } + + /// + /// Gets or sets the value representing whether the section passed the layer 0 assessment. + /// + public bool AssessmentLayerOne + { + get + { + return SectionResult.AssessmentLayerOne; + } + set + { + SectionResult.AssessmentLayerOne = value; + SectionResult.NotifyObservers(); + } + } + + /// + /// Gets or sets the value representing the result of the layer 2a assessment. + /// + public RoundedDouble AssessmentLayerTwoA + { + get + { + return SectionResult.AssessmentLayerTwoA; + } + set + { + SectionResult.AssessmentLayerTwoA = value; + } + } + + /// + /// Gets or sets the value representing the result of the layer 3 assessment. + /// + public RoundedDouble AssessmentLayerThree + { + get + { + return SectionResult.AssessmentLayerThree; + } + set + { + SectionResult.AssessmentLayerThree = value; + } + } + + private NumericFailureMechanismSectionResult SectionResult { get; set; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/PipingStructureSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/PipingStructureSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/PipingStructureSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class PipingStructureSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public PipingStructureSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/SimpleFailureMechanismSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/SimpleFailureMechanismSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/SimpleFailureMechanismSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,110 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + /// + /// Container of a , which takes care of the + /// representation of properties in a grid. + /// + public class SimpleFailureMechanismSectionResultRow + { + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// Throw when is + /// null. + public SimpleFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + SectionResult = sectionResult; + } + + /// + /// Gets the name of the failure mechanism section. + /// + public string Name + { + get + { + return SectionResult.Section.Name; + } + } + + /// + /// Gets or sets the value representing whether the section passed the layer 0 assessment. + /// + public bool AssessmentLayerOne + { + get + { + return SectionResult.AssessmentLayerOne; + } + set + { + SectionResult.AssessmentLayerOne = value; + SectionResult.NotifyObservers(); + } + } + + /// + /// Gets or sets the value representing the result of the layer 2a assessment. + /// + public AssessmentLayerTwoAResult AssessmentLayerTwoA + { + get + { + return SectionResult.AssessmentLayerTwoA; + } + set + { + SectionResult.AssessmentLayerTwoA = value; + } + } + + /// + /// Gets or sets the value representing the result of the layer 3 assessment. + /// + public RoundedDouble AssessmentLayerThree + { + get + { + return SectionResult.AssessmentLayerThree; + } + set + { + SectionResult.AssessmentLayerThree = value; + } + } + + private SimpleFailureMechanismSectionResult SectionResult { get; set; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StabilityStoneCoverSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StabilityStoneCoverSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StabilityStoneCoverSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class StabilityStoneCoverSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public StabilityStoneCoverSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StrengthStabilityLengthwiseConstructionSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StrengthStabilityLengthwiseConstructionSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StrengthStabilityLengthwiseConstructionSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class StrengthStabilityLengthwiseConstructionSectionResultRow : NumericFailureMechanismSectionResultRow + { + public StrengthStabilityLengthwiseConstructionSectionResultRow(NumericFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StrengthStabilityPointConstructionSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StrengthStabilityPointConstructionSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/StrengthStabilityPointConstructionSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class StrengthStabilityPointConstructionSectionResultRow : ArbitraryProbabilityFailureMechanismSectionResultRow + { + public StrengthStabilityPointConstructionSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/TechnicalInnovationSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/TechnicalInnovationSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/TechnicalInnovationSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class TechnicalInnovationSectionResultRow : SimpleFailureMechanismSectionResultRow + { + public TechnicalInnovationSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/WaterPressureAsphaltCoverSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/WaterPressureAsphaltCoverSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/WaterPressureAsphaltCoverSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class WaterPressureAsphaltCoverSectionResultRow : NumericFailureMechanismSectionResultRow + { + public WaterPressureAsphaltCoverSectionResultRow(NumericFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/WaveImpactAsphaltSectionResultRow.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/WaveImpactAsphaltSectionResultRow.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRow/WaveImpactAsphaltSectionResultRow.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,9 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; + +namespace Ringtoets.Integration.Forms.Views.SectionResultRow +{ + public class WaveImpactAsphaltSectionResultRow : NumericFailureMechanismSectionResultRow + { + public WaveImpactAsphaltSectionResultRow(NumericFailureMechanismSectionResult sectionResult) : base(sectionResult) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/ArbitraryProbabilityFailureMechanismResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/ArbitraryProbabilityFailureMechanismResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/ArbitraryProbabilityFailureMechanismResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,88 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Windows.Forms; +using Core.Common.Utils.Reflection; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + /// + /// This class defines a view where are displayed in a grid + /// and can be modified. + /// + public class ArbitraryProbabilityFailureMechanismResultView : FailureMechanismResultView + { + /// + /// Creates a new instance of + /// + public ArbitraryProbabilityFailureMechanismResultView() + { + DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + + AddDataGridColumns(); + } + + private void AddDataGridColumns() + { + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.Name), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Section_name, + true + ); + DataGridViewControl.AddCheckBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerOne), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_one + ); + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerTwoA), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_a + ); + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerThree), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_three + ); + } + + protected override object CreateFailureMechanismSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) + { + return new ArbitraryProbabilityFailureMechanismSectionResultRow(sectionResult); + } + + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) + { + if (eventArgs.ColumnIndex > 1) + { + if (HasPassedLevelOne(eventArgs.RowIndex)) + { + DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex); + } + else + { + DataGridViewControl.RestoreCell(eventArgs.RowIndex, eventArgs.ColumnIndex); + } + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/ClosingStructureResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/ClosingStructureResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/ClosingStructureResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class ClosingStructureResultView : ArbitraryProbabilityFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) + { + return new ArbitraryProbabilityFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/DuneErosionResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/DuneErosionResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/DuneErosionResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class DuneErosionResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverErosionOutwardsResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverErosionOutwardsResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverErosionOutwardsResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class GrassCoverErosionOutwardsResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverSlipOffInwardsResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverSlipOffInwardsResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverSlipOffInwardsResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class GrassCoverSlipOffInwardsResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverSlipOffOutwardsResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverSlipOffOutwardsResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/GrassCoverSlipOffOutwardsResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class GrassCoverSlipOffOutwardsResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MacrostabilityInwardsResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MacrostabilityInwardsResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MacrostabilityInwardsResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class MacrostabilityInwardsResultView : ArbitraryProbabilityFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) + { + return new ArbitraryProbabilityFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MacrostabilityOutwardsResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MacrostabilityOutwardsResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MacrostabilityOutwardsResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class MacrostabilityOutwardsResultView : ArbitraryProbabilityFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) + { + return new ArbitraryProbabilityFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MicrostabilityResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MicrostabilityResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/MicrostabilityResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class MicrostabilityResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/NumericFailureMechanismResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/NumericFailureMechanismResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/NumericFailureMechanismResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,95 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Windows.Forms; +using Core.Common.Utils.Reflection; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + /// + /// This class defines a view where are displayed in a grid + /// and can be modified. + /// + public class NumericFailureMechanismResultView : FailureMechanismResultView + { + /// + /// Creates a new instance of + /// + public NumericFailureMechanismResultView() + { + DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + + AddDataGridColumns(); + } + + private void AddDataGridColumns() + { + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.Name), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Section_name, + true + ); + DataGridViewControl.AddCheckBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerOne), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_one + ); + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerTwoA), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_a + ); + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerThree), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_three + ); + } + + protected override object CreateFailureMechanismSectionResultRow(NumericFailureMechanismSectionResult sectionResult) + { + return new NumericFailureMechanismSectionResultRow(sectionResult); + } + + protected override void Dispose(bool disposing) + { + DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + + base.Dispose(disposing); + } + + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) + { + if (eventArgs.ColumnIndex > 1) + { + if (HasPassedLevelOne(eventArgs.RowIndex)) + { + DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex); + } + else + { + DataGridViewControl.RestoreCell(eventArgs.RowIndex, eventArgs.ColumnIndex); + } + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/PipingStructureResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/PipingStructureResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/PipingStructureResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class PipingStructureResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/SimpleFailureMechanismResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/SimpleFailureMechanismResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/SimpleFailureMechanismResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,99 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Windows.Forms; +using Core.Common.Utils; +using Core.Common.Utils.Reflection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + /// + /// This class defines a view where are displayed in a grid + /// and can be modified. + /// + public class SimpleFailureMechanismResultView : FailureMechanismResultView + { + /// + /// Creates a new instance of + /// + public SimpleFailureMechanismResultView() + { + DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + + AddDataGridColumns(); + } + + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) + { + if (eventArgs.ColumnIndex > 1) + { + if (HasPassedLevelOne(eventArgs.RowIndex)) + { + DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex); + } + else + { + DataGridViewControl.RestoreCell(eventArgs.RowIndex, eventArgs.ColumnIndex); + } + } + } + + private void AddDataGridColumns() + { + var twoAResultDataSource = Enum.GetValues(typeof(AssessmentLayerTwoAResult)) + .OfType() + .Select(el => new EnumDisplayWrapper(el)) + .ToList(); + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.Name), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Section_name, + true + ); + DataGridViewControl.AddCheckBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerOne), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_one + ); + DataGridViewControl.AddComboBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerTwoA), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_a, + twoAResultDataSource, + TypeUtils.GetMemberName((Expression, object>>) (edw => edw.Value)), + TypeUtils.GetMemberName((Expression, object>>) (edw => edw.DisplayName))); + DataGridViewControl.AddTextBoxColumn( + TypeUtils.GetMemberName(sr => sr.AssessmentLayerThree), + RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_three + ); + } + + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StabilityStoneCoverResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StabilityStoneCoverResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StabilityStoneCoverResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class StabilityStoneCoverResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StrengthStabilityLengthwiseConstructionResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StrengthStabilityLengthwiseConstructionResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StrengthStabilityLengthwiseConstructionResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class StrengthStabilityLengthwiseConstructionResultView : NumericFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(NumericFailureMechanismSectionResult sectionResult) + { + return new NumericFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StrengthStabilityPointConstructionResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StrengthStabilityPointConstructionResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/StrengthStabilityPointConstructionResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class StrengthStabilityPointConstructionResultView : ArbitraryProbabilityFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(ArbitraryProbabilityFailureMechanismSectionResult sectionResult) + { + return new ArbitraryProbabilityFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/TechnicalInnovationResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/TechnicalInnovationResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/TechnicalInnovationResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class TechnicalInnovationResultView : SimpleFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(SimpleFailureMechanismSectionResult sectionResult) + { + return new SimpleFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/WaterPressureAsphaltResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/WaterPressureAsphaltResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/WaterPressureAsphaltResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class WaterPressureAsphaltResultView : NumericFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(NumericFailureMechanismSectionResult sectionResult) + { + return new NumericFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/WaveImpactAsphaltResultView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/WaveImpactAsphaltResultView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultView/WaveImpactAsphaltResultView.cs (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -0,0 +1,13 @@ +using Ringtoets.Integration.Data.StandAlone.SectionResult; +using Ringtoets.Integration.Forms.Views.SectionResultRow; + +namespace Ringtoets.Integration.Forms.Views.SectionResultView +{ + public class WaveImpactAsphaltResultView : NumericFailureMechanismResultView + { + protected override object CreateFailureMechanismSectionResultRow(NumericFailureMechanismSectionResult sectionResult) + { + return new NumericFailureMechanismSectionResultRow(sectionResult); + } + } +} \ No newline at end of file Fisheye: Tag ce8424c77c708edc0bb2150a9a6a0e75dad629fa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SimpleFailureMechanismResultView.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag ce8424c77c708edc0bb2150a9a6a0e75dad629fa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SimpleFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r7cfeb195650f713f29c53e9926499fa63e4c79ea -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 7cfeb195650f713f29c53e9926499fa63e4c79ea) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -28,6 +28,7 @@ using System.Windows.Forms; using Core.Common.Base.Data; using Core.Common.Controls.TreeView; +using Core.Common.Controls.Views; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; using Core.Common.Gui.Forms; @@ -59,6 +60,7 @@ using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; using Ringtoets.Integration.Plugin.FileImporters; using Ringtoets.Integration.Plugin.Properties; using Ringtoets.Piping.Data; @@ -145,7 +147,7 @@ { GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, - CloseForData = CloseSimpleFailureMechanismResultViewForData, + CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.SectionResults, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; @@ -157,7 +159,7 @@ { GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, - CloseForData = CloseNumericFailureMechanismResultViewForData, + CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.SectionResults, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; @@ -169,7 +171,7 @@ { GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, - CloseForData = CloseArbitraryProbabilityFailureMechanismResultViewForData, + CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.SectionResults, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; @@ -353,36 +355,19 @@ #region FailureMechanismResults ViewInfo - private static bool CloseSimpleFailureMechanismResultViewForData(SimpleFailureMechanismResultView view, object o) + private static bool CloseFailureMechanismResultViewForData(T view, object dataToCloseFor) where T : IView { - var data = view.Data; - return CloseFailureMechanismResultViewForData(o, data); - } + var viewData = view.Data; + var assessmentSection = dataToCloseFor as IAssessmentSection; + var failureMechanism = dataToCloseFor as IFailureMechanism; + var failureMechanismContext = dataToCloseFor as IFailureMechanismContext; - private static bool CloseNumericFailureMechanismResultViewForData(NumericFailureMechanismResultView view, object o) - { - var data = view.Data; - return CloseFailureMechanismResultViewForData(o, data); - } - - private static bool CloseArbitraryProbabilityFailureMechanismResultViewForData(ArbitraryProbabilityFailureMechanismResultView view, object o) - { - var data = view.Data; - return CloseFailureMechanismResultViewForData(o, data); - } - - private static bool CloseFailureMechanismResultViewForData(object o, object data) - { - var assessmentSection = o as IAssessmentSection; - var failureMechanism = o as IFailureMechanism; - var failureMechanismContext = o as IFailureMechanismContext; - if (assessmentSection != null) { return assessmentSection .GetFailureMechanisms() .OfType>() - .Any(fm => ReferenceEquals(data, fm.SectionResults)); + .Any(fm => ReferenceEquals(viewData, fm.SectionResults)); } if (failureMechanismContext != null) { @@ -393,7 +378,7 @@ return failureMechanism != null && failureMechanismWithSectionResults != null - && ReferenceEquals(data, failureMechanismWithSectionResults.SectionResults); + && ReferenceEquals(viewData, failureMechanismWithSectionResults.SectionResults); } #endregion Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/ArbitraryProbabilityFailureMechanismResultViewTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/ArbitraryProbabilityFailureMechanismResultViewTest.cs (.../ArbitraryProbabilityFailureMechanismResultViewTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/ArbitraryProbabilityFailureMechanismResultViewTest.cs (.../ArbitraryProbabilityFailureMechanismResultViewTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -30,8 +30,7 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; - +using Ringtoets.Integration.Forms.Views.SectionResultView; using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.Views { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/ArbitraryProbabilityFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/ArbitraryProbabilityFailureMechanismSectionResultRowTest.cs (.../ArbitraryProbabilityFailureMechanismSectionResultRowTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/ArbitraryProbabilityFailureMechanismSectionResultRowTest.cs (.../ArbitraryProbabilityFailureMechanismSectionResultRowTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -28,7 +28,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultRow; using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.Views Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs =================================================================== diff -u -r41fac7fff0a505c08945108d795dcb877f10b816 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision 41fac7fff0a505c08945108d795dcb877f10b816) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -34,7 +34,6 @@ using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data; -using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Forms.Views; namespace Ringtoets.Integration.Forms.Test.Views Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/NumericFailureMechanismResultViewTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/NumericFailureMechanismResultViewTest.cs (.../NumericFailureMechanismResultViewTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/NumericFailureMechanismResultViewTest.cs (.../NumericFailureMechanismResultViewTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -30,7 +30,7 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; namespace Ringtoets.Integration.Forms.Test.Views { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/NumericFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/NumericFailureMechanismSectionResultRowTest.cs (.../NumericFailureMechanismSectionResultRowTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/NumericFailureMechanismSectionResultRowTest.cs (.../NumericFailureMechanismSectionResultRowTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -27,7 +27,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultRow; namespace Ringtoets.Integration.Forms.Test.Views { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SimpleFailureMechanismResultViewTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SimpleFailureMechanismResultViewTest.cs (.../SimpleFailureMechanismResultViewTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SimpleFailureMechanismResultViewTest.cs (.../SimpleFailureMechanismResultViewTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -26,12 +26,11 @@ using Core.Common.Base.Geometry; using NUnit.Extensions.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; namespace Ringtoets.Integration.Forms.Test.Views { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SimpleFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SimpleFailureMechanismSectionResultRowTest.cs (.../SimpleFailureMechanismSectionResultRowTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SimpleFailureMechanismSectionResultRowTest.cs (.../SimpleFailureMechanismSectionResultRowTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -27,7 +27,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultRow; namespace Ringtoets.Integration.Forms.Test.Views { Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -r7cfeb195650f713f29c53e9926499fa63e4c79ea -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 7cfeb195650f713f29c53e9926499fa63e4c79ea) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -49,6 +49,7 @@ using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; using RingtoetsFormsResources = Ringtoets.Integration.Forms.Properties.Resources; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/ArbitraryProbabilityFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/ArbitraryProbabilityFailureMechanismResultViewInfoTest.cs (.../ArbitraryProbabilityFailureMechanismResultViewInfoTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/ArbitraryProbabilityFailureMechanismResultViewInfoTest.cs (.../ArbitraryProbabilityFailureMechanismResultViewInfoTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -31,7 +31,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; using Ringtoets.Piping.Data; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -141,55 +141,58 @@ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); - var failureMechanism = new Simple(); - - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]); - mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsFalse(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanismMock = mocks.Stub("N", "C"); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new[] { failureMechanismMock }); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsFalse(closeForData); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[] { new PipingFailureMechanism(), @@ -198,99 +201,113 @@ mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsTrue(closeForData); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsTrue(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - mocks.ReplayAll(); + // Call + var closeForData = info.CloseForData(view, failureMechanism); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanism); - - // Assert - Assert.IsTrue(closeForData); + // Assert + Assert.IsTrue(closeForData); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - mocks.ReplayAll(); + // Call + var closeForData = info.CloseForData(view, new Simple()); - // Call - var closeForData = info.CloseForData(viewMock, new Simple()); - - // Assert - Assert.IsFalse(closeForData); + // Assert + Assert.IsFalse(closeForData); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanismContext = mocks.StrictMock>(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); failureMechanismContext.Expect(fm => fm.WrappedData).Return(failureMechanism); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanismContext); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsTrue(closeForData); + // Call + var closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsTrue(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanismContext = mocks.StrictMock>(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); failureMechanismContext.Expect(fm => fm.WrappedData).Return(new Simple()); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanismContext); + using (var view = new ArbitraryProbabilityFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); + // Call + var closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsFalse(closeForData); + mocks.VerifyAll(); + } } [Test] public void AfterCreate_Always_SetsSpecificPropertiesToView() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanism = new Simple(); + var view = mocks.StrictMock(); var context = new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism); - viewMock.Expect(v => v.FailureMechanism = failureMechanism); + view.Expect(v => v.FailureMechanism = failureMechanism); mocks.ReplayAll(); // Call - info.AfterCreate(viewMock, context); + info.AfterCreate(view, context); // Assert mocks.VerifyAll(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/NumericFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/NumericFailureMechanismResultViewInfoTest.cs (.../NumericFailureMechanismResultViewInfoTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/NumericFailureMechanismResultViewInfoTest.cs (.../NumericFailureMechanismResultViewInfoTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -31,7 +31,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; using Ringtoets.Piping.Data; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -86,15 +86,14 @@ { // Setup var failureMechanism = new Simple(); - var viewMock = mocks.StrictMock(); + using(var view = new NumericFailureMechanismResultView()) + { + // Call + var viewName = info.GetViewName(view, failureMechanism.SectionResults); - mocks.ReplayAll(); - - // Call - var viewName = info.GetViewName(viewMock, failureMechanism.SectionResults); - - // Assert - Assert.AreEqual("Oordeel", viewName); + // Assert + Assert.AreEqual("Oordeel", viewName); + } } [Test] @@ -141,140 +140,156 @@ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); - var failureMechanism = new Simple(); - - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new NumericFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsFalse(closeForData); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanismMock = mocks.Stub("N", "C"); - var failureMechanism = new Simple(); - - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new[] - { - failureMechanismMock - }); + { + failureMechanismMock + }); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new NumericFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsFalse(closeForData); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[] - { - new PipingFailureMechanism(), - failureMechanism - }); + { + new PipingFailureMechanism(), + failureMechanism + }); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new NumericFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsTrue(closeForData); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsTrue(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); + using (var view = new NumericFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - mocks.ReplayAll(); + // Call + var closeForData = info.CloseForData(view, failureMechanism); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanism); - - // Assert - Assert.IsTrue(closeForData); + // Assert + Assert.IsTrue(closeForData); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); + using (var view = new NumericFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; + + // Call + var closeForData = info.CloseForData(view, new Simple()); - mocks.ReplayAll(); - - // Call - var closeForData = info.CloseForData(viewMock, new Simple()); - - // Assert - Assert.IsFalse(closeForData); + // Assert + Assert.IsFalse(closeForData); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanismContext = mocks.StrictMock>(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); failureMechanismContext.Expect(fm => fm.WrappedData).Return(failureMechanism); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanismContext); + using (var view = new NumericFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsTrue(closeForData); + // Call + var closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsTrue(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanismContext = mocks.StrictMock>(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); failureMechanismContext.Expect(fm => fm.WrappedData).Return(new Simple()); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanismContext); + using (var view = new NumericFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); + // Call + var closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsFalse(closeForData); + mocks.VerifyAll(); + } } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/SimpleFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -rbe3779b7be55ce7821035393e89cdde997b15883 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/SimpleFailureMechanismResultViewInfoTest.cs (.../SimpleFailureMechanismResultViewInfoTest.cs) (revision be3779b7be55ce7821035393e89cdde997b15883) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/SimpleFailureMechanismResultViewInfoTest.cs (.../SimpleFailureMechanismResultViewInfoTest.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -31,7 +31,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Data.StandAlone.SectionResult; -using Ringtoets.Integration.Forms.Views; +using Ringtoets.Integration.Forms.Views.SectionResultView; using Ringtoets.Piping.Data; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -87,16 +87,14 @@ { // Setup var failureMechanism = new Simple(); - var viewMock = mocks.StrictMock(); + using (var view = new SimpleFailureMechanismResultView()) + { + // Call + var viewName = info.GetViewName(view, failureMechanism.SectionResults); - mocks.ReplayAll(); - - // Call - var viewName = info.GetViewName(viewMock, failureMechanism.SectionResults); - - // Assert - Assert.AreEqual("Oordeel", viewName); - mocks.VerifyAll(); + // Assert + Assert.AreEqual("Oordeel", viewName); + } } [Test] @@ -143,57 +141,61 @@ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new SimpleFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); - mocks.VerifyAll(); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsFalse(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanismMock = mocks.Stub("N","C"); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new[] { failureMechanismMock }); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new SimpleFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); - mocks.VerifyAll(); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsFalse(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); assessmentSectionMock.Expect(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[] { new PipingFailureMechanism(), @@ -202,88 +204,99 @@ mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, assessmentSectionMock); + using (var view = new SimpleFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsTrue(closeForData); - mocks.VerifyAll(); + // Call + var closeForData = info.CloseForData(view, assessmentSectionMock); + + // Assert + Assert.IsTrue(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); - mocks.ReplayAll(); + using (var view = new SimpleFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Call - var closeForData = info.CloseForData(viewMock, failureMechanism); + // Call + var closeForData = info.CloseForData(view, failureMechanism); - // Assert - Assert.IsTrue(closeForData); - mocks.VerifyAll(); + // Assert + Assert.IsTrue(closeForData); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); - mocks.ReplayAll(); + using (var view = new SimpleFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Call - var closeForData = info.CloseForData(viewMock, new Simple()); + // Call + var closeForData = info.CloseForData(view, new Simple()); - // Assert - Assert.IsFalse(closeForData); - mocks.VerifyAll(); + // Assert + Assert.IsFalse(closeForData); + } } [Test] public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanismContext = mocks.StrictMock>(); var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); failureMechanismContext.Expect(fm => fm.WrappedData).Return(failureMechanism); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanismContext); + using (var view = new SimpleFailureMechanismResultView()) + { + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsTrue(closeForData); - mocks.VerifyAll(); + // Call + var closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsTrue(closeForData); + mocks.VerifyAll(); + } } [Test] public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var viewMock = mocks.StrictMock(); var failureMechanismContext = mocks.StrictMock>(); - var failureMechanism = new Simple(); - viewMock.Expect(vm => vm.Data).Return(failureMechanism.SectionResults); failureMechanismContext.Expect(fm => fm.WrappedData).Return(new Simple()); mocks.ReplayAll(); - // Call - var closeForData = info.CloseForData(viewMock, failureMechanismContext); + using (var view = new SimpleFailureMechanismResultView()) + { + var failureMechanism = new Simple(); + view.Data = failureMechanism.SectionResults; - // Assert - Assert.IsFalse(closeForData); - mocks.VerifyAll(); + // Call + var closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsFalse(closeForData); + mocks.VerifyAll(); + } } [Test] Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs =================================================================== diff -u -rde8e5c0dd97c9e53a07e905a0f59617e570b2259 -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision de8e5c0dd97c9e53a07e905a0f59617e570b2259) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -100,6 +100,12 @@ sectionResults.Add(new PipingFailureMechanismSectionResult(section)); } + public override void ClearAllSections() + { + base.ClearAllSections(); + sectionResults.Clear(); + } + public IEnumerable SectionResults { get Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs =================================================================== diff -u -rf5a2d607a5b8053b232c1f3ad572a0acba6a4e3a -rce8424c77c708edc0bb2150a9a6a0e75dad629fa --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision f5a2d607a5b8053b232c1f3ad572a0acba6a4e3a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision ce8424c77c708edc0bb2150a9a6a0e75dad629fa) @@ -57,6 +57,8 @@ calculationInputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableInput()))); calculationOutputObserver = new RecursiveObserver(UpdataDataGridViewDataSource, cg => cg.Children.Concat(cg.Children.OfType().Select(c => c.GetObservableOutput()))); calculationGroupObserver = new RecursiveObserver(UpdataDataGridViewDataSource, c => c.Children); + + AddDataGridColumns(); } public override IFailureMechanism FailureMechanism @@ -86,7 +88,7 @@ base.Dispose(disposing); } - protected override void AddDataGridColumns() + private void AddDataGridColumns() { DataGridViewControl.AddTextBoxColumn( TypeUtils.GetMemberName(sr => sr.Name),