Index: Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/AssessmentSectionStateRootContext.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/AssessmentSectionStateRootContext.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/AssessmentSectionStateRootContext.cs (revision 95157f917f36c0bd55d2b1e6590cd8fcd9567391) @@ -0,0 +1,42 @@ +// 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 Core.Common.Controls.PresentationObjects; +using Riskeer.Integration.Data; + +namespace Riskeer.Common.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an instance of . + /// + public class AssessmentSectionStateRootContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The which the + /// belongs to. + /// Thrown when is null. + public AssessmentSectionStateRootContext(AssessmentSection wrappedData) + : base(wrappedData) {} + } +} \ No newline at end of file Index: Riskeer/Common/src/Riskeer.Common.Forms/Riskeer.Common.Forms.csproj =================================================================== diff -u -ref9f41ef150aee02d286c53de24660a19d948e02 -r95157f917f36c0bd55d2b1e6590cd8fcd9567391 --- Riskeer/Common/src/Riskeer.Common.Forms/Riskeer.Common.Forms.csproj (.../Riskeer.Common.Forms.csproj) (revision ef9f41ef150aee02d286c53de24660a19d948e02) +++ Riskeer/Common/src/Riskeer.Common.Forms/Riskeer.Common.Forms.csproj (.../Riskeer.Common.Forms.csproj) (revision 95157f917f36c0bd55d2b1e6590cd8fcd9567391) @@ -29,6 +29,7 @@ + Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/AssessmentSectionStateRootContextTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/AssessmentSectionStateRootContextTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/AssessmentSectionStateRootContextTest.cs (revision 95157f917f36c0bd55d2b1e6590cd8fcd9567391) @@ -0,0 +1,38 @@ +using System; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Forms.PresentationObjects; +using Riskeer.Integration.Data; + +namespace Riskeer.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class AssessmentSectionStateRootContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + + // Call + var context = new AssessmentSectionStateRootContext(assessmentSection); + + // Assert + Assert.IsInstanceOf>(context); + Assert.AreSame(assessmentSection, context.WrappedData); + } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + void Call() => new AssessmentSectionStateRootContext(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("wrappedData", exception.ParamName); + } + } +} \ No newline at end of file Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Riskeer.Common.Forms.Test.csproj =================================================================== diff -u -r1cbbb2310c2dd1270825700be09b51c5f321cfd2 -r95157f917f36c0bd55d2b1e6590cd8fcd9567391 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Riskeer.Common.Forms.Test.csproj (.../Riskeer.Common.Forms.Test.csproj) (revision 1cbbb2310c2dd1270825700be09b51c5f321cfd2) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Riskeer.Common.Forms.Test.csproj (.../Riskeer.Common.Forms.Test.csproj) (revision 95157f917f36c0bd55d2b1e6590cd8fcd9567391) @@ -37,6 +37,7 @@ + Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -rc1aa383725fd31521b56e16d177e18ffcbe4a1f9 -r95157f917f36c0bd55d2b1e6590cd8fcd9567391 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision c1aa383725fd31521b56e16d177e18ffcbe4a1f9) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 95157f917f36c0bd55d2b1e6590cd8fcd9567391) @@ -279,15 +279,7 @@ { AssessmentSection assessmentSection = riskeerProject.AssessmentSections.First(); - return new object[] - { - new ReferenceLineContext(assessmentSection.ReferenceLine, assessmentSection), - new NormContext(assessmentSection.FailureMechanismContribution, assessmentSection), - new FailureMechanismContributionContext(assessmentSection.FailureMechanismContribution, assessmentSection), - new HydraulicBoundaryDatabaseContext(assessmentSection.HydraulicBoundaryDatabase, assessmentSection), - assessmentSection.BackgroundData, - assessmentSection.Comments - }; + return new AssessmentSectionStateRootContext(assessmentSection); } return null; @@ -957,6 +949,18 @@ CanRemove = (assessmentSection, parentNodeData) => true, OnNodeRemoved = AssessmentSectionOnNodeRemoved }; + + yield return new TreeNodeInfo + { + Text = context => context.WrappedData.Name, + Image = assessmentSection => RiskeerFormsResources.AssessmentSectionFolderIcon, + EnsureVisibleOnCreate = (assessmentSection, parent) => true, + ExpandOnCreate = assessmentSection => true, + ChildNodeObjects = AssessmentSectionStateRootContextChildNodeObjects, + CanRename = (assessmentSection, parentData) => true, + OnNodeRenamed = AssessmentSectionStateRootContextOnNodeRenamed, + CanRemove = (assessmentSection, parentNodeData) => true + }; yield return new TreeNodeInfo { @@ -1788,6 +1792,31 @@ #endregion + #region AssessmentSectionStateRootContext TreeNodeInfo + + private static object[] AssessmentSectionStateRootContextChildNodeObjects(AssessmentSectionStateRootContext nodeData) + { + var childNodes = new List + { + new ReferenceLineContext(nodeData.WrappedData.ReferenceLine, nodeData.WrappedData), + new NormContext(nodeData.WrappedData.FailureMechanismContribution, nodeData.WrappedData), + new FailureMechanismContributionContext(nodeData.WrappedData.FailureMechanismContribution, nodeData.WrappedData), + new HydraulicBoundaryDatabaseContext(nodeData.WrappedData.HydraulicBoundaryDatabase, nodeData.WrappedData), + nodeData.WrappedData.BackgroundData, + nodeData.WrappedData.Comments + }; + + return childNodes.ToArray(); + } + + private static void AssessmentSectionStateRootContextOnNodeRenamed(AssessmentSectionStateRootContext nodeData, string newName) + { + nodeData.WrappedData.Name = newName; + nodeData.WrappedData.NotifyObservers(); + } + + #endregion + #region StandAloneFailureMechanism TreeNodeInfo private static object[] StandAloneFailureMechanismDisabledChildNodeObjects(IFailureMechanismContext nodeData)