Index: Core/Common/src/Core.Common.Controls/PresentationObjects/WrappedObjectContextBase.cs
===================================================================
diff -u -r59fccb6e0e34d12c43db9b9ea467b14396d78f5d -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Core/Common/src/Core.Common.Controls/PresentationObjects/WrappedObjectContextBase.cs (.../WrappedObjectContextBase.cs) (revision 59fccb6e0e34d12c43db9b9ea467b14396d78f5d)
+++ Core/Common/src/Core.Common.Controls/PresentationObjects/WrappedObjectContextBase.cs (.../WrappedObjectContextBase.cs) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -1,5 +1,26 @@
-using System;
+// 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 Core.Common.Base;
namespace Core.Common.Controls.PresentationObjects
Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs
===================================================================
diff -u -r86980636aab6d77f5a7d072210edc5d6303a59f4 -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 86980636aab6d77f5a7d072210edc5d6303a59f4)
+++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -606,6 +606,15 @@
}
///
+ /// Looks up a localized string similar to Algemeen filter.
+ ///
+ public static string FailureMechanismContributionView_GridColumn_RelevancyFilter {
+ get {
+ return ResourceManager.GetString("FailureMechanismContributionView_GridColumn_RelevancyFilter", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap folder {
Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx
===================================================================
diff -u -r86980636aab6d77f5a7d072210edc5d6303a59f4 -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 86980636aab6d77f5a7d072210edc5d6303a59f4)
+++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -688,4 +688,7 @@
Openen van een nieuw Ringtoetsproject geannuleerd.
+
+ Algemeen filter
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs
===================================================================
diff -u -rc4d2af65ad23757fb3bd11f93458839bc1787ded -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs (.../FailureMechanismContext.cs) (revision c4d2af65ad23757fb3bd11f93458839bc1787ded)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs (.../FailureMechanismContext.cs) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -20,6 +20,9 @@
// All rights reserved.
using System;
+
+using Core.Common.Controls.PresentationObjects;
+
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.FailureMechanism;
@@ -28,74 +31,32 @@
///
/// This class is a presentation object for a instance.
///
- public abstract class FailureMechanismContext where T : IFailureMechanism
+ public abstract class FailureMechanismContext : WrappedObjectContextBase where T : IFailureMechanism
{
///
/// Initializes a new instance of the class.
///
/// The failure mechanism.
/// The parent of .
/// Thrown when or are null.
- protected FailureMechanismContext(T wrappedFailureMechanism, IAssessmentSection parent)
+ protected FailureMechanismContext(T wrappedFailureMechanism, IAssessmentSection parent) : base(wrappedFailureMechanism)
{
- AssertInputsAreNotNull(wrappedFailureMechanism, parent);
+ AssertInputsAreNotNull(parent);
- WrappedData = wrappedFailureMechanism;
Parent = parent;
}
///
- /// Gets the parent of .
+ /// Gets the parent of .
///
public IAssessmentSection Parent { get; private set; }
- ///
- /// Gets the wrapped failure mechanism.
- ///
- public T WrappedData { get; private set; }
-
- private void AssertInputsAreNotNull(T wrappedFailureMechanism, IAssessmentSection parent)
+ private void AssertInputsAreNotNull(IAssessmentSection parent)
{
- if (wrappedFailureMechanism == null)
- {
- throw new ArgumentNullException("wrappedFailureMechanism", "Failure mechanism cannot be null.");
- }
-
if (parent == null)
{
throw new ArgumentNullException("parent", "The assessment section cannot be null.");
}
}
-
- #region Equals implementation
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj))
- {
- return false;
- }
- if (ReferenceEquals(this, obj))
- {
- return true;
- }
- if (obj.GetType() != GetType())
- {
- return false;
- }
- return Equals((FailureMechanismContext) obj);
- }
-
- public override int GetHashCode()
- {
- return WrappedData.GetHashCode();
- }
-
- private bool Equals(FailureMechanismContext other)
- {
- return WrappedData.Equals(other.WrappedData);
- }
-
- #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -rf7a9f7239374705ff1d732e9666c0cb62ebaafd0 -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f7a9f7239374705ff1d732e9666c0cb62ebaafd0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.17929
+// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -239,6 +239,16 @@
}
///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap FailureMechanismIcon {
+ get {
+ object obj = ResourceManager.GetObject("FailureMechanismIcon", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Niet alle berekeningen voor dit vak zijn uitgevoerd..
///
public static string FailureMechanismResultView_DataGridViewCellFormatting_Not_all_calculations_are_executed {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -rf7a9f7239374705ff1d732e9666c0cb62ebaafd0 -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision f7a9f7239374705ff1d732e9666c0cb62ebaafd0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -253,4 +253,7 @@
-
+
+ ..\Resources\control_equalizer_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Resources/control_equalizer_blue.png
===================================================================
diff -u
Binary files differ
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r0b081b2391e73b7e3ff04ef31fafd2df1b1571e3 -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 0b081b2391e73b7e3ff04ef31fafd2df1b1571e3)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -59,6 +59,7 @@
True
Resources.resx
+
UserControl
@@ -92,11 +93,19 @@
Core.Common.Base
False
+
+ {1d27f91f-4e62-4eaf-a0a8-a32708b9a9b1}
+ Core.Common.Controls.TreeView
+
{9a2d67e6-26ac-4d17-b11a-2b4372f2f572}
Core.Common.Controls
False
+
+ {30e4c2ae-719e-4d70-9fa9-668a9767fbfa}
+ Core.Common.Gui
+
{c90b77da-e421-43cc-b82e-529651bc21ac}
Core.Common.Version
@@ -138,6 +147,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/DefaultFailureMechanismTreeNodeInfo.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/DefaultFailureMechanismTreeNodeInfo.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/DefaultFailureMechanismTreeNodeInfo.cs (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -0,0 +1,85 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui.ContextMenu;
+
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.Common.Forms.TreeNodeInfos
+{
+ public class DefaultFailureMechanismTreeNodeInfo : TreeNodeInfo where TContext : FailureMechanismContext where TFailureMechanism: IFailureMechanism
+ {
+ private readonly Func getEnabledFailureMechanismChildNodes;
+ private readonly Func getEnabledFailureMechanismContextMenuStrip;
+ private readonly IContextMenuBuilderProvider contextMenuBuilderProvider;
+
+ public DefaultFailureMechanismTreeNodeInfo(Func getEnabledFailureMechanismChildNodes,
+ Func getEnabledFailureMechanismContextMenuStrip,
+ IContextMenuBuilderProvider provider)
+ {
+ this.getEnabledFailureMechanismChildNodes = getEnabledFailureMechanismChildNodes;
+ this.getEnabledFailureMechanismContextMenuStrip = getEnabledFailureMechanismContextMenuStrip;
+ contextMenuBuilderProvider = provider;
+
+ Text = GetNodeText;
+ Image = GetImage;
+ ForeColor = GetForeColor;
+ ChildNodeObjects = GetChildNodeObjects;
+ ContextMenuStrip = GetContextMenuStrip;
+ }
+
+ private ContextMenuStrip GetContextMenuStrip(TContext context, object parent, TreeViewControl treeView)
+ {
+ if (context.WrappedData.IsRelevant && getEnabledFailureMechanismContextMenuStrip != null)
+ {
+ return getEnabledFailureMechanismContextMenuStrip(context, parent, treeView);
+ }
+ return contextMenuBuilderProvider.Get(context, treeView)
+ .AddExpandAllItem()
+ .AddCollapseAllItem()
+ .Build();
+ }
+
+ private object[] GetChildNodeObjects(TContext failureMechanismContext)
+ {
+ if (failureMechanismContext.WrappedData.IsRelevant)
+ {
+ return getEnabledFailureMechanismChildNodes != null ?
+ getEnabledFailureMechanismChildNodes(failureMechanismContext) :
+ new object[0];
+ }
+
+ return GetDisbledFailureMechanismChildNodeObjects(failureMechanismContext);
+ }
+
+ private static object[] GetDisbledFailureMechanismChildNodeObjects(TContext failureMechanismContext)
+ {
+ return new object[]
+ {
+ new CommentContext(failureMechanismContext.WrappedData)
+ };
+ }
+
+ private Color GetForeColor(TContext failureMechanismContext)
+ {
+ return failureMechanismContext.WrappedData.IsRelevant ?
+ Color.FromKnownColor(KnownColor.ControlText) :
+ Color.FromKnownColor(KnownColor.GrayText);
+ }
+
+ private Image GetImage(TContext failureMechanismContext)
+ {
+ return Resources.FailureMechanismIcon;
+ }
+
+ private string GetNodeText(TContext failureMechanismContext)
+ {
+ return failureMechanismContext.WrappedData.Name;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContextTest.cs
===================================================================
diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContextTest.cs (.../FailureMechanismContextTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContextTest.cs (.../FailureMechanismContextTest.cs) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -3,7 +3,6 @@
using Rhino.Mocks;
-using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Forms.PresentationObjects;
@@ -44,7 +43,7 @@
// Assert
var exception = Assert.Throws(test);
- Assert.AreEqual("wrappedFailureMechanism", exception.ParamName);
+ Assert.AreEqual("wrappedData", exception.ParamName);
}
[Test]
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -rf1bd17ba95b3fbae5928d4240523d50d8b83b64d -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision f1bd17ba95b3fbae5928d4240523d50d8b83b64d)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -66,6 +66,7 @@
+
@@ -77,7 +78,7 @@
{1d27f91f-4e62-4eaf-a0a8-a32708b9a9b1}
Core.Common.Controls.TreeView
- False
+ True
{9a2d67e6-26ac-4d17-b11a-2b4372f2f572}
@@ -114,6 +115,7 @@
+