// 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 content of the node. /// The child nodes of the node. /// Indicator whether the node is selectable. /// Thrown when /// or is null. public GraphNode(string content, GraphNode[] childNodes, bool isSelectable) : this(content, childNodes, isSelectable, CreateDefaultGraphNodeStyle()) { } /// /// Creates a new instance of . /// /// The content 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 content, GraphNode[] childNodes, bool isSelectable, GraphNodeStyle style) { if (content == null) { throw new ArgumentNullException(nameof(content)); } if (childNodes == null) { throw new ArgumentNullException(nameof(childNodes)); } if (style == null) { throw new ArgumentNullException(nameof(style)); } Content = content; this.childNodes = childNodes; IsSelectable = isSelectable; Style = style; } /// /// Gets the content of the node. /// public string Content { 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); } } }