This commit is contained in:
parent
b8a8c5a21c
commit
8e5896f118
@ -113,7 +113,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public void ResetNode(string dummy)
|
public void ResetNode(string dummy)
|
||||||
{
|
{
|
||||||
if (_VEObject!=null && _VEObject.HasChildren && _ChildrenLoaded == false)
|
if (_VEObject!=null && _VEObject.HasChildren && _ChildrenLoaded == false && CheckForParts())
|
||||||
{
|
{
|
||||||
_ChildrenLoaded = false;// Reset the children loaded flag
|
_ChildrenLoaded = false;// Reset the children loaded flag
|
||||||
this.Nodes.Add(dummy);// Add a Dummy Node so that the item will appear to be expanable.
|
this.Nodes.Add(dummy);// Add a Dummy Node so that the item will appear to be expanable.
|
||||||
@ -130,6 +130,18 @@ namespace VEPROMS.CSLA.Library
|
|||||||
SetProperty("SelectedImageIndex");
|
SetProperty("SelectedImageIndex");
|
||||||
// ToDo: Need to reset object as well
|
// ToDo: Need to reset object as well
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckForParts()
|
||||||
|
{
|
||||||
|
if (_allParts) return true;
|
||||||
|
// only has 'children' if parts are steps or sections
|
||||||
|
if (_VEObject.GetType() == typeof(StepInfo) || _VEObject.GetType() == typeof(SectionInfo) || _VEObject.GetType() == typeof(ItemInfo))
|
||||||
|
{
|
||||||
|
IList ol = ((ItemInfo)_VEObject).GetChildren(_allParts);
|
||||||
|
if (ol == null || ol.Count == 0) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public void RefreshNode()
|
public void RefreshNode()
|
||||||
{
|
{
|
||||||
ResetNode("Dummy RefreshNode");// Drop Children
|
ResetNode("Dummy RefreshNode");// Drop Children
|
||||||
@ -173,8 +185,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
LoadChildren(true);
|
LoadChildren(true);
|
||||||
}
|
}
|
||||||
|
private bool _allParts = true;
|
||||||
public virtual void LoadChildren(bool allParts)
|
public virtual void LoadChildren(bool allParts)
|
||||||
{
|
{
|
||||||
|
_allParts = allParts;
|
||||||
if (!_ChildrenLoaded)
|
if (!_ChildrenLoaded)
|
||||||
{
|
{
|
||||||
this.Nodes.Clear();
|
this.Nodes.Clear();
|
||||||
@ -184,6 +198,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
OnLoadingChildrenSQL(this, new VETreeNodeEventArgs());
|
OnLoadingChildrenSQL(this, new VETreeNodeEventArgs());
|
||||||
IList ol;
|
IList ol;
|
||||||
ItemInfo item = _VEObject as ItemInfo;
|
ItemInfo item = _VEObject as ItemInfo;
|
||||||
|
if (item != null) item.RefreshItemParts();
|
||||||
if (_VEObject.GetType() == typeof(StepInfo) || _VEObject.GetType() == typeof(SectionInfo) || _VEObject.GetType() == typeof(ItemInfo))
|
if (_VEObject.GetType() == typeof(StepInfo) || _VEObject.GetType() == typeof(SectionInfo) || _VEObject.GetType() == typeof(ItemInfo))
|
||||||
ol = ((ItemInfo)_VEObject).GetChildren(allParts);
|
ol = ((ItemInfo)_VEObject).GetChildren(allParts);
|
||||||
else
|
else
|
||||||
@ -214,7 +229,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//tNext("Cycle");
|
//tNext("Cycle");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VETreeNode tmp = new VETreeNode(o);
|
VETreeNode tmp = new VETreeNode(o,_allParts);
|
||||||
if (o.HasChildren)
|
if (o.HasChildren)
|
||||||
{
|
{
|
||||||
if (o is PartInfo)
|
if (o is PartInfo)
|
||||||
@ -316,6 +331,23 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
// Constructors
|
// Constructors
|
||||||
public VETreeNode() : base("NoText") { ; }
|
public VETreeNode() : base("NoText") { ; }
|
||||||
|
public VETreeNode(IVEDrillDownReadOnly o, bool allParts)
|
||||||
|
: base(o.ToString())
|
||||||
|
{
|
||||||
|
_allParts = allParts;
|
||||||
|
_VEObject = o;// Save the BusinessObject
|
||||||
|
ResetNode("Dummy VETreeNode(IVEDrillDownReadOnly o)");
|
||||||
|
ItemInfo myItemInfo = o as ItemInfo;
|
||||||
|
if (myItemInfo != null)
|
||||||
|
{
|
||||||
|
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
|
myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
||||||
|
myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
|
||||||
|
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
|
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
|
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
public VETreeNode(IVEDrillDownReadOnly o)
|
public VETreeNode(IVEDrillDownReadOnly o)
|
||||||
: base(o.ToString())
|
: base(o.ToString())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user