Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSectionComposition.cs
===================================================================
diff -u -r2389ee6ea48d7014101ea90df5db340b44407c12 -rc8eb333514adae8495778ed16c71c41a6eb4251b
--- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSectionComposition.cs (.../AssessmentSectionComposition.cs) (revision 2389ee6ea48d7014101ea90df5db340b44407c12)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSectionComposition.cs (.../AssessmentSectionComposition.cs) (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -1,4 +1,25 @@
-namespace Ringtoets.Common.Data
+// 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.
+
+namespace Ringtoets.Common.Data
{
///
/// Describes the configuration of an .
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContributionContext.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContributionContext.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContributionContext.cs (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -0,0 +1,118 @@
+// 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;
+
+using Core.Common.Base;
+
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Data.Contribution;
+
+namespace Ringtoets.Common.Forms.PresentationObjects
+{
+ ///
+ /// This class is a presentation object for a instance.
+ ///
+ public sealed class FailureMechanismContributionContext : IEquatable, IObservable
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The contribution.
+ /// The parent of .
+ public FailureMechanismContributionContext(FailureMechanismContribution contribution, IAssessmentSection contributionOwner)
+ {
+ AssertInputsAreNotNull(contribution, contributionOwner);
+
+ WrappedData = contribution;
+ Parent = contributionOwner;
+ }
+
+ ///
+ /// Gets the concrete data instance wrapped by this context object.
+ ///
+ public FailureMechanismContribution WrappedData { get; private set; }
+
+ ///
+ /// Gets the assessment section to which belongs to.
+ ///
+ public IAssessmentSection Parent { get; private set; }
+
+ private void AssertInputsAreNotNull(FailureMechanismContribution contribution, IAssessmentSection contributionOwner)
+ {
+ if (contribution == null)
+ {
+ throw new ArgumentNullException("contribution", "Failure mechanism contribution cannot be null.");
+ }
+
+ if (contributionOwner == null)
+ {
+ throw new ArgumentNullException("contributionOwner", "Assessment section cannot be null.");
+ }
+ }
+
+ #region IEquatable
+
+ public bool Equals(FailureMechanismContributionContext other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+ return WrappedData.Equals(other.WrappedData);
+ }
+
+ public override bool Equals(object obj)
+ {
+ return Equals(obj as FailureMechanismContributionContext);
+ }
+
+ public override int GetHashCode()
+ {
+ return WrappedData.GetHashCode();
+ }
+
+ #endregion
+
+ #region IObservable
+
+ public void Attach(IObserver observer)
+ {
+ WrappedData.Attach(observer);
+ }
+
+ public void Detach(IObserver observer)
+ {
+ WrappedData.Detach(observer);
+ }
+
+ public void NotifyObservers()
+ {
+ WrappedData.NotifyObservers();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r504f726111ede24adc838a345fdcd1c47227c79b -rc8eb333514adae8495778ed16c71c41a6eb4251b
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 504f726111ede24adc838a345fdcd1c47227c79b)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -48,6 +48,7 @@
Code
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContributionContextTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContributionContextTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContributionContextTest.cs (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -0,0 +1,279 @@
+using System;
+using System.Linq;
+
+using Core.Common.Base;
+using Core.Common.TestUtil;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Forms.PresentationObjects;
+
+namespace Ringtoets.Common.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class FailureMechanismContributionContextTest
+ {
+ [Test]
+ public void Contructor_ExpectedValues()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf>(context);
+ Assert.IsInstanceOf(context);
+ Assert.AreSame(contribution, context.WrappedData);
+ Assert.AreSame(assessmentSection, context.Parent);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Contructor_FailureMechanismContributionIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new FailureMechanismContributionContext(null, assessmentSection);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Failure mechanism contribution cannot be null.");
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Contructor_AssessmentSectionIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+
+ // Call
+ TestDelegate call = () => new FailureMechanismContributionContext(contribution, null);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Assessment section cannot be null.");
+ }
+
+ [Test]
+ public void Equals_ToNull_ReturnFalse()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+
+ // Call
+ bool isEqual = context.Equals(null);
+
+ // Assert
+ Assert.IsFalse(isEqual);
+ }
+
+ [Test]
+ public void Equals_ToDifferentObjectType_ReturnFalse()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+ object differentObject = new object();
+
+ // Call
+ bool isEqual1 = context.Equals(differentObject);
+ bool isEqual2 = differentObject.Equals(context);
+
+ // Assert
+ Assert.IsFalse(isEqual1);
+ Assert.IsFalse(isEqual2);
+ }
+
+ [Test]
+ public void Equals_ToEqualObject_ReturnTrue()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context1 = new FailureMechanismContributionContext(contribution, assessmentSection);
+ object context2 = new FailureMechanismContributionContext(contribution, assessmentSection);
+
+ // Call
+ bool isEqual1 = context1.Equals(context2);
+ bool isEqual2 = context2.Equals(context1);
+
+ // Assert
+ Assert.IsTrue(isEqual1);
+ Assert.IsTrue(isEqual2);
+ }
+
+ [Test]
+ public void Equals_ToInequalObject_ReturnFalse()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution1 = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+ var contribution2 = new FailureMechanismContribution(failureMechanisms, 2.2, 40000);
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context1 = new FailureMechanismContributionContext(contribution1, assessmentSection);
+ var context2 = new FailureMechanismContributionContext(contribution2, assessmentSection);
+
+ // Precondition
+ Assert.IsFalse(contribution1.Equals(contribution2));
+
+ // Call
+ bool isEqual1 = context1.Equals(context2);
+ bool isEqual2 = context2.Equals(context1);
+
+ // Assert
+ Assert.IsFalse(isEqual1);
+ Assert.IsFalse(isEqual2);
+ }
+
+ [Test]
+ public void GetHashCode_ComparingEqualObject_ReturnEqualHashCodes()
+ {
+ // Setup
+ var failureMechanisms = Enumerable.Empty();
+ var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000);
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context1 = new FailureMechanismContributionContext(contribution, assessmentSection);
+ var context2 = new FailureMechanismContributionContext(contribution, assessmentSection);
+
+ // Call
+ int hash1 = context1.GetHashCode();
+ int hash2 = context2.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(hash1, hash2);
+ }
+
+ [Test]
+ public void NotifyObservers_WithAttachedObserver_UpdateObserverCalled()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000);
+
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+ context.Attach(observer);
+
+ // Call
+ context.NotifyObservers();
+
+ // Assert
+ mocks.VerifyAll(); // Expect UpdateObserver called
+ }
+
+ [Test]
+ public void NotifyObservers_WithDetachedObserver_NoUpdateObserverCalled()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000);
+
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+ context.Attach(observer);
+ context.Detach(observer);
+
+ // Call
+ context.NotifyObservers();
+
+ // Assert
+ mocks.VerifyAll(); // Expect no UpdateObserver call
+ }
+
+ [Test]
+ public void NotifyObservers_WithAttachedObserverToContribution_UpdateObserverCalled()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000);
+ contribution.Attach(observer);
+
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+
+ // Call
+ context.NotifyObservers();
+
+ // Assert
+ mocks.VerifyAll(); // Expect UpdateObserver called
+ }
+
+ [Test]
+ public void GivenObserverAttachedToContext_WhenWrappedDataNotifiesObservers_ThenUpdateObserverCalled()
+ {
+ // Given
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000);
+
+ var context = new FailureMechanismContributionContext(contribution, assessmentSection);
+ context.Attach(observer);
+
+ // When
+ contribution.NotifyObservers();
+
+ // Then
+ mocks.VerifyAll(); // Expect no UpdateObserver call
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r504f726111ede24adc838a345fdcd1c47227c79b -rc8eb333514adae8495778ed16c71c41a6eb4251b
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 504f726111ede24adc838a345fdcd1c47227c79b)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -61,6 +61,7 @@
+
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs
===================================================================
diff -u -r504f726111ede24adc838a345fdcd1c47227c79b -rc8eb333514adae8495778ed16c71c41a6eb4251b
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 504f726111ede24adc838a345fdcd1c47227c79b)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -50,48 +50,19 @@
{
Name = Resources.AssessmentSection_DisplayName;
- PipingFailureMechanism = new PipingFailureMechanism
- {
- Contribution = 24
- };
- GrassErosionFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassErosionFailureMechanism_DisplayName)
- {
- Contribution = 24
- };
- MacrostabilityInwardFailureMechanism = new FailureMechanismPlaceholder(Resources.MacrostabilityInwardFailureMechanism_DisplayName)
- {
- Contribution = 4
- };
- OvertoppingFailureMechanism = new FailureMechanismPlaceholder(Resources.OvertoppingFailureMechanism_DisplayName)
- {
- Contribution = 2
- };
- ClosingFailureMechanism = new FailureMechanismPlaceholder(Resources.ClosingFailureMechanism_DisplayName)
- {
- Contribution = 4
- };
- FailingOfConstructionFailureMechanism = new FailureMechanismPlaceholder(Resources.FailingOfConstructionFailureMechanism_DisplayName)
- {
- Contribution = 2
- };
- StoneRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.StoneRevetmentFailureMechanism_DisplayName)
- {
- Contribution = 4
- };
- AsphaltRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.AsphaltRevetmentFailureMechanism_DisplayName)
- {
- Contribution = 3
- };
- GrassRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassRevetmentFailureMechanism_DisplayName)
- {
- Contribution = 3
- };
- DuneErosionFailureMechanism = new FailureMechanismPlaceholder(Resources.ErosionFailureMechanism_DisplayName)
- {
- Contribution = 0
- };
+ PipingFailureMechanism = new PipingFailureMechanism();
+ GrassErosionFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassErosionFailureMechanism_DisplayName);
+ MacrostabilityInwardFailureMechanism = new FailureMechanismPlaceholder(Resources.MacrostabilityInwardFailureMechanism_DisplayName);
+ OvertoppingFailureMechanism = new FailureMechanismPlaceholder(Resources.OvertoppingFailureMechanism_DisplayName);
+ ClosingFailureMechanism = new FailureMechanismPlaceholder(Resources.ClosingFailureMechanism_DisplayName);
+ FailingOfConstructionFailureMechanism = new FailureMechanismPlaceholder(Resources.FailingOfConstructionFailureMechanism_DisplayName);
+ StoneRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.StoneRevetmentFailureMechanism_DisplayName);
+ AsphaltRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.AsphaltRevetmentFailureMechanism_DisplayName);
+ GrassRevetmentFailureMechanism = new FailureMechanismPlaceholder(Resources.GrassRevetmentFailureMechanism_DisplayName);
+ DuneErosionFailureMechanism = new FailureMechanismPlaceholder(Resources.ErosionFailureMechanism_DisplayName);
FailureMechanismContribution = new FailureMechanismContribution(GetFailureMechanisms(), 30, 30000);
+ ChangeComposition(AssessmentSectionComposition.Dike);
}
///
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs
===================================================================
diff -u -r2389ee6ea48d7014101ea90df5db340b44407c12 -rc8eb333514adae8495778ed16c71c41a6eb4251b
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision 2389ee6ea48d7014101ea90df5db340b44407c12)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -22,10 +22,14 @@
using System;
using System.Linq;
using System.Windows.Forms;
+
using Core.Common.Base;
using Core.Common.Controls.Views;
using Core.Common.Utils.Reflection;
+
using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Forms.PresentationObjects;
+
using CommonGuiResources = Core.Common.Gui.Properties.Resources;
using RingtoetsIntegrationFormsResources = Ringtoets.Integration.Forms.Properties.Resources;
@@ -39,7 +43,7 @@
public partial class FailureMechanismContributionView : UserControl, IView, IObserver
{
private DataGridViewColumn probabilityPerYearColumn;
- private FailureMechanismContribution data;
+ private FailureMechanismContributionContext data;
///
/// Creates a new instance of .
@@ -61,7 +65,7 @@
}
set
{
- HandleNewDataSet((FailureMechanismContribution) value);
+ HandleNewDataSet((FailureMechanismContributionContext)value);
}
}
@@ -99,7 +103,7 @@
{
if (e.ColumnIndex == probabilityPerYearColumn.Index)
{
- var contributionItem = data.Distribution.ElementAt(e.RowIndex);
+ var contributionItem = data.WrappedData.Distribution.ElementAt(e.RowIndex);
if (contributionItem.Contribution == 0.0)
{
e.Value = RingtoetsIntegrationFormsResources.FailureMechanismContributionView_ProbabilityPerYear_Not_applicable;
@@ -108,7 +112,7 @@
}
}
- private void HandleNewDataSet(FailureMechanismContribution value)
+ private void HandleNewDataSet(FailureMechanismContributionContext value)
{
UnbindNormChange();
DetachFromData();
@@ -126,7 +130,7 @@
{
if (data != null)
{
- probabilityDistributionGrid.DataSource = data.Distribution;
+ probabilityDistributionGrid.DataSource = data.WrappedData.Distribution;
}
}
@@ -168,8 +172,10 @@
private void NormValueChanged(object sender, EventArgs eventArgs)
{
- data.Norm = Convert.ToInt32(normInput.Value);
- data.NotifyObservers();
+ FailureMechanismContribution contribution = data.WrappedData;
+
+ contribution.Norm = Convert.ToInt32(normInput.Value);
+ contribution.NotifyObservers();
}
private void ResetTextIfEmtpy()
@@ -184,7 +190,7 @@
{
if (data != null)
{
- normInput.Value = data.Norm;
+ normInput.Value = data.WrappedData.Norm;
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -r48e25b3492e67a3e4f7220ed1740c0306e79f0ce -rc8eb333514adae8495778ed16c71c41a6eb4251b
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 48e25b3492e67a3e4f7220ed1740c0306e79f0ce)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision c8eb333514adae8495778ed16c71c41a6eb4251b)
@@ -90,7 +90,7 @@
///
public override IEnumerable GetViewInfos()
{
- yield return new ViewInfo
+ yield return new ViewInfo
{
GetViewName = (v, o) => RingtoetsDataResources.FailureMechanismContribution_DisplayName,
Image = RingtoetsCommonFormsResources.GenericInputOutputIcon,
@@ -199,11 +199,11 @@
ContextMenuStrip = CategoryTreeFolderContextMenu
};
- yield return new TreeNodeInfo
+ yield return new TreeNodeInfo
{
Text = failureMechanismContribution => RingtoetsDataResources.FailureMechanismContribution_DisplayName,
Image = failureMechanismContribution => RingtoetsCommonFormsResources.GenericInputOutputIcon,
- ContextMenuStrip = (failureMechanismContribution, parentData, treeViewControl) => Gui.Get(failureMechanismContribution, treeViewControl)
+ ContextMenuStrip = (failureMechanismContribution, parentData, treeViewControl) => Gui.Get(failureMechanismContribution.WrappedData, treeViewControl)
.AddOpenItem()
.AddSeparator()
.AddExportItem()
@@ -240,12 +240,13 @@
};
}
- #region FailureMechanismContribution ViewInfo
+ #region FailureMechanismContributionContext ViewInfo
private static bool CloseFailureMechanismContributionViewForData(FailureMechanismContributionView view, object o)
{
var assessmentSection = o as IAssessmentSection;
- return assessmentSection != null && assessmentSection.FailureMechanismContribution == view.Data;
+ var viewData = view.Data as FailureMechanismContributionContext;
+ return assessmentSection != null && viewData != null && assessmentSection.FailureMechanismContribution == viewData.WrappedData;
}
#endregion
@@ -288,7 +289,7 @@
var childNodes = new List