Tree node fixes when deleting nodes
This commit is contained in:
parent
61c9d01516
commit
cdf14f6328
@ -46,6 +46,7 @@ namespace VEPROMS
|
||||
_SelectedStepTabPanel = value;
|
||||
if (value == null) // DSO Tab Panel
|
||||
{
|
||||
//dlgFindReplace.Visible = false; // Find/Replace dialog should not be visable for DSO tab panels
|
||||
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyItemInfo != null) // 2nd part is for unassociated libdocs
|
||||
SelectedDVI = tc.SelectedDisplayTabItem.MyItemInfo.ActiveParent.ActiveParent as DocVersionInfo;
|
||||
else
|
||||
@ -330,6 +331,8 @@ namespace VEPROMS
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tn != null && tn.Bounds.Left < newPoint.X + 30)
|
||||
return;
|
||||
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null)
|
||||
{
|
||||
tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo);
|
||||
@ -824,6 +827,7 @@ namespace VEPROMS
|
||||
else if (args.PanelTabName == "FndRpl")
|
||||
{
|
||||
dlgFindReplace.InApproved = (_SelectedDVI != null && _SelectedDVI.VersionType == 127);
|
||||
//dlgFindReplace.Mydocversion = _SelectedDVI;
|
||||
dlgFindReplace.Visible = true;
|
||||
}
|
||||
}
|
||||
@ -1257,9 +1261,5 @@ namespace VEPROMS
|
||||
StepRTB.MyFontFamily = cmbFont.SelectedValue as FontFamily;
|
||||
}
|
||||
|
||||
//protected override void WndProc(ref Message m)
|
||||
//{
|
||||
// base.WndProc(ref m);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -1078,7 +1078,7 @@ namespace VEPROMS.CSLA.Library
|
||||
string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((MyContent.Number ?? "") == "" ? MyContent.Text : MyContent.Number));
|
||||
ItemInfo parent = this;
|
||||
while (parent.MyPrevious != null) parent = parent.MyPrevious;
|
||||
if (parent.ItemPartCount == 0)
|
||||
if (parent.ItemPartCount <= 0 || parent.ItemParts.Count == 0)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
|
@ -183,6 +183,20 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void OnDeleted(object sender)
|
||||
{
|
||||
if (Deleted != null) Deleted(sender);
|
||||
if (MyParent != null) MyParent.OnChildrenDeleted(sender);
|
||||
}
|
||||
public event ItemInfoEvent ChildrenDeleted;
|
||||
internal void OnChildrenDeleted(object sender)
|
||||
{
|
||||
if (_CacheByPrimaryKey.ContainsKey(ItemID.ToString()))
|
||||
{
|
||||
List<ItemInfo> itmlst = _CacheByPrimaryKey[ItemID.ToString()];
|
||||
foreach (ItemInfo itm in itmlst)
|
||||
if (itm.ChildrenDeleted != null)
|
||||
{
|
||||
itm.ChildrenDeleted(itm);
|
||||
}
|
||||
}
|
||||
}
|
||||
public event ItemInfoInsertEvent NewSiblingAfter;
|
||||
internal void OnNewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
|
||||
|
@ -323,12 +323,24 @@ namespace VEPROMS.CSLA.Library
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void myItemInfo_ChildrenDeleted(object sender)
|
||||
{
|
||||
//Console.WriteLine("Fix Children");
|
||||
ItemInfo myItemInfo = VEObject as ItemInfo;
|
||||
//if (Nodes.Count > 1)
|
||||
// Console.WriteLine("{0}, {1}",Nodes[0], Nodes[1]);
|
||||
|
||||
if (!myItemInfo.HasChildren && !(Nodes[0] is VETreeNode))
|
||||
Nodes.Clear();
|
||||
}
|
||||
void myItemInfo_NewChild(object sender, ItemInfoInsertEventArgs args)
|
||||
{
|
||||
bool isExpanded = IsExpanded;
|
||||
@ -337,7 +349,8 @@ namespace VEPROMS.CSLA.Library
|
||||
Nodes.Clear();
|
||||
_ChildrenLoaded = false;
|
||||
ResetNode("Dummy myItemInfo_NewChild");
|
||||
if (isExpanded) Expand();
|
||||
//if (isExpanded) Expand();
|
||||
Collapse();
|
||||
}
|
||||
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
||||
{
|
||||
|
@ -1637,10 +1637,13 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
// start at the top parent and walk down the nodes to find child
|
||||
VETreeNode node = FindNodeAndExpand(selectedItem);
|
||||
if (node != null)
|
||||
{
|
||||
_AdjustingTree = true;
|
||||
this.SelectedNode = node;
|
||||
_AdjustingTree = false;
|
||||
}
|
||||
}
|
||||
public VETreeNode FindNodeAndExpand(IVEDrillDownReadOnly selectedItem)
|
||||
{
|
||||
if (selectedItem.ActiveParent == null)
|
||||
@ -1648,15 +1651,23 @@ namespace Volian.Controls.Library
|
||||
return (VETreeNode)this.Nodes[0]; // Return the top node
|
||||
}
|
||||
VETreeNode parent = FindNodeAndExpand(selectedItem.ActiveParent);
|
||||
if (parent == null) return null;
|
||||
if (!parent.IsExpanded)
|
||||
parent.Expand();
|
||||
foreach (VETreeNode child in parent.Nodes)
|
||||
if (CompareVEObject(child.VEObject, selectedItem))
|
||||
foreach (TreeNode childNode in parent.Nodes)
|
||||
{
|
||||
VETreeNode child = childNode as VETreeNode;
|
||||
if (child != null && CompareVEObject(child.VEObject, selectedItem))
|
||||
return child;
|
||||
foreach (VETreeNode child in parent.Nodes)
|
||||
}
|
||||
foreach (TreeNode childNode in parent.Nodes)
|
||||
{
|
||||
VETreeNode child = childNode as VETreeNode;
|
||||
if (child.VEObject is PartInfo)
|
||||
foreach (VETreeNode grandchild in child.Nodes)
|
||||
if (CompareVEObject(grandchild.VEObject, selectedItem))
|
||||
return grandchild;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public bool CompareVEObject(IVEDrillDownReadOnly obj1, IVEDrillDownReadOnly obj2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user