Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathProperties.cs
===================================================================
diff -u -r27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0 -r02fa09b26415f7b50bafd3c991f49ffaf369e20a
--- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathProperties.cs (.../StrengthStabilityLengthwiseConstructionFailurePathProperties.cs) (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
+++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathProperties.cs (.../StrengthStabilityLengthwiseConstructionFailurePathProperties.cs) (revision 02fa09b26415f7b50bafd3c991f49ffaf369e20a)
@@ -20,97 +20,39 @@
// All rights reserved.
using System;
-using System.Linq;
-using Core.Common.Base.Data;
using Core.Common.Util.Attributes;
using Core.Gui.Attributes;
-using Core.Gui.PropertyBag;
using Riskeer.Common.Data.AssessmentSection;
-using Riskeer.Common.Data.Contribution;
using Riskeer.Common.Data.FailureMechanism;
using Riskeer.Integration.Data.StandAlone;
-using Riskeer.Integration.Forms.Properties;
using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
namespace Riskeer.Integration.Forms.PropertyClasses.StandAlone
{
///
/// Failure path related ViewModel of for properties panel.
///
- public class StrengthStabilityLengthwiseConstructionFailurePathProperties : ObjectProperties
+ public class StrengthStabilityLengthwiseConstructionFailurePathProperties : StandAloneFailurePathProperties
{
- private const int namePropertyIndex = 1;
- private const int codePropertyIndex = 2;
- private const int groupPropertyIndex = 3;
- private const int contributionPropertyIndex = 4;
- private const int inAssemblyPropertyIndex = 5;
- private const int nPropertyIndex = 6;
private const int applyLengthEffectInSectionPropertyIndex = 7;
- private readonly IAssessmentSection assessmentSection;
-
///
/// Creates a new instance of .
///
/// The failure mechanism to show the properties for.
/// The assessment section the failure mechanism belongs to.
/// Thrown when any parameter is null.
public StrengthStabilityLengthwiseConstructionFailurePathProperties(IHasGeneralInput failureMechanism, IAssessmentSection assessmentSection)
- {
- if (failureMechanism == null)
- {
- throw new ArgumentNullException(nameof(failureMechanism));
- }
+ : base(failureMechanism, assessmentSection) {}
- if (assessmentSection == null)
- {
- throw new ArgumentNullException(nameof(assessmentSection));
- }
-
- this.assessmentSection = assessmentSection;
-
- Data = failureMechanism;
- }
-
- [DynamicVisibleValidationMethod]
- public bool DynamicVisibleValidationMethod(string propertyName)
- {
- return data.InAssembly || !ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(propertyName);
- }
-
- private static bool ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(string propertyName)
- {
- return nameof(Contribution).Equals(propertyName)
- || nameof(N).Equals(propertyName)
- || nameof(ApplyLengthEffectInSection).Equals(propertyName);
- }
-
#region Length effect parameters
[DynamicVisible]
- [PropertyOrder(nPropertyIndex)]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_Description))]
- public RoundedDouble N
- {
- get
- {
- return data.GeneralInput.N;
- }
- set
- {
- data.GeneralInput.N = value;
- data.NotifyObservers();
- }
- }
-
- [DynamicVisible]
[PropertyOrder(applyLengthEffectInSectionPropertyIndex)]
[ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))]
[ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Apply_LengthEffect_In_Section_DisplayName))]
[ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Apply_LengthEffect_In_Section_Description))]
- public bool ApplyLengthEffectInSection
+ public new bool ApplyLengthEffectInSection
{
get
{
@@ -119,71 +61,5 @@
}
#endregion
-
- #region General
-
- [PropertyOrder(namePropertyIndex)]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Name_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Name_Description))]
- public string Name
- {
- get
- {
- return data.Name;
- }
- }
-
- [PropertyOrder(codePropertyIndex)]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Code_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Code_Description))]
- public string Code
- {
- get
- {
- return data.Code;
- }
- }
-
- [PropertyOrder(groupPropertyIndex)]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Group_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Group_Description))]
- public int Group
- {
- get
- {
- return data.Group;
- }
- }
-
- [DynamicVisible]
- [PropertyOrder(contributionPropertyIndex)]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Contribution_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Contribution_Description))]
- public string Contribution
- {
- get
- {
- return string.Format(Resources.FailureMechanismProperties_Contribution_Other_Percentage_0,
- assessmentSection.GetContributingFailureMechanisms().Single(fm => fm is OtherFailureMechanism).Contribution);
- }
- }
-
- [PropertyOrder(inAssemblyPropertyIndex)]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_InAssembly_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_InAssembly_Description))]
- public bool InAssembly
- {
- get
- {
- return data.InAssembly;
- }
- }
-
- #endregion
}
}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs
===================================================================
diff -u -r27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0 -r02fa09b26415f7b50bafd3c991f49ffaf369e20a
--- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs (.../StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs) (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
+++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs (.../StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs) (revision 02fa09b26415f7b50bafd3c991f49ffaf369e20a)
@@ -24,7 +24,6 @@
using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.TestUtil;
-using Core.Gui.PropertyBag;
using Core.Gui.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -102,7 +101,7 @@
var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
// Assert
- Assert.IsInstanceOf>(properties);
+ Assert.IsInstanceOf(properties);
Assert.AreEqual(failureMechanism.Name, properties.Name);
Assert.AreEqual(failureMechanism.Code, properties.Code);
Assert.AreEqual(failureMechanism.Group, properties.Group);