Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs (.../ClosingStructuresFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs (.../ClosingStructuresFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -64,8 +64,6 @@ } this.assessmentSection = assessmentSection; - DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; - DataGridViewControl.CellFormatting += OnCellFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -86,8 +84,6 @@ calculationInputObserver.Observable = observableGroup; calculationOutputObserver.Observable = observableGroup; calculationGroupObserver.Observable = observableGroup; - - UpdateDataGridViewDataSource(); } protected override ClosingStructuresFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(ClosingStructuresFailureMechanismSectionResult sectionResult) @@ -135,6 +131,14 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs =================================================================== diff -u -rc4d1fab26e8a8a24845606047d51628f6bf4fe5e -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision c4d1fab26e8a8a24845606047d51628f6bf4fe5e) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -96,9 +96,10 @@ { base.OnLoad(e); AddDataGridColumns(); + BindEvents(); - DataGridViewControl.CellFormatting += OnCellFormatting; - } + UpdateDataGridViewDataSource(); + } /// /// Creates a display object for which is added to the @@ -153,6 +154,18 @@ /// protected abstract void AddDataGridColumns(); + /// + /// Binds the events to the data grid view. + /// + protected virtual void BindEvents() + { + DataGridViewControl.CellFormatting += OnCellFormatting; + } + + /// + /// Gets the formatting rules. + /// + /// An of formatting rules. protected virtual IEnumerable> GetFormattingRules() { yield break; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs =================================================================== diff -u -re69429bcf4f26865ab65fa4299e7b2a9d17ea02f -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision e69429bcf4f26865ab65fa4299e7b2a9d17ea02f) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -148,7 +148,7 @@ // Precondition Assert.IsFalse(invalidated); - + // When sectionResult.NotifyObservers(); @@ -166,16 +166,9 @@ FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult() }; + // When using (TestFailureMechanismResultView view = ShowFailureMechanismResultsView(sectionResults)) { - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - - //Precondition - Assert.IsFalse(view.Evaluated); - - // When - dataGridView.Refresh(); - // Then Assert.IsTrue(view.Evaluated); } @@ -190,17 +183,9 @@ FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult() }; + // When using (TestFailureMechanismResultView view = ShowFailureMechanismResultsView(sectionResults)) { - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - - //Precondition - Assert.IsFalse(view.RulesMeetActionPerformed); - Assert.IsFalse(view.RulesDoNotMeetActionPerformed); - - // When - dataGridView.Refresh(); - // Then Assert.IsTrue(view.RulesMeetActionPerformed); Assert.IsFalse(view.RulesDoNotMeetActionPerformed); @@ -216,17 +201,9 @@ FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult("Other name") }; + // When using (TestFailureMechanismResultView view = ShowFailureMechanismResultsView(sectionResults)) { - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - - //Precondition - Assert.IsFalse(view.RulesMeetActionPerformed); - Assert.IsFalse(view.RulesDoNotMeetActionPerformed); - - // When - dataGridView.Refresh(); - // Then Assert.IsFalse(view.RulesMeetActionPerformed); Assert.IsTrue(view.RulesDoNotMeetActionPerformed); @@ -270,11 +247,14 @@ public class TestFailureMechanismResultView : FailureMechanismResultView, TestFailureMechanism> { public TestFailureMechanismResultView(IObservableEnumerable failureMechanismSectionResults, TestFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} + public bool Evaluated { get; private set; } + + public bool RulesMeetActionPerformed { get; private set; } + + public bool RulesDoNotMeetActionPerformed { get; private set; } + protected override FailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(FailureMechanismSectionResult sectionResult) { return new TestRow(sectionResult); @@ -288,7 +268,10 @@ protected override IEnumerable>> GetFormattingRules() { yield return new DataGridViewColumnFormattingRule>( - new [] { 0 }, + new[] + { + 0 + }, new Func, bool>[] { row => @@ -297,24 +280,21 @@ return row.Name.Equals("test"); } }, - (i, i1) => RulesMeetActionPerformed = true, + (i, i1) => RulesMeetActionPerformed = true, (i, i1) => RulesDoNotMeetActionPerformed = true); yield return new DataGridViewColumnFormattingRule>( - new [] { 0 }, + new[] + { + 0 + }, new Func, bool>[] { row => row.Name.Equals("Vak 1") }, (i, i1) => {}, null); } - - public bool Evaluated { get; private set; } - - public bool RulesMeetActionPerformed { get; private set; } - - public bool RulesDoNotMeetActionPerformed { get; private set; } } public class TestRow : FailureMechanismSectionResultRow Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs (.../DuneErosionFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs (.../DuneErosionFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -46,11 +46,7 @@ public DuneErosionFailureMechanismResultView( IObservableEnumerable failureMechanismSectionResults, DuneErosionFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override DuneErosionSectionResultRow CreateFailureMechanismSectionResultRow(DuneErosionFailureMechanismSectionResult sectionResult) { @@ -101,6 +97,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -62,11 +62,8 @@ throw new ArgumentNullException(nameof(assessmentSection)); } - this.assessmentSection = assessmentSection; + this.assessmentSection = assessmentSection; - DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; - // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( UpdateDataGridViewDataSource, @@ -86,8 +83,6 @@ calculationInputObserver.Observable = observableGroup; calculationOutputObserver.Observable = observableGroup; calculationGroupObserver.Observable = observableGroup; - - UpdateDataGridViewDataSource(); } protected override void Dispose(bool disposing) @@ -138,6 +133,14 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs (.../GrassCoverErosionOutwardsFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs (.../GrassCoverErosionOutwardsFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -37,7 +37,7 @@ /// The view for a collection of . /// public class GrassCoverErosionOutwardsFailureMechanismResultView : FailureMechanismResultView + GrassCoverErosionOutwardsFailureMechanismSectionResultRow, GrassCoverErosionOutwardsFailureMechanism> { /// /// @@ -46,11 +46,7 @@ public GrassCoverErosionOutwardsFailureMechanismResultView( IObservableEnumerable failureMechanismSectionResults, GrassCoverErosionOutwardsFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override GrassCoverErosionOutwardsFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult) { @@ -101,6 +97,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -65,9 +65,6 @@ this.assessmentSection = assessmentSection; - DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; - // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( UpdateDataGridViewDataSource, @@ -88,8 +85,6 @@ calculationInputObserver.Observable = observableGroup; calculationOutputObserver.Observable = observableGroup; calculationGroupObserver.Observable = observableGroup; - - UpdateDataGridViewDataSource(); } protected override void Dispose(bool disposing) @@ -140,6 +135,14 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs (.../GrassCoverSlipOffInwardsResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs (.../GrassCoverSlipOffInwardsResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -48,11 +48,7 @@ public GrassCoverSlipOffInwardsResultView( IObservableEnumerable failureMechanismSectionResults, GrassCoverSlipOffInwardsFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override GrassCoverSlipOffInwardsSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverSlipOffInwardsFailureMechanismSectionResult sectionResult) { @@ -103,6 +99,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs (.../GrassCoverSlipOffOutwardsResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs (.../GrassCoverSlipOffOutwardsResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -48,11 +48,7 @@ public GrassCoverSlipOffOutwardsResultView( IObservableEnumerable failureMechanismSectionResults, GrassCoverSlipOffOutwardsFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override GrassCoverSlipOffOutwardsSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverSlipOffOutwardsFailureMechanismSectionResult sectionResult) { @@ -103,6 +99,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -46,11 +46,7 @@ /// public MacroStabilityOutwardsResultView(IObservableEnumerable failureMechanismSectionResults, MacroStabilityOutwardsFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override MacroStabilityOutwardsSectionResultRow CreateFailureMechanismSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResult sectionResult) { @@ -92,6 +88,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs (.../MicrostabilityResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs (.../MicrostabilityResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -47,11 +47,7 @@ /// public MicrostabilityResultView(IObservableEnumerable failureMechanismSectionResults, MicrostabilityFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override MicrostabilitySectionResultRow CreateFailureMechanismSectionResultRow(MicrostabilityFailureMechanismSectionResult sectionResult) { @@ -102,6 +98,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs (.../PipingStructureResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs (.../PipingStructureResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -38,20 +38,16 @@ /// /// The view for a collection of . /// - public class PipingStructureResultView : FailureMechanismResultView + public class PipingStructureResultView : FailureMechanismResultView { /// /// /// Creates a new instance of . /// public PipingStructureResultView(IObservableEnumerable failureMechanismSectionResults, PipingStructureFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override PipingStructureSectionResultRow CreateFailureMechanismSectionResultRow(PipingStructureFailureMechanismSectionResult sectionResult) { @@ -102,6 +98,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs (.../StrengthStabilityLengthwiseConstructionResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs (.../StrengthStabilityLengthwiseConstructionResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -38,7 +38,7 @@ /// The view for a collection of . /// public class StrengthStabilityLengthwiseConstructionResultView : FailureMechanismResultView + StrengthStabilityLengthwiseConstructionSectionResultRow, StrengthStabilityLengthwiseConstructionFailureMechanism> { /// /// @@ -47,11 +47,7 @@ public StrengthStabilityLengthwiseConstructionResultView( IObservableEnumerable failureMechanismSectionResults, StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override StrengthStabilityLengthwiseConstructionSectionResultRow CreateFailureMechanismSectionResultRow(StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult sectionResult) { @@ -90,6 +86,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs (.../TechnicalInnovationResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs (.../TechnicalInnovationResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -46,11 +46,7 @@ /// public TechnicalInnovationResultView(IObservableEnumerable failureMechanismSectionResults, TechnicalInnovationFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override TechnicalInnovationSectionResultRow CreateFailureMechanismSectionResultRow(TechnicalInnovationFailureMechanismSectionResult sectionResult) { @@ -89,6 +85,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -47,11 +47,7 @@ public WaterPressureAsphaltCoverResultView( IObservableEnumerable failureMechanismSectionResults, WaterPressureAsphaltCoverFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override WaterPressureAsphaltCoverSectionResultRow CreateFailureMechanismSectionResultRow(WaterPressureAsphaltCoverFailureMechanismSectionResult sectionResult) { @@ -90,6 +86,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs =================================================================== diff -u -r44420c717ac32101ba0da4739d259c622f47976e -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs (.../GrassCoverSlipOffInwardsResultViewTest.cs) (revision 44420c717ac32101ba0da4739d259c622f47976e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs (.../GrassCoverSlipOffInwardsResultViewTest.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -25,6 +25,7 @@ using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; +using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs (.../MacroStabilityInwardsFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs (.../MacroStabilityInwardsFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -71,9 +71,6 @@ this.assessmentSection = assessmentSection; - DataGridViewControl.CellFormatting += ShowDetailedAssessmentErrors; - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; - // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( UpdateDataGridViewDataSource, @@ -94,8 +91,6 @@ calculationInputObserver.Observable = observableGroup; calculationOutputObserver.Observable = observableGroup; calculationGroupObserver.Observable = observableGroup; - - UpdateDataGridViewDataSource(); } protected override void Dispose(bool disposing) @@ -148,6 +143,14 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += ShowDetailedAssessmentErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + #region Event handling private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -68,11 +68,8 @@ failureMechanismObserver = new Observer(UpdateDataGridViewDataSource) { Observable = failureMechanism - }; + }; - DataGridViewControl.CellFormatting += ShowDetailedAssessmentErrors; - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; - // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( UpdateDataGridViewDataSource, @@ -92,8 +89,6 @@ calculationInputObserver.Observable = observableGroup; calculationOutputObserver.Observable = observableGroup; calculationGroupObserver.Observable = observableGroup; - - UpdateDataGridViewDataSource(); } protected override void Dispose(bool disposing) @@ -144,6 +139,14 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += ShowDetailedAssessmentErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + #region Event handling private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -65,8 +65,6 @@ } this.assessmentSection = assessmentSection; - DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -88,8 +86,6 @@ calculationInputObserver.Observable = observableGroup; calculationOutputObserver.Observable = observableGroup; calculationGroupObserver.Observable = observableGroup; - - UpdateDataGridViewDataSource(); } protected override StabilityPointStructuresFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(StabilityPointStructuresFailureMechanismSectionResult sectionResult) @@ -139,6 +135,14 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs (.../StabilityStoneCoverResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs (.../StabilityStoneCoverResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -45,11 +45,7 @@ /// public StabilityStoneCoverResultView(IObservableEnumerable failureMechanismSectionResults, StabilityStoneCoverFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override StabilityStoneCoverSectionResultRow CreateFailureMechanismSectionResultRow(StabilityStoneCoverFailureMechanismSectionResult sectionResult) { @@ -100,6 +96,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; + } + private void DisableIrrelevantFieldsFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > 1) Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs =================================================================== diff -u -rc47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd -rade3657cb21871c58056daedc9deaf1da8594ec3 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision c47cc3d2e42f1cb69ccf6e47ee0922f05dfd68dd) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision ade3657cb21871c58056daedc9deaf1da8594ec3) @@ -46,11 +46,7 @@ public WaveImpactAsphaltCoverFailureMechanismResultView( IObservableEnumerable failureMechanismSectionResults, WaveImpactAsphaltCoverFailureMechanism failureMechanism) - : base(failureMechanismSectionResults, failureMechanism) - { - DataGridViewControl.CellFormatting += OnCellFormatting; - UpdateDataGridViewDataSource(); - } + : base(failureMechanismSectionResults, failureMechanism) {} protected override WaveImpactAsphaltCoverFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult) { @@ -101,6 +97,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_DisplayName); } + protected override void BindEvents() + { + base.BindEvents(); + + DataGridViewControl.CellFormatting += OnCellFormatting; + } + private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex)