Index: Core/Components/src/Core.Components.PointedTree/Core.Components.PointedTree.csproj
===================================================================
diff -u -rda140d65b716fbd74d742a193477b1796823b772 -r2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb
--- Core/Components/src/Core.Components.PointedTree/Core.Components.PointedTree.csproj (.../Core.Components.PointedTree.csproj) (revision da140d65b716fbd74d742a193477b1796823b772)
+++ Core/Components/src/Core.Components.PointedTree/Core.Components.PointedTree.csproj (.../Core.Components.PointedTree.csproj) (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -36,11 +36,15 @@
+
Properties\GlobalAssembly.cs
+
+
+
Index: Core/Components/src/Core.Components.PointedTree/Data/GraphNode.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.PointedTree/Data/GraphNode.cs (revision 0)
+++ Core/Components/src/Core.Components.PointedTree/Data/GraphNode.cs (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -0,0 +1,107 @@
+// Copyright (C) Stichting Deltares 2017. 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.Collections.Generic;
+using System.Drawing;
+
+namespace Core.Components.PointedTree.Data
+{
+ ///
+ /// Class for data with the purpose of becoming visible in pointed tree components.
+ ///
+ public class GraphNode
+ {
+ private readonly GraphNode[] childNodes;
+
+ ///
+ /// Creates a new instance of with default styling.
+ ///
+ /// The title of the node.
+ /// The child nodes of the node.
+ /// Indicator whether the node is selectable.
+ /// Thrown when
+ /// or is null.
+ public GraphNode(string title, GraphNode[] childNodes, bool isSelectable)
+ : this(title, childNodes, isSelectable, CreateDefaultGraphNodeStyle()) { }
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The title of the node.
+ /// The child nodes of the node.
+ /// Indicator whether the node is selectable.
+ /// The style of the node.
+ /// Thrown when ,
+ /// or is null.
+ public GraphNode(string title, GraphNode[] childNodes, bool isSelectable, GraphNodeStyle style)
+ {
+ if (title == null)
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+ if (childNodes == null)
+ {
+ throw new ArgumentNullException(nameof(childNodes));
+ }
+ if (style == null)
+ {
+ throw new ArgumentNullException(nameof(style));
+ }
+
+ Title = title;
+ this.childNodes = childNodes;
+ IsSelectable = isSelectable;
+ Style = style;
+ }
+
+ ///
+ /// Gets the title of the node.
+ ///
+ public string Title { get; }
+
+ ///
+ /// Gets the child nodes of the node.
+ ///
+ public IEnumerable ChildNodes
+ {
+ get
+ {
+ return childNodes;
+ }
+ }
+
+ ///
+ /// Gets an indicator whether the node is selectable.
+ ///
+ public bool IsSelectable { get; }
+
+ ///
+ /// Gets the style of the node.
+ ///
+ public GraphNodeStyle Style { get; }
+
+ private static GraphNodeStyle CreateDefaultGraphNodeStyle()
+ {
+ return new GraphNodeStyle(GraphNodeShape.Rectangle, Color.Gray, Color.Black, 2);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.PointedTree/Data/GraphNodeShape.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.PointedTree/Data/GraphNodeShape.cs (revision 0)
+++ Core/Components/src/Core.Components.PointedTree/Data/GraphNodeShape.cs (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -0,0 +1,32 @@
+// Copyright (C) Stichting Deltares 2017. 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.
+
+namespace Core.Components.PointedTree.Data
+{
+ ///
+ /// All shapes supported for .
+ ///
+ public enum GraphNodeShape
+ {
+ Rectangle,
+ Diamond
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.PointedTree/Data/GraphNodeStyle.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.PointedTree/Data/GraphNodeStyle.cs (revision 0)
+++ Core/Components/src/Core.Components.PointedTree/Data/GraphNodeStyle.cs (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -0,0 +1,66 @@
+// Copyright (C) Stichting Deltares 2017. 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.Drawing;
+
+namespace Core.Components.PointedTree.Data
+{
+ ///
+ /// This class represents styling of a .
+ ///
+ public class GraphNodeStyle
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The shape of the node.
+ /// The fill color of the node.
+ /// The line color of the node.
+ /// The line width of the node.
+ public GraphNodeStyle(GraphNodeShape shape, Color fillColor, Color lineColor, int lineWidth)
+ {
+ Shape = shape;
+ FillColor = fillColor;
+ LineColor = lineColor;
+ LineWidth = lineWidth;
+ }
+
+ ///
+ /// Gets the shape of the node.
+ ///
+ public GraphNodeShape Shape { get; }
+
+ ///
+ /// Gets the fill color of the node.
+ ///
+ public Color FillColor { get; }
+
+ ///
+ /// Gets the line color of the node.
+ ///
+ public Color LineColor { get; }
+
+ ///
+ /// Gets the line width of the node.
+ ///
+ public int LineWidth { get; }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.PointedTree.Test/Core.Components.PointedTree.Test.csproj
===================================================================
diff -u -rda140d65b716fbd74d742a193477b1796823b772 -r2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb
--- Core/Components/test/Core.Components.PointedTree.Test/Core.Components.PointedTree.Test.csproj (.../Core.Components.PointedTree.Test.csproj) (revision da140d65b716fbd74d742a193477b1796823b772)
+++ Core/Components/test/Core.Components.PointedTree.Test/Core.Components.PointedTree.Test.csproj (.../Core.Components.PointedTree.Test.csproj) (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -45,11 +45,14 @@
+
Properties\GlobalAssembly.cs
+
+
Index: Core/Components/test/Core.Components.PointedTree.Test/Data/GraphNodeStyleTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.PointedTree.Test/Data/GraphNodeStyleTest.cs (revision 0)
+++ Core/Components/test/Core.Components.PointedTree.Test/Data/GraphNodeStyleTest.cs (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -0,0 +1,50 @@
+// Copyright (C) Stichting Deltares 2017. 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.Drawing;
+using Core.Components.PointedTree.Data;
+using NUnit.Framework;
+
+namespace Core.Components.PointedTree.Test.Data
+{
+ [TestFixture]
+ public class GraphNodeStyleTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ Color fillColor = Color.DarkRed;
+ Color lineColor = Color.DarkBlue;
+ const int lineWidth = 2;
+ const GraphNodeShape shape = GraphNodeShape.Diamond;
+
+ // Call
+ var style = new GraphNodeStyle(shape, fillColor, lineColor, lineWidth);
+
+ // Assert
+ Assert.AreEqual(shape, style.Shape);
+ Assert.AreEqual(fillColor, style.FillColor);
+ Assert.AreEqual(lineColor, style.LineColor);
+ Assert.AreEqual(lineWidth, style.LineWidth);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.PointedTree.Test/Data/GraphNodeTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.PointedTree.Test/Data/GraphNodeTest.cs (revision 0)
+++ Core/Components/test/Core.Components.PointedTree.Test/Data/GraphNodeTest.cs (revision 2a9569e9a7d82f4f1627fc6eaafd9bda61ac0feb)
@@ -0,0 +1,144 @@
+// Copyright (C) Stichting Deltares 2017. 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.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using Core.Components.PointedTree.Data;
+using NUnit.Framework;
+
+namespace Core.Components.PointedTree.Test.Data
+{
+ [TestFixture]
+ public class GraphNodeTest
+ {
+ [Test]
+ public void Constructor_WithStyling_ExpectedValues()
+ {
+ // Setup
+ Color fillColor = Color.Aqua;
+ Color lineColor = Color.Brown;
+ const GraphNodeShape shape = GraphNodeShape.Diamond;
+ const int lineWidth = 3;
+
+ var style = new GraphNodeStyle(shape, fillColor, lineColor, lineWidth);
+
+ GraphNode[] childNodes =
+ {
+ new GraphNode("node 1", new GraphNode[0], false, style),
+ new GraphNode("node 2", new[]
+ {
+ new GraphNode("node 3", new GraphNode[0], false, style)
+ }, true, style)
+ };
+
+ const string title = "test";
+ const bool isSelectable = false;
+
+ // Call
+ var node = new GraphNode(title, childNodes, isSelectable, style);
+
+ // Assert
+ Assert.AreEqual(title, node.Title);
+ Assert.AreEqual(isSelectable, node.IsSelectable);
+ Assert.AreSame(style, node.Style);
+
+ GraphNode[] actualChildNodes = node.ChildNodes.ToArray();
+ AssertChildNodes(childNodes, actualChildNodes);
+ }
+
+ [Test]
+ public void Constructor_WithoutStyling_ExpectedValues()
+ {
+ // Setup
+ GraphNode[] childNodes =
+ {
+ new GraphNode("node 1", new GraphNode[0], false),
+ new GraphNode("node 2", new[]
+ {
+ new GraphNode("node 3", new GraphNode[0], true)
+ }, true)
+ };
+
+ const string title = "test";
+ const bool isSelectable = false;
+
+ // Call
+ var node = new GraphNode(title, childNodes, isSelectable);
+
+ // Assert
+ Assert.AreEqual(title, node.Title);
+ Assert.AreEqual(isSelectable, node.IsSelectable);
+ Assert.AreEqual(GraphNodeShape.Rectangle, node.Style.Shape);
+ Assert.AreEqual(Color.Gray, node.Style.FillColor);
+ Assert.AreEqual(Color.Black, node.Style.LineColor);
+ Assert.AreEqual(2, node.Style.LineWidth);
+
+ GraphNode[] actualChildNodes = node.ChildNodes.ToArray();
+ AssertChildNodes(childNodes, actualChildNodes);
+ }
+
+ [Test]
+ public void Constructor_TitleNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new GraphNode(null, new GraphNode[0], false);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("title", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ChildNodesNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new GraphNode("test", null, false);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("childNodes", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_StyleNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new GraphNode("test", new GraphNode[0], false, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("style", exception.ParamName);
+ }
+
+ private static void AssertChildNodes(IList childNodes, IList actualChildNodes)
+ {
+ Assert.AreEqual(childNodes.Count, actualChildNodes.Count);
+
+ for (var i = 0; i < childNodes.Count; i++)
+ {
+ Assert.AreEqual(childNodes[i], actualChildNodes[i]);
+ AssertChildNodes(childNodes[i].ChildNodes.ToArray(), actualChildNodes[i].ChildNodes.ToArray());
+ }
+ }
+ }
+}
\ No newline at end of file