202 lines
4.4 KiB
C#
202 lines
4.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Ease.UICreator
|
|
{
|
|
#region Class
|
|
public class MasterFormTreeView
|
|
{
|
|
#region variables
|
|
// Node text can be multiple property concatation
|
|
// Tier Name
|
|
// Parent
|
|
// Childs
|
|
private string _seperator;
|
|
private string _propertyNames;
|
|
private string _rootNodeText;
|
|
private int _numberOfTier;
|
|
private FormTreeViewTiers _tiers;
|
|
private string _configNode;
|
|
|
|
#endregion
|
|
|
|
#region constructor
|
|
public MasterFormTreeView()
|
|
{
|
|
_seperator = "";
|
|
_propertyNames = "";
|
|
_numberOfTier = 10;
|
|
_tiers = null;
|
|
_rootNodeText = "";
|
|
_configNode = "";
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region _configuration Node
|
|
public string ConfigNodeName
|
|
{
|
|
get { return _configNode; }
|
|
set { _configNode = value; }
|
|
}
|
|
#endregion
|
|
#region _seperator
|
|
public string Seperator
|
|
{
|
|
get { return _seperator; }
|
|
set { _seperator = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Source
|
|
public string PropertyNames
|
|
{
|
|
get { return _propertyNames; }
|
|
set { _propertyNames = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Source
|
|
public int NumberOfTier
|
|
{
|
|
get { return _numberOfTier; }
|
|
set { _numberOfTier = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Root Node Text
|
|
public string RootNodeText
|
|
{
|
|
get { return _rootNodeText; }
|
|
set { _rootNodeText = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Source
|
|
public FormTreeViewTiers Tiers
|
|
{
|
|
get {
|
|
if (_tiers == null)
|
|
{
|
|
_tiers = new FormTreeViewTiers();
|
|
}
|
|
return _tiers; }
|
|
set { _tiers = value; }
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Collection
|
|
|
|
public class FormTreeViewTier
|
|
{
|
|
#region variables
|
|
// Node text can be multiple property concatation
|
|
// Tier Name
|
|
// Parent
|
|
// Childs
|
|
private string _tierName;
|
|
private int _sequence;
|
|
#endregion
|
|
|
|
#region constructor
|
|
public FormTreeViewTier()
|
|
{
|
|
_tierName = "";
|
|
_sequence =0;
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region TierName
|
|
public string TierName
|
|
{
|
|
get { return _tierName; }
|
|
set { _tierName = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Source
|
|
public int Sequence
|
|
{
|
|
get { return _sequence; }
|
|
set { _sequence = value; }
|
|
}
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
public class FormTreeViewTiers : CollectionBase
|
|
{
|
|
#region Methods
|
|
#region Indexer
|
|
public FormTreeViewTier this[int index]
|
|
{
|
|
get
|
|
{
|
|
return ((FormTreeViewTier)List[index]);
|
|
}
|
|
set
|
|
{
|
|
List[index] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
#region Add
|
|
|
|
public int Add(FormTreeViewTier value)
|
|
{
|
|
return (List.Add(value));
|
|
}
|
|
public int Add(string tierName, int sequence)
|
|
{
|
|
FormTreeViewTier item = new FormTreeViewTier();
|
|
item.TierName = tierName;
|
|
item.Sequence = sequence;
|
|
return (List.Add(item));
|
|
}
|
|
|
|
public string GetTierName(int sequence)
|
|
{
|
|
foreach (FormTreeViewTier item in this)
|
|
{
|
|
if(item.Sequence == sequence)
|
|
return item.TierName;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
#endregion
|
|
#region IndexOf
|
|
public int IndexOf(FormTreeViewTier value)
|
|
{
|
|
return (List.IndexOf(value));
|
|
}
|
|
#endregion
|
|
#region Insert
|
|
public void Insert(int index, FormTreeViewTier value)
|
|
{
|
|
List.Insert(index, value);
|
|
}
|
|
#endregion
|
|
#region Remove
|
|
public void Remove(MasterFormTreeView value)
|
|
{
|
|
List.Remove(value);
|
|
}
|
|
#endregion
|
|
#endregion
|
|
}
|
|
#endregion
|
|
}
|