public TreeNode this[RecordDisplayInfo <T> rdi] { get { return(this[rdi.GetPathLocations(ERDIPathType.Vanilla)]); } }
public T this[string path] { get { RecordDisplayInfo <T> rdi = this; if (path.Length > 0) { string[] locations = path.Split('/'); foreach (string location in locations) { if (location.Length == 0) { continue; } if (!rdi.m_children.ContainsKey(location)) { return(null); } rdi = rdi.m_children[location]; } } return((T)rdi); } }
public bool ContainsPath(string path) { RecordDisplayInfo <T> rdi = this; if (path.Length > 0) { string[] locations = path.Split('/'); foreach (string location in locations) { if (location.Length == 0) { continue; } if (!rdi.m_children.ContainsKey(location)) { return(false); } rdi = rdi.m_children[location]; } } return(true); }
public void AddChildNodeToSelectedNode() { string basePath = SelectedRDINode.Path; string name = SelectedRDINode.GetNewChildName("newNode"); T rdi = RecordDisplayInfo <T> .CreateNewRDI(basePath, name); AddRDIToTree(rdi); SelectedRDINode = rdi; }
void AddChild(string name, RecordDisplayInfo <T> child) { if (!CanHaveChildren) { throw new Exception(string.Format("Trying to add {0}/{1} to {2}, but CanHaveChildren is false", child.BasePath, name, Path)); } child.m_parent = this; m_children.Add(name, child); }
protected override void OnAfterCheck(TreeViewEventArgs e) { base.OnAfterCheck(e); RecordDisplayInfo <T> rdi = (RecordDisplayInfo <T>)e.Node.Tag; rdi.Displayed = e.Node.Checked; if (m_refreshOnTreeNodeChecked) { LogControl.InvalidateGraphControl(); } }
public List <T> Add(T rdiToAdd) { string[] locations = rdiToAdd.GetPathLocations(ERDIPathType.Vanilla); string name = locations[locations.Length - 1]; List <T> rdis = new List <T>(); RecordDisplayInfo <T> rdiNode = this; string pathSoFar = ""; for (int i = 0; i < locations.Length - 1; i++) { string location = locations[i]; T rdi; if (rdiNode.m_children.ContainsKey(location)) { rdi = (T)rdiNode.m_children[location]; } else { rdi = CreateNewRDI(pathSoFar, location); rdiNode.AddChild(location, rdi); } rdis.Add(rdi); pathSoFar += "/" + location; rdiNode = rdiNode.m_children[location]; } if (!rdiNode.m_children.ContainsKey(name)) { rdiNode.AddChild(name, rdiToAdd); } rdis.Add(rdiToAdd); return(rdis); }