From 50719291d148ab74784b487a2ca20029a82b8e60 Mon Sep 17 00:00:00 2001 From: Jsj Date: Wed, 26 Mar 2008 18:28:34 +0000 Subject: [PATCH] Tree Node Name logic --- .../Extension/DocVersionExt.cs | 63 ++++++++++++++++++- .../Extension/FolderExt.cs | 29 ++++++++- 2 files changed, 89 insertions(+), 3 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs index ac5e75cc..fbd6f61d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs @@ -14,6 +14,7 @@ using System.Data.SqlClient; using Csla; using Csla.Data; using System.Collections.Generic; +//using VEPROMS.Properties; namespace VEPROMS.CSLA.Library { @@ -46,9 +47,38 @@ namespace VEPROMS.CSLA.Library Config = _DocVersionConfig.ToString(); } #endregion + #region UserSettings + /// + /// These settings are set on the user interface side. + /// This is used to control whether the Name and/or Title is displayed + /// next to the tree nodes in the user interface + /// + private bool _DisplayTreeNodeNames = true; + public bool DisplayTreeNodeNames + { + get { return _DisplayTreeNodeNames; } + set { _DisplayTreeNodeNames = value; } + } + private bool _DisplayTreeNodeTitles = false; + + public bool DisplayTreeNodeTitles + { + get { return _DisplayTreeNodeTitles; } + set { _DisplayTreeNodeTitles = value; } + } + #endregion public override string ToString() { - return string.Format("{0} - {1}", Name, Title); + // assume that at least one of the two options was selected + string rtnstr = ""; + if (_DisplayTreeNodeNames) rtnstr = Name; + if (_DisplayTreeNodeTitles) + { + if (rtnstr.Length > 0) rtnstr += " - "; + rtnstr += Title; + } + return rtnstr; + //return string.Format("{0} - {1}", Name, Title); } #region IVEDrillDown public System.Collections.IList GetChildren() @@ -129,9 +159,38 @@ namespace VEPROMS.CSLA.Library } //public bool HasStandardSteps() //{ return false; } + #region UserSettings + /// + /// These settings are set on the user interface side. + /// This is used to control whether the Name and/or Title is displayed + /// next to the tree nodes in the user interface + /// + private bool _DisplayTreeNodeNames = true; + public bool DisplayTreeNodeNames + { + get { return _DisplayTreeNodeNames; } + set { _DisplayTreeNodeNames = value; } + } + private bool _DisplayTreeNodeTitles = false; + + public bool DisplayTreeNodeTitles + { + get { return _DisplayTreeNodeTitles; } + set { _DisplayTreeNodeTitles = value; } + } + #endregion public override string ToString() { - return string.Format("{0} - {1}", Name, Title); + // assume that at least one of the two options was selected + string rtnstr = ""; + if (_DisplayTreeNodeNames) rtnstr = Name; + if (_DisplayTreeNodeTitles) + { + if (rtnstr.Length > 0) rtnstr += " - "; + rtnstr += Title; + } + return rtnstr; + //return string.Format("{0} - {1}", Name, Title); } //public string ToString(string str,System.IFormatProvider ifp) //{ diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs index 95e22bd7..105619df 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/FolderExt.cs @@ -130,9 +130,36 @@ namespace VEPROMS.CSLA.Library { get { return Get().FolderConfig; } } + /// + /// These settings are set on the user interface side. + /// This is used to control whether the Name and/or Title is displayed + /// next to the tree nodes in the user interface + /// + private bool _DisplayTreeNodeNames = true; + public bool DisplayTreeNodeNames + { + get { return _DisplayTreeNodeNames; } + set { _DisplayTreeNodeNames = value; } + } + private bool _DisplayTreeNodeTitles = false; + + public bool DisplayTreeNodeTitles + { + get { return _DisplayTreeNodeTitles; } + set { _DisplayTreeNodeTitles = value; } + } public override string ToString() { - return string.Format("{0} - {1}", Name, Title); + // assume that at least one of the two options was selected + string rtnstr = ""; + if ( _DisplayTreeNodeNames) rtnstr = Name; + if (_DisplayTreeNodeTitles) + { + if (rtnstr.Length > 0) rtnstr += " - "; + rtnstr += Title; + } + return rtnstr; + //return string.Format("{0} - {1}", Name, Title); } //public string ToString(string str, System.IFormatProvider ifp) //{