Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismAssemblyResultRow.cs =================================================================== diff -u -rbdf2f9d316fd83742c9421c023a2de3ca6024f34 -r9618f924a79a6f3abb88c31b2cebb54418128031 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismAssemblyResultRow.cs (.../FailureMechanismAssemblyResultRow.cs) (revision bdf2f9d316fd83742c9421c023a2de3ca6024f34) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismAssemblyResultRow.cs (.../FailureMechanismAssemblyResultRow.cs) (revision 9618f924a79a6f3abb88c31b2cebb54418128031) @@ -20,117 +20,43 @@ // All rights reserved. using System; -using System.Collections.Generic; -using System.ComponentModel; -using Core.Common.Controls.DataGrid; -using Core.Common.Util; using Ringtoets.AssemblyTool.Data; using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.Common.Forms.TypeConverters; namespace Ringtoets.Integration.Forms.Views { /// /// This class represents a row displaying the properties of a - /// and its assembly result. + /// and its . /// - public class FailureMechanismAssemblyResultRow + public class FailureMechanismAssemblyResultRow : FailureMechanismAssemblyResultRowBase { - private const int categoryIndex = 3; - private readonly IFailureMechanism failureMechanism; private readonly Func getFailureMechanismAssembly; /// - /// Creates a new instance of . + /// Creates a new instance of . /// - /// The to wrap so - /// that it can be displayed as a row. - /// Gets the assembly of the failure mechanism. - /// Thrown when any parameters is null. + /// The to wrap so that it can be displayed as a row. + /// Gets the + /// of the failure mechanism. + /// Thrown when any parameter is null. public FailureMechanismAssemblyResultRow(IFailureMechanism failureMechanism, Func getFailureMechanismAssembly) + : base(failureMechanism) { - if (failureMechanism == null) - { - throw new ArgumentNullException(nameof(failureMechanism)); - } - if (getFailureMechanismAssembly == null) { throw new ArgumentNullException(nameof(getFailureMechanismAssembly)); } - this.failureMechanism = failureMechanism; this.getFailureMechanismAssembly = getFailureMechanismAssembly; - ColumnStateDefinitions = new Dictionary(); - CreateColumnStateDefinitions(); - Update(); } - /// - /// Gets the column state definitions for the given indices. - /// - public IDictionary ColumnStateDefinitions { get; } - - /// - /// Gets the name of the failure mechanism. - /// - public string Name + protected override void TryGetDerivedData() { - get - { - return failureMechanism.Name; - } - } - - /// - /// Gets the code of the failure mechanism. - /// - public string Code - { - get - { - return failureMechanism.Code; - } - } - - /// - /// Gets the group of the failure mechanism. - /// - public int Group - { - get - { - return failureMechanism.Group; - } - } - - /// - /// Gets the group of the failure mechanism assembly. - /// - [TypeConverter(typeof(EnumTypeConverter))] - public FailureMechanismAssemblyCategoryGroup CategoryGroup { get; private set; } - - /// - /// Gets the probability of the failure mechanism assembly. - /// - [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] - public double Probablity { get; private set; } - - /// - /// Updates all data and states in the row. - /// - public void Update() - { - ResetErrorTexts(); - TryGetDerivedData(); - } - - private void TryGetDerivedData() - { try { FailureMechanismAssembly failureMechanismAssembly = getFailureMechanismAssembly(); @@ -141,21 +67,8 @@ { CategoryGroup = FailureMechanismAssemblyCategoryGroup.None; Probablity = double.NaN; - ColumnStateDefinitions[categoryIndex].ErrorText = e.Message; + ColumnStateDefinitions[CategoryIndex].ErrorText = e.Message; } } - - private void CreateColumnStateDefinitions() - { - ColumnStateDefinitions.Add(categoryIndex, new DataGridViewColumnStateDefinition - { - ReadOnly = true - }); - } - - private void ResetErrorTexts() - { - ColumnStateDefinitions[categoryIndex].ErrorText = string.Empty; - } } } \ No newline at end of file