Click here to Skip to main content
15,881,455 members
Articles / Programming Languages / C#

Romeo and Juliet

Rate me:
Please Sign up or sign in to vote.
4.87/5 (34 votes)
3 Dec 2011CPOL11 min read 58.1K   413   67  
Making relationships first class citizens.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;

namespace Clifton.Windows.Forms.XmlTree
{
	public class Node : ISupportInitialize
	{
		protected string name;
		protected string refName;
		protected bool isReadOnly;
		protected string text;
		protected bool isRequired;
		protected string iconFilename;
		protected Icon icon;

		protected List<Popup> parentPopupItems;
		protected List<Popup> popupItems;
		protected List<Node> nodes;

		public string Name
		{
			get { return name; }
			set { name = value; }
		}

		public string RefName
		{
			get { return refName; }
			set { refName = value; }
		}

		public bool IsReadOnly
		{
			get { return isReadOnly; }
			set { isReadOnly = value; }
		}

		public string Text
		{
			get { return text; }
			set { text = value; }
		}

		public bool IsRequired
		{
			get { return isRequired; }
			set { isRequired = value; }
		}

		public List<Popup> ParentPopupItems
		{
			get { return parentPopupItems; }
		}

		public List<Popup> PopupItems
		{
			get { return popupItems; }
		}

		public List<Node> Nodes
		{
			get { return nodes; }
		}

		public bool IsRef
		{
			get { return refName != null; }
		}

		public string IconFilename
		{
			get { return iconFilename; }
			set { iconFilename = value; }
		}

		public Icon Icon
		{
			get { return icon; }
			set { icon = value; }
		}

		public Node()
		{
			parentPopupItems = new List<Popup>();
			popupItems = new List<Popup>();
			nodes = new List<Node>();
		}

		public virtual void BeginInit()
		{
		}

		public virtual void EndInit()
		{
			if (iconFilename != null)
			{
				icon = new Icon(iconFilename);
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Interacx
United States United States
Blog: https://marcclifton.wordpress.com/
Home Page: http://www.marcclifton.com
Research: http://www.higherorderprogramming.com/
GitHub: https://github.com/cliftonm

All my life I have been passionate about architecture / software design, as this is the cornerstone to a maintainable and extensible application. As such, I have enjoyed exploring some crazy ideas and discovering that they are not so crazy after all. I also love writing about my ideas and seeing the community response. As a consultant, I've enjoyed working in a wide range of industries such as aerospace, boatyard management, remote sensing, emergency services / data management, and casino operations. I've done a variety of pro-bono work non-profit organizations related to nature conservancy, drug recovery and women's health.

Comments and Discussions