Removed AncestorLookup property

Changed logic to use Info version of parent
Changed Ancestor Lookup to use Info objects
Removed ActiveFormat from editable object
This commit is contained in:
Rich 2009-10-08 14:29:52 +00:00
parent 10f55d09fd
commit d3e7bc9dd5
2 changed files with 27 additions and 53 deletions

View File

@ -35,12 +35,12 @@ namespace VEPROMS.CSLA.Library
//[NonSerialized] //[NonSerialized]
private bool _AncestorLookup; private bool _AncestorLookup;
//PROPGRID: Hide AncestorLookup //PROPGRID: Hide AncestorLookup
[Browsable(false)] //[Browsable(false)]
public bool AncestorLookup //public bool AncestorLookup
{ //{
get { return _AncestorLookup; } // get { return _AncestorLookup; }
set { _AncestorLookup = value; } // set { _AncestorLookup = value; }
} //}
private Section _Section; private Section _Section;
private SectionInfo _SectionInfo; private SectionInfo _SectionInfo;
@ -50,51 +50,29 @@ namespace VEPROMS.CSLA.Library
string xml = section.MyContent.Config; string xml = section.MyContent.Config;
if (xml == string.Empty) xml = "<config/>"; if (xml == string.Empty) xml = "<config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
if (section.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); if (section.MySectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
} }
private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args) private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
{ {
if (_AncestorLookup || ParentLookup) if (args.AncestorLookup || ParentLookup)
{ {
string retval; string retval;
Section sect = _Section; SectionInfo sect = _Section.MySectionInfo;
while (sect.ActiveParent.GetType() == typeof(Section)) while (sect.ActiveParent.GetType() == typeof(SectionInfo))
{ {
retval = sect.SectionConfig.GetValue(args.Group, args.Item); retval = sect.SectionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
sect = (Section)sect.ActiveParent; sect = (SectionInfo)sect.ActiveParent;
} }
Procedure proc = (Procedure)sect.ActiveParent; ProcedureInfo proc = (ProcedureInfo)sect.ActiveParent;
while (proc.ActiveParent.GetType() == typeof(Procedure)) retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
while (proc.ActiveParent.GetType() == typeof(ProcedureInfo))
{ {
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item); retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
proc = (Procedure)proc.ActiveParent; proc = (ProcedureInfo)proc.ActiveParent;
} }
DocVersion docVersion = (DocVersion)proc.ActiveParent;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
for (Folder folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{
retval = folder.FolderConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
}
}
return string.Empty;
}
private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
{
if (_AncestorLookup || ParentLookup)
{
string retval;
Section sect = _Section;
while (sect.ActiveParent.GetType() == typeof(Section))
{
//retval = sect.SectionConfig.GetValue(args.Group, args.Item);
//if (retval != string.Empty) return retval;
sect = (Section)sect.ActiveParent;
}
Procedure proc = (Procedure)sect.ActiveParent;
DocVersionInfo docVersion = (DocVersionInfo)proc.ActiveParent; DocVersionInfo docVersion = (DocVersionInfo)proc.ActiveParent;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item); retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
@ -182,7 +160,7 @@ namespace VEPROMS.CSLA.Library
if (_Section != null) if (_Section != null)
{ {
_Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set _Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
_Section.ActiveFormat = null; //_Section.ActiveFormat = null;
DocStyleListConverter.MySection = _Section; DocStyleListConverter.MySection = _Section;
} }
} }
@ -213,7 +191,7 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
if (_Section != null && _Section.ActiveParent != null && _Section.ActiveParent.ActiveFormat != null) return _Section.ActiveParent.ActiveFormat.FullName; if (_Section != null && _Section.MySectionInfo.ActiveParent != null && _Section.MySectionInfo.ActiveParent.ActiveFormat != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat.FullName;
if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.FullName; if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.FullName;
return null; return null;
} }
@ -223,11 +201,7 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
if (_Section != null) if (_Section != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat;
{
SectionInfo sectionInfo = SectionInfo.Get(_Section.ItemID);
return sectionInfo.ActiveParent.ActiveFormat;
}
return _SectionInfo.ActiveParent.ActiveFormat; return _SectionInfo.ActiveParent.ActiveFormat;
} }
} }

View File

@ -33,14 +33,14 @@ namespace VEPROMS.CSLA.Library
} }
//PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid //PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid
//[NonSerialized] //[NonSerialized]
private bool _AncestorLookup; //private bool _AncestorLookup;
//PROPGRID: Hide AncestorLookup ////PROPGRID: Hide AncestorLookup
[Browsable(false)] //[Browsable(false)]
public bool AncestorLookup //public bool AncestorLookup
{ //{
get { return _AncestorLookup; } // get { return _AncestorLookup; }
set { _AncestorLookup = value; } // set { _AncestorLookup = value; }
} //}
private Step _Step; private Step _Step;
private StepInfo _StepInfo; private StepInfo _StepInfo;
public StepConfig(Step step) public StepConfig(Step step)