Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs =================================================================== diff -u -r5785cc13c0454eaabed7ede4dad8e885db7efd50 -r98f3baffc4872fb2e9afeab85b335911d874c340 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision 5785cc13c0454eaabed7ede4dad8e885db7efd50) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision 98f3baffc4872fb2e9afeab85b335911d874c340) @@ -24,6 +24,7 @@ using System.Windows.Forms; using Core.Common.Base; using Core.Common.Util; +using Ringtoets.Common.Forms.Builders; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; @@ -54,59 +55,19 @@ return new WaterPressureAsphaltCoverSectionResultRow(sectionResult); } - protected override void Dispose(bool disposing) - { - DataGridViewControl.CellFormatting -= OnCellFormatting; - - base.Dispose(disposing); - } - protected override void AddDataGridColumns() { - DataGridViewControl.AddTextBoxColumn( - nameof(WaterPressureAsphaltCoverSectionResultRow.Name), - RingtoetsCommonFormsResources.Section_DisplayName, - true); + FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( + DataGridViewControl, + nameof(WaterPressureAsphaltCoverSectionResultRow.Name)); - EnumDisplayWrapper[] simpleAssessmentDataSource = - Enum.GetValues(typeof(SimpleAssessmentResultType)) - .OfType() - .Select(sa => new EnumDisplayWrapper(sa)) - .ToArray(); + FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( + DataGridViewControl, + nameof(WaterPressureAsphaltCoverSectionResultRow.SimpleAssessmentResult)); - DataGridViewControl.AddComboBoxColumn( - nameof(WaterPressureAsphaltCoverSectionResultRow.SimpleAssessmentResult), - RingtoetsCommonFormsResources.FailureMechanismResultView_SimpleAssessmentResult_DisplayName, - simpleAssessmentDataSource, - nameof(EnumDisplayWrapper.Value), - nameof(EnumDisplayWrapper.DisplayName)); - - DataGridViewControl.AddTextBoxColumn( - nameof(WaterPressureAsphaltCoverSectionResultRow.AssessmentLayerThree), - RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessmentResult_DisplayName); + FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( + DataGridViewControl, + nameof(WaterPressureAsphaltCoverSectionResultRow.TailorMadeAssessmentResult)); } - - protected override void BindEvents() - { - base.BindEvents(); - - DataGridViewControl.CellFormatting += OnCellFormatting; - } - - private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) - { - if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) - { - SimpleAssessmentResultType simpleAssessmentResult = GetDataAtRow(eventArgs.RowIndex).SimpleAssessmentResult; - if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(simpleAssessmentResult)) - { - DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex); - } - else - { - DataGridViewControl.RestoreCell(eventArgs.RowIndex, eventArgs.ColumnIndex); - } - } - } } } \ No newline at end of file