Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rf7191448000db1a5f3698a1439b441da9afb72bc -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f7191448000db1a5f3698a1439b441da9afb72bc) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -107,6 +107,33 @@ } /// + /// Looks up a localized string similar to Naam van de berekeningsmap.. + /// + public static string CalculationGroup_Name_Description { + get { + return ResourceManager.GetString("CalculationGroup_Name_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Naam. + /// + public static string CalculationGroup_Name_DisplayName { + get { + return ResourceManager.GetString("CalculationGroup_Name_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Berekeningsmap. + /// + public static string CalculationGroupContextProperties_DisplayName { + get { + return ResourceManager.GetString("CalculationGroupContextProperties_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De uitvoer van alle afhankelijke berekeningen is verwijderd.. /// public static string Calculations_Deleted { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -rf7191448000db1a5f3698a1439b441da9afb72bc -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision f7191448000db1a5f3698a1439b441da9afb72bc) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -224,4 +224,13 @@ Weet u zeker dat u wilt doorgaan? + + Berekeningsmap + + + Naam van de berekeningsmap. + + + Naam + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/CalculationGroupContextProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/CalculationGroupContextProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/CalculationGroupContextProperties.cs (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.Properties; + +namespace Ringtoets.Integration.Forms.PropertyClasses +{ + /// + /// Object properties class for . + /// + [ResourcesDisplayName(typeof(Resources), "CalculationGroupContextProperties_DisplayName")] + public class CalculationGroupContextProperties : ObjectProperties> + { + [DynamicReadOnly] + [ResourcesCategory(typeof(Common.Data.Properties.Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "CalculationGroup_Name_DisplayName")] + [ResourcesDescription(typeof(Resources), "CalculationGroup_Name_Description")] + public string Name + { + get + { + return data.WrappedData.Name; + } + set + { + data.WrappedData.Name = value; + data.NotifyObservers(); + } + } + + [DynamicReadOnlyValidationMethod] + public bool DynamicReadonlyValidator(string propertyName) + { + return !data.WrappedData.IsNameEditable; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r41fac7fff0a505c08945108d795dcb877f10b816 -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 41fac7fff0a505c08945108d795dcb877f10b816) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -48,6 +48,7 @@ + Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -rdaa1008263412accdb1fcad949ddf100fb2e97b7 -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision daa1008263412accdb1fcad949ddf100fb2e97b7) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -108,6 +108,7 @@ yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo, StandAloneFailureMechanismContextProperties>(); + yield return new PropertyInfo, CalculationGroupContextProperties>(); } /// Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/CalculationGroupContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/CalculationGroupContextPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/CalculationGroupContextPropertiesTest.cs (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -0,0 +1,138 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using System.Reflection; +using Core.Common.Base; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Reflection; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class CalculationGroupContextPropertiesTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var properties = new CalculationGroupContextProperties(); + + // Assert + Assert.IsInstanceOf>>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void GetProperties_WithData_ReturnTheSameValueAsData() + { + // Setup + var calculationGroup = new CalculationGroup(); + + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var properties = new CalculationGroupContextProperties + { + Data = new TestCalculationGroupContext(calculationGroup, failureMechanismMock) + }; + + // Call & Assert + Assert.AreEqual(calculationGroup.Name, properties.Name); + } + + [Test] + public void SetProperties_WithData_UpdateDataAndNotifyObservers() + { + // Setup + var mocks = new MockRepository(); + var projectObserver = mocks.StrictMock(); + projectObserver.Expect(o => o.UpdateObserver()); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var calculationGroup = new CalculationGroup(); + var testCalculationGroupContext = new TestCalculationGroupContext(calculationGroup, failureMechanismMock); + + testCalculationGroupContext.Attach(projectObserver); + + var properties = new CalculationGroupContextProperties + { + Data = testCalculationGroupContext + }; + + // Call & Assert + const string name = "cool new name!"; + properties.Name = name; + Assert.AreEqual(name, calculationGroup.Name); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Name_GroupHasEditableName_NameShouldNotBeReadonly(bool nameIsEditable) + { + // Setup + var calculationGroup = new CalculationGroup("A", nameIsEditable); + + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var properties = new CalculationGroupContextProperties + { + Data = new TestCalculationGroupContext(calculationGroup, failureMechanismMock) + }; + + string propertyName = TypeUtils.GetMemberName(p => p.Name); + PropertyInfo nameProperty = properties.GetType().GetProperty(propertyName); + + // Call + object[] namePropertyAttributes = nameProperty.GetCustomAttributes(false); + + // Assert + Assert.AreEqual(1, namePropertyAttributes.OfType().Count()); + Assert.AreEqual(!nameIsEditable, DynamicReadOnlyAttribute.IsReadOnly(properties, propertyName)); + } + + private class TestCalculationGroupContext : Observable, ICalculationContext + { + public TestCalculationGroupContext(CalculationGroup wrappedData, IFailureMechanism failureMechanism) + { + WrappedData = wrappedData; + FailureMechanism = failureMechanism; + } + + public CalculationGroup WrappedData { get; private set; } + + public IFailureMechanism FailureMechanism { get; private set; } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r20bb156dfc129b1602ddbcddc73c0806807f19ab -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 20bb156dfc129b1602ddbcddc73c0806807f19ab) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -62,6 +62,7 @@ + @@ -99,6 +100,10 @@ {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} Core.Common.Gui + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + {26214BD0-DAFB-4CFC-8EB2-80C5D53C859E} Core.Common.Gui.TestUtil Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -rdaa1008263412accdb1fcad949ddf100fb2e97b7 -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision daa1008263412accdb1fcad949ddf100fb2e97b7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -37,6 +37,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.Views; @@ -180,7 +181,7 @@ PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(3, propertyInfos.Length); + Assert.AreEqual(4, propertyInfos.Length); var assessmentSectionProperties = propertyInfos.Single(pi => pi.DataType == typeof(IAssessmentSection)); Assert.AreEqual(typeof(AssessmentSectionProperties), assessmentSectionProperties.PropertyObjectType); @@ -199,6 +200,12 @@ Assert.IsNull(standAloneFailureMechanismProperties.AdditionalDataCheck); Assert.IsNull(standAloneFailureMechanismProperties.GetObjectPropertiesData); Assert.IsNull(standAloneFailureMechanismProperties.AfterCreate); + + var calculationGroupProperties = propertyInfos.Single(pi => pi.DataType == typeof(ICalculationContext)); + Assert.AreEqual(typeof(CalculationGroupContextProperties), calculationGroupProperties.PropertyObjectType); + Assert.IsNull(calculationGroupProperties.AdditionalDataCheck); + Assert.IsNull(calculationGroupProperties.GetObjectPropertiesData); + Assert.IsNull(calculationGroupProperties.AfterCreate); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r43d380f96427a7f5666ecb817f73be0a25fff27f -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 43d380f96427a7f5666ecb817f73be0a25fff27f) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -587,24 +587,6 @@ } /// - /// Looks up a localized string similar to Naam van de berekeningsmap.. - /// - public static string PipingCalculationGroup_Name_Description { - get { - return ResourceManager.GetString("PipingCalculationGroup_Name_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Naam. - /// - public static string PipingCalculationGroup_Name_DisplayName { - get { - return ResourceManager.GetString("PipingCalculationGroup_Name_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Valideer alle berekeningen binnen deze berekeningsmap.. /// public static string PipingCalculationGroup_Validate_All_ToolTip { @@ -614,15 +596,6 @@ } /// - /// Looks up a localized string similar to Berekeningsmap. - /// - public static string PipingCalculationGroupContextProperties_DisplayName { - get { - return ResourceManager.GetString("PipingCalculationGroupContextProperties_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap PipingCalculationReportIcon { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx =================================================================== diff -u -r43d380f96427a7f5666ecb817f73be0a25fff27f -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 43d380f96427a7f5666ecb817f73be0a25fff27f) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -397,15 +397,6 @@ ..\Resources\control-record.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Berekeningsmap - - - Naam van de berekeningsmap. - - - Naam - {0} mag niet 'null' zijn. Fisheye: Tag 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationGroupContextProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj =================================================================== diff -u -r2fca3f7ae1037eaa9c355b64d7cd0c390143ea8f -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 2fca3f7ae1037eaa9c355b64d7cd0c390143ea8f) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -77,7 +77,6 @@ - Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -ra6b3a4921ffd42f54f6be60ebc2eef3c12cab10e -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision a6b3a4921ffd42f54f6be60ebc2eef3c12cab10e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -68,7 +68,6 @@ { yield return new PropertyInfo(); yield return new PropertyInfo(); - yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); Fisheye: Tag 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationGroupContextPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -r903d441abc9596fbae24ca98a7d6af633bd616f7 -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -74,7 +74,6 @@ - Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u -r64d5609bb2912cd52dc74deffdd189222e240599 -r6a37d7480a8d92ab98cc68b72fdfce2003c3aafa --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 64d5609bb2912cd52dc74deffdd189222e240599) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 6a37d7480a8d92ab98cc68b72fdfce2003c3aafa) @@ -69,7 +69,7 @@ PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); // assert - Assert.AreEqual(8, propertyInfos.Length); + Assert.AreEqual(7, propertyInfos.Length); var pipingFailureMechanismContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(PipingFailureMechanismContext)); Assert.AreEqual(typeof(PipingFailureMechanismContextProperties), pipingFailureMechanismContextProperties.PropertyObjectType); @@ -83,12 +83,6 @@ Assert.IsNull(pipingCalculationContextProperties.GetObjectPropertiesData); Assert.IsNull(pipingCalculationContextProperties.AfterCreate); - var pipingCalculationGroupProperties = propertyInfos.Single(pi => pi.DataType == typeof(PipingCalculationGroupContext)); - Assert.AreEqual(typeof(PipingCalculationGroupContextProperties), pipingCalculationGroupProperties.PropertyObjectType); - Assert.IsNull(pipingCalculationGroupProperties.AdditionalDataCheck); - Assert.IsNull(pipingCalculationGroupProperties.GetObjectPropertiesData); - Assert.IsNull(pipingCalculationGroupProperties.AfterCreate); - var pipingInputContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(PipingInputContext)); Assert.AreEqual(typeof(PipingInputContextProperties), pipingInputContextProperties.PropertyObjectType); Assert.IsNull(pipingInputContextProperties.AdditionalDataCheck);