Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.Designer.cs
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.Designer.cs (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.Designer.cs (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -0,0 +1,93 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Riskeer.AssemblyTool.Data;
+
+namespace Riskeer.Integration.Forms.Views
+{
+ partial class AssemblyGroupsView
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.assemblyCategoriesTable = new AssemblyCategoriesTable();
+ this.groupBoxPanel = new System.Windows.Forms.Panel();
+ this.groupBoxPanel.SuspendLayout();
+ this.groupBox = new System.Windows.Forms.GroupBox();
+ this.groupBox.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // failureMechanismAssemblyCategoriesTable
+ //
+ this.assemblyCategoriesTable.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.assemblyCategoriesTable.MultiSelect = true;
+ this.assemblyCategoriesTable.Name = "assemblyCategoriesTable";
+ this.assemblyCategoriesTable.Padding = new System.Windows.Forms.Padding(5);
+ this.assemblyCategoriesTable.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
+ //
+ // groupBoxPanel
+ //
+ this.groupBoxPanel.Controls.Add(this.groupBox);
+ this.groupBoxPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupBoxPanel.Name = "groupBoxPanel";
+ this.groupBoxPanel.Padding = new System.Windows.Forms.Padding(3);
+ //
+ // groupBox
+ //
+ this.groupBox.Controls.Add(assemblyCategoriesTable);
+ this.groupBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupBox.Location = new System.Drawing.Point(0, 0);
+ this.groupBox.Margin = new System.Windows.Forms.Padding(5);
+ this.groupBox.Name = "groupBox";
+ this.groupBox.Size = new System.Drawing.Size(150, 150);
+ this.groupBox.TabIndex = 0;
+ this.groupBox.TabStop = false;
+ this.groupBox.Text = "Duidingsklassen";
+ //
+ // AssemblyGroupsView
+ //
+ this.Name = "AssemblyGroupsView";
+ this.Controls.Add(this.groupBoxPanel);
+ this.Size = new System.Drawing.Size(750, 420);
+ this.AutoScrollMinSize = new System.Drawing.Size(400, 100);
+ this.groupBoxPanel.ResumeLayout(false);
+ this.groupBox.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private AssemblyCategoriesTable assemblyCategoriesTable;
+ private System.Windows.Forms.GroupBox groupBox;
+ private System.Windows.Forms.Panel groupBoxPanel;
+ }
+}
Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.cs
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.cs (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.cs (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -0,0 +1,87 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.Integration.Data;
+
+namespace Riskeer.Integration.Forms.Views
+{
+ ///
+ /// View to show a collection of .
+ ///
+ public partial class AssemblyGroupsView : UserControl, IView
+ {
+ private readonly Observer failureMechanismContributionObserver;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The assessment section.
+ /// Thrown when any parameter is null.
+ public AssemblyGroupsView(AssessmentSection assessmentSection)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ AssessmentSection = assessmentSection;
+
+ InitializeComponent();
+
+ failureMechanismContributionObserver = new Observer(UpdateTableData)
+ {
+ Observable = assessmentSection.FailureMechanismContribution
+ };
+
+ UpdateTableData();
+ }
+
+ public AssessmentSection AssessmentSection { get; }
+
+ public object Data { get; set; }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ failureMechanismContributionObserver.Dispose();
+ components?.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void UpdateTableData()
+ {
+ // assemblyCategoriesTable.SetData(
+ // getAssemblyCategoriesFunc().Select(
+ // category => new Tuple(
+ // category,
+ // AssemblyCategoryGroupColorHelper.GetFailureMechanismAssemblyCategoryGroupColor(category.Group),
+ // category.Group)).ToArray());
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.resx
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.resx (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyGroupsView.resx (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs
===================================================================
diff -u -rae3a814fe551ccb267577cca11f1cc8d136f1dba -rc8ac3de5e56e79827907f09f464537172616a61e
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision ae3a814fe551ccb267577cca11f1cc8d136f1dba)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -479,6 +479,12 @@
CloseForData = (view, dataToCloseFor) => ReferenceEquals(view.AssessmentSection, dataToCloseFor),
CreateInstance = context => new AssemblyResultPerSectionMapView(context.WrappedData)
};
+
+ yield return new RiskeerViewInfo(() => Gui)
+ {
+ GetViewName = (view, context) => "Duidingsklassen",
+ CreateInstance = context => new AssemblyGroupsView(context.WrappedData)
+ };
}
public override IEnumerable GetImportInfos()
Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/AssemblyGroupsViewTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/AssemblyGroupsViewTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/AssemblyGroupsViewTest.cs (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -0,0 +1,143 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 System.Linq;
+using System.Windows.Forms;
+using Core.Common.Controls.Views;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Forms.TestUtil;
+using Riskeer.Integration.Data;
+using Riskeer.Integration.Forms.Views;
+
+namespace Riskeer.Integration.Forms.Test.Views
+{
+ [TestFixture]
+ public class AssemblyGroupsViewTest
+ {
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new AssemblyGroupsView(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+
+ // Call
+ using (var view = new AssemblyGroupsView(assessmentSection))
+ {
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
+ Assert.IsNull(view.Data);
+ Assert.AreSame(assessmentSection, view.AssessmentSection);
+
+ Assert.AreEqual(1, view.Controls.Count);
+
+ Panel groupBoxPanel = ControlTestHelper.GetControls(view, "groupBoxPanel").Single();
+ Assert.AreEqual(1, groupBoxPanel.Controls.Count);
+ Assert.AreEqual(DockStyle.Fill, groupBoxPanel.Dock);
+
+ GroupBox groupBox = ControlTestHelper.GetControls(groupBoxPanel, "groupBox").Single();
+ Assert.AreEqual(1, groupBox.Controls.Count);
+ Assert.AreEqual(DockStyle.Fill, groupBox.Dock);
+ Assert.AreEqual("Duidingsklassen", groupBox.Text);
+
+ AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismCategoriesTable(view);
+ Assert.AreEqual(DockStyle.Fill, failureMechanismSectionCategoriesTable.Dock);
+ }
+ }
+
+ // [Test]
+ // public void Constructor_WithValidParameters_FillTableWithData()
+ // {
+ // // Setup
+ // var random = new Random(21);
+ //
+ // var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ // const int nrOfCategories = 1;
+ // Func> getAssemblyCategoriesFunc =
+ // () => Enumerable.Repeat(CreateRandomFailureMechanismAssemblyCategory(random), nrOfCategories);
+ //
+ // // Call
+ // using (var view = new AssemblyGroupsView(assessmentSection))
+ // {
+ // AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismCategoriesTable(view);
+ //
+ // // Assert
+ // Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+ // }
+ // }
+ //
+ // [Test]
+ // public void GivenViewWithValidData_WhenFailureMechanismContributionUpdated_ThenDataTableUpdated()
+ // {
+ // // Given
+ // var random = new Random(21);
+ //
+ // var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ // var nrOfCategories = 1;
+ // Func> getFailureMechanismCategories =
+ // () => Enumerable.Repeat(CreateRandomFailureMechanismAssemblyCategory(random), nrOfCategories);
+ //
+ // using (var view = new AssemblyGroupsView(assessmentSection))
+ // {
+ // AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismCategoriesTable(view);
+ //
+ // // Precondition
+ // Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+ //
+ // // When
+ // nrOfCategories = 2;
+ // assessmentSection.FailureMechanismContribution.NotifyObservers();
+ //
+ // // Then
+ // Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+ // }
+ // }
+
+ private static AssemblyCategoriesTable GetFailureMechanismCategoriesTable(
+ AssemblyGroupsView view)
+ {
+ return ControlTestHelper.GetControls>(
+ view, "assemblyCategoriesTable").Single();
+ }
+
+ private static FailureMechanismAssemblyCategory CreateRandomFailureMechanismAssemblyCategory(Random random)
+ {
+ return new FailureMechanismAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue());
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs
===================================================================
diff -u -r3d6d40241eb27b32fa9dfcff845bb9d9a6139367 -rc8ac3de5e56e79827907f09f464537172616a61e
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 3d6d40241eb27b32fa9dfcff845bb9d9a6139367)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -382,7 +382,7 @@
ViewInfo[] viewInfos = plugin.GetViewInfos().ToArray();
// Assert
- Assert.AreEqual(24, viewInfos.Length);
+ Assert.AreEqual(25, viewInfos.Length);
PluginTestHelper.AssertViewInfoDefined(
viewInfos,
@@ -522,6 +522,12 @@
typeof(SpecificFailurePathContext),
typeof(SpecificFailurePathView));
+ PluginTestHelper.AssertViewInfoDefined(
+ viewInfos,
+ typeof(AssemblyGroupsContext),
+ typeof(AssessmentSection),
+ typeof(AssemblyGroupsView));
+
viewInfos.ForEachElementDo(vi =>
{
Assert.AreEqual(symbol, vi.GetSymbol());
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/AssemblyGroupsViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/AssemblyGroupsViewInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/ViewInfos/AssemblyGroupsViewInfoTest.cs (revision c8ac3de5e56e79827907f09f464537172616a61e)
@@ -0,0 +1,86 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 System.Linq;
+using Core.Common.TestUtil;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Integration.Data;
+using Riskeer.Integration.Forms.PresentationObjects;
+using Riskeer.Integration.Forms.Views;
+
+namespace Riskeer.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class AssemblyGroupsViewInfoTest
+ {
+ private RiskeerPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new RiskeerPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(AssemblyGroupsView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(AssemblyGroupsContext), info.DataType);
+ Assert.AreEqual(typeof(AssessmentSection), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Duidingsklassen", viewName);
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_SetsExpectedViewProperties()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+ var context = new AssemblyGroupsContext(assessmentSection);
+
+ // Call
+ var view = (AssemblyGroupsView) info.CreateInstance(context);
+
+ // Assert
+ Assert.AreSame(assessmentSection, view.AssessmentSection);
+ }
+ }
+}
\ No newline at end of file