Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs =================================================================== diff -u -r4501abb594c49cc13981a47535229ce6222d6f35 -r50b3a6c556aace513b84909963bbc0ad37ee4374 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 4501abb594c49cc13981a47535229ce6222d6f35) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 50b3a6c556aace513b84909963bbc0ad37ee4374) @@ -38,26 +38,28 @@ /// The view for the . /// /// The type of results which are presented by the - /// . + /// . /// The type of the row that is used to show the data. /// The type of the failure mechanism this view belongs to. - public abstract partial class FailureMechanismResultView : UserControl, IView + /// The type of the assembly result control in this view. + public abstract partial class FailureMechanismResultView : UserControl, IView where TSectionResult : FailureMechanismSectionResult where TSectionResultRow : FailureMechanismSectionResultRow where TFailureMechanism : IFailureMechanism + where TAssemblyResultControl : AssemblyResultControl, new() { private readonly IObservableEnumerable failureMechanismSectionResults; private readonly Observer failureMechanismObserver; private readonly Observer failureMechanismSectionResultObserver; private readonly RecursiveObserver, TSectionResult> failureMechanismSectionResultsObserver; - private AssemblyResultControl failureMechanismAssemblyResultControl; + private TAssemblyResultControl failureMechanismAssemblyResultControl; private Action setFailureMechanismAssemblyResultAction; private IEnumerable sectionResultRows; private bool rowUpdating; /// - /// Creates a new instance of . + /// Creates a new instance of . /// /// The collection of to /// show in the view. @@ -76,7 +78,7 @@ } InitializeComponent(); - InitializeFailureMechanismAssemblyComponents(); + InitializeInfoIcon(); FailureMechanism = failureMechanism; this.failureMechanismSectionResults = failureMechanismSectionResults; @@ -118,7 +120,7 @@ /// /// Creates a display object for which is added to the - /// on the . + /// on the . /// /// The for which to create a /// display object. @@ -144,28 +146,6 @@ } /// - /// Updates the data source of the data grid view with the current known failure mechanism section results. - /// - protected void UpdateDataGridViewDataSource() - { - DataGridViewControl.EndEdit(); - - RemoveSectionResultRowEvents(); - - sectionResultRows = failureMechanismSectionResults - .Select(CreateFailureMechanismSectionResultRow) - .Where(sr => sr != null) - .ToList(); - DataGridViewControl.SetDataSource(sectionResultRows); - - sectionResultRows?.ForEachElementDo(row => - { - row.RowUpdated += RowUpdated; - row.RowUpdateDone += RowUpdateDone; - }); - } - - /// /// Adds the columns to the view. /// protected abstract void AddDataGridColumns(); @@ -175,14 +155,16 @@ /// /// The control to set on the view. /// The action to perform to update the data of the control. - protected void SetAssemblyResultControl(AssemblyResultControl control, - Action setResultAction) + protected void SetAssemblyResultControl(TAssemblyResultControl control, + Action setResultAction) { - failureMechanismAssemblyResultControl = control; + failureMechanismAssemblyResultControl = new TAssemblyResultControl(); setFailureMechanismAssemblyResultAction = setResultAction; TableLayoutPanel.Controls.Add(failureMechanismAssemblyResultControl, 1, 0); } + protected abstract void UpdateAssemblyResultControl(); + /// /// Updates all controls in the view. /// @@ -192,6 +174,28 @@ UpdateFailureMechanismAssemblyResultControl(); } + /// + /// Updates the data source of the data grid view with the current known failure mechanism section results. + /// + private void UpdateDataGridViewDataSource() + { + DataGridViewControl.EndEdit(); + + RemoveSectionResultRowEvents(); + + sectionResultRows = failureMechanismSectionResults + .Select(CreateFailureMechanismSectionResultRow) + .Where(sr => sr != null) + .ToList(); + DataGridViewControl.SetDataSource(sectionResultRows); + + sectionResultRows?.ForEachElementDo(row => + { + row.RowUpdated += RowUpdated; + row.RowUpdateDone += RowUpdateDone; + }); + } + private void UpdateFailureMechanismAssemblyResultControl() { if (failureMechanismAssemblyResultControl != null && setFailureMechanismAssemblyResultAction != null) @@ -208,11 +212,10 @@ } } - private void InitializeFailureMechanismAssemblyComponents() + private void InitializeInfoIcon() { infoIcon.BackgroundImage = CoreCommonGuiResources.information; toolTip.SetToolTip(infoIcon, Resources.FailureMechanismResultView_InfoToolTip); - failureMechanismAssemblyLabel.Text = Resources.FailureMechanismResultView_FailureMechanismAssemblyLabel; } private void RemoveSectionResultRowEvents()