Index: Core/Common/src/Core.Common.Gui/Attributes/DynamicPropertyOrderAttribute.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Gui/Attributes/DynamicPropertyOrderAttribute.cs (revision 0)
+++ Core/Common/src/Core.Common.Gui/Attributes/DynamicPropertyOrderAttribute.cs (revision d4d24f72de2e86b7215351ed29e1debb8dd1de0d)
@@ -0,0 +1,60 @@
+// 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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;
+using System.Reflection;
+using Core.Common.Gui.Properties;
+
+namespace Core.Common.Gui.Attributes
+{
+ [AttributeUsage(AttributeTargets.Property)]
+ public sealed class DynamicPropertyOrderAttribute : Attribute
+ {
+ public static int Order(object obj, string propertyName)
+ {
+ if (string.IsNullOrEmpty(propertyName))
+ {
+ return 0;
+ }
+
+ if (!IsPropertyDynamicOrdered(obj, propertyName))
+ {
+ return 0;
+ }
+
+ var propertyOrder = DynamicPropertyOrderMethodAttribute.CreatePropertyOrderMethod(obj);
+
+ return propertyOrder(propertyName);
+ }
+
+ private static bool IsPropertyDynamicOrdered(object obj, string propertyName)
+ {
+ MemberInfo propertyInfo = obj.GetType().GetProperty(propertyName);
+ if (propertyInfo == null)
+ {
+ throw new MissingMemberException(string.Format(Resources.Could_not_find_property_0_on_type_1_, propertyName,
+ obj.GetType()));
+ }
+
+ return IsDefined(propertyInfo, typeof(DynamicPropertyOrderAttribute));
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Attributes/DynamicPropertyOrderMethodAttribute.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Gui/Attributes/DynamicPropertyOrderMethodAttribute.cs (revision 0)
+++ Core/Common/src/Core.Common.Gui/Attributes/DynamicPropertyOrderMethodAttribute.cs (revision d4d24f72de2e86b7215351ed29e1debb8dd1de0d)
@@ -0,0 +1,94 @@
+// 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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;
+using System.Linq;
+using System.Reflection;
+using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources;
+
+namespace Core.Common.Gui.Attributes
+{
+ [AttributeUsage(AttributeTargets.Method)]
+ public sealed class DynamicPropertyOrderMethodAttribute : Attribute
+ {
+ public delegate int PropertyOrder(string propertyName);
+
+ public static PropertyOrder CreatePropertyOrderMethod(object target)
+ {
+ var methodInfo = GetPropertyOrderMethod(target);
+ ValidateMethodInfo(methodInfo);
+ return CreatePropertyOrderDelegate(target, methodInfo);
+ }
+
+ private static PropertyOrder CreatePropertyOrderDelegate(object target, MethodInfo methodInfo)
+ {
+ return (PropertyOrder) Delegate.CreateDelegate(typeof(PropertyOrder), target, methodInfo);
+ }
+
+ private static void ValidateMethodInfo(MethodInfo methodInfo)
+ {
+ if (methodInfo.ReturnType != typeof(int))
+ {
+ var message = string.Format(CoreCommonGuiResources.DynamicPropertyOrderMethod_must_return_int_on_Class_0_,
+ methodInfo.DeclaringType);
+ throw new MissingMethodException(message);
+ }
+
+ ParameterInfo[] parameterInfos = methodInfo.GetParameters();
+ if (parameterInfos.Length != 1)
+ {
+ var message = string.Format(CoreCommonGuiResources.DynamicPropertyOrderMethod_incorrect_argument_count_must_be_one_string_argument_on_Class_0_,
+ methodInfo.DeclaringType);
+ throw new MissingMethodException(message);
+ }
+
+ if (parameterInfos[0].ParameterType != typeof(string))
+ {
+ var message = string.Format(CoreCommonGuiResources.DynamicPropertyOrderMethod_must_have_string_argument_on_Class_0_,
+ methodInfo.DeclaringType);
+ throw new MissingMethodException(message);
+ }
+ }
+
+ private static MethodInfo GetPropertyOrderMethod(object obj)
+ {
+ var propertyOrderMethods = obj.GetType().GetMethods()
+ .Where(methodInfo => IsDefined(methodInfo, typeof(DynamicPropertyOrderMethodAttribute)))
+ .ToArray();
+
+ if (propertyOrderMethods.Length == 0)
+ {
+ var message = string.Format(CoreCommonGuiResources.DynamicPropertyOrderMethod_not_found_or_not_public_on_Class_0_,
+ obj.GetType());
+ throw new MissingMethodException(message);
+ }
+
+ if (propertyOrderMethods.Length > 1)
+ {
+ var message = string.Format(CoreCommonGuiResources.DynamicPropertyOrderMethod_only_one_allowed_per_Class_0_,
+ obj.GetType());
+ throw new MissingMethodException(message);
+ }
+
+ return propertyOrderMethods[0];
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj
===================================================================
diff -u -r7da60d6a03b1443834aba2cf1e9857351acb5699 -rd4d24f72de2e86b7215351ed29e1debb8dd1de0d
--- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 7da60d6a03b1443834aba2cf1e9857351acb5699)
+++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision d4d24f72de2e86b7215351ed29e1debb8dd1de0d)
@@ -98,6 +98,8 @@
+
+
Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs
===================================================================
diff -u -r93d214db8ac0a90b6f1bf1712a414e4f31c3eed9 -rd4d24f72de2e86b7215351ed29e1debb8dd1de0d
--- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 93d214db8ac0a90b6f1bf1712a414e4f31c3eed9)
+++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d4d24f72de2e86b7215351ed29e1debb8dd1de0d)
@@ -405,6 +405,52 @@
}
///
+ /// Looks up a localized string similar to DynamicPropertyOrderMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {0}..
+ ///
+ public static string DynamicPropertyOrderMethod_incorrect_argument_count_must_be_one_string_argument_on_Class_0_ {
+ get {
+ return ResourceManager.GetString("DynamicPropertyOrderMethod_incorrect_argument_count_must_be_one_string_argument_o" +
+ "n_Class_0_", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Argument van DynamicPropertyOrderMethod moet van het type 'string' zijn. Klasse: {0}..
+ ///
+ public static string DynamicPropertyOrderMethod_must_have_string_argument_on_Class_0_ {
+ get {
+ return ResourceManager.GetString("DynamicPropertyOrderMethod_must_have_string_argument_on_Class_0_", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DynamicPropertyOrderMethod moet 'int' als 'return type' hebben. Klasse: {0}..
+ ///
+ public static string DynamicPropertyOrderMethod_must_return_int_on_Class_0_ {
+ get {
+ return ResourceManager.GetString("DynamicPropertyOrderMethod_must_return_int_on_Class_0_", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DynamicPropertyOrderMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {0}..
+ ///
+ public static string DynamicPropertyOrderMethod_not_found_or_not_public_on_Class_0_ {
+ get {
+ return ResourceManager.GetString("DynamicPropertyOrderMethod_not_found_or_not_public_on_Class_0_", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Slechts één DynamicPropertyOrderMethod toegestaan per klasse: {0}..
+ ///
+ public static string DynamicPropertyOrderMethod_only_one_allowed_per_Class_0_ {
+ get {
+ return ResourceManager.GetString("DynamicPropertyOrderMethod_only_one_allowed_per_Class_0_", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to DynamicReadOnlyValidationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {0}..
///
public static string DynamicReadOnlyValidationMethod_incorrect_argument_count_must_be_one_string_argument_on_Class_0_ {
Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx
===================================================================
diff -u -r93d214db8ac0a90b6f1bf1712a414e4f31c3eed9 -rd4d24f72de2e86b7215351ed29e1debb8dd1de0d
--- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 93d214db8ac0a90b6f1bf1712a414e4f31c3eed9)
+++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision d4d24f72de2e86b7215351ed29e1debb8dd1de0d)
@@ -478,6 +478,21 @@
Slechts één DynamicVisibleValidationMethod toegestaan per klasse: {0}.
+
+ DynamicPropertyOrderMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {0}.
+
+
+ Slechts één DynamicPropertyOrderMethod toegestaan per klasse: {0}.
+
+
+ DynamicPropertyOrderMethod moet 'int' als 'return type' hebben. Klasse: {0}.
+
+
+ DynamicPropertyOrderMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {0}.
+
+
+ Argument van DynamicPropertyOrderMethod moet van het type 'string' zijn. Klasse: {0}.
+
Het is niet gelukt om het Ringtoetsproject te laden.
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs
===================================================================
diff -u -rba2eefab3569d05ed59629b5d02dc8420bc1163a -rd4d24f72de2e86b7215351ed29e1debb8dd1de0d
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs (.../HeightStructuresInputContextProperties.cs) (revision ba2eefab3569d05ed59629b5d02dc8420bc1163a)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs (.../HeightStructuresInputContextProperties.cs) (revision d4d24f72de2e86b7215351ed29e1debb8dd1de0d)
@@ -96,7 +96,7 @@
///
/// Returns the available height structures in order for the user to select one to
- /// set .
+ /// set .
///
/// The available height structures.
public IEnumerable GetAvailableHeightStructures()