public TreePath(TreePath parent, object node) { _path = new object[parent.FullPath.Length + 1]; for (int i = 0; i < _path.Length - 1; i++) _path[i] = parent.FullPath[i]; _path[_path.Length - 1] = node; }
public Node FindNode(TreePath path) { if (path.IsEmpty()) return _root; else return FindNode(_root, path, 0); }
public TreePathEventArgs(TreePath path) { if (path == null) throw new ArgumentNullException(); _path = path; }
public System.Collections.IEnumerable GetChildren(TreePath treePath) { if (treePath.IsEmpty()) return _list; else return null; }
public bool IsLeaf(TreePath treePath) { GameObject node = FindNode(treePath); if (node != null) return node.NumChildrens == 0; else throw new ArgumentException("treePath"); }
public System.Collections.IEnumerable GetChildren(TreePath treePath) { Node node = FindNode(treePath); if (node != null) foreach (Node n in node.Nodes) yield return n; else yield break; }
/// <summary> /// /// </summary> /// <param name="parent">Path to a parent node</param> /// <param name="indices">Indices of children in parent nodes collection</param> /// <param name="children">Child nodes</param> public TreeModelEventArgs(TreePath parent, int[] indices, object[] children) : base(parent) { if (children == null) throw new ArgumentNullException(); if (indices != null && indices.Length != children.Length) throw new ArgumentException("indices and children arrays must have the same length"); _indices = indices; _children = children; }
public override IEnumerable GetChildren(TreePath treePath) { if (Comparer != null) { ArrayList list = new ArrayList(); IEnumerable res = InnerModel.GetChildren(treePath); if (res != null) { foreach (object obj in res) list.Add(obj); list.Sort(Comparer); return list; } else return null; } else return InnerModel.GetChildren(treePath); }
public abstract bool IsLeaf(TreePath treePath);
public abstract System.Collections.IEnumerable GetChildren(TreePath treePath);
private TreeNodeAdv FindNode(TreeNodeAdv root, TreePath path, int level, bool readChilds) { if (!root.IsExpandedOnce && readChilds) ReadChilds(root); for (int i = 0; i < root.Nodes.Count; i++) { TreeNodeAdv node = root.Nodes[i]; if (node.Tag == path.FullPath[level]) { if (level == path.FullPath.Length - 1) return node; else return FindNode(node, path, level + 1, readChilds); } } return null; }
public TreeNodeAdv FindNode(TreePath path, bool readChilds) { if (path.IsEmpty()) return _root; else return FindNode(_root, path, 0, readChilds); }
public System.Collections.IEnumerable GetChildren(TreePath treePath) { GameObject node = FindNode(treePath); return node.Children; }
private Node FindNode(Node root, TreePath path, int level) { foreach (Node node in root.Nodes) if (node == path.FullPath[level]) { if (level == path.FullPath.Length - 1) return node; else return FindNode(node, path, level + 1); } return null; }
/// <summary> /// /// </summary> /// <param name="parent">Path to a parent node</param> /// <param name="children">Child nodes</param> public TreeModelEventArgs(TreePath parent, object[] children) : this(parent, null, children) { }
public override bool IsLeaf(TreePath treePath) { return InnerModel.IsLeaf(treePath); }
public TreePathEventArgs() { _path = new TreePath(); }
public bool IsLeaf(TreePath treePath) { return true; }
public override IEnumerable GetChildren(TreePath treePath) { return _list; }
public override bool IsLeaf(TreePath treePath) { return true; }
public TreeNodeAdv FindNode(TreePath path) { return FindNode(path, false); }
public bool IsLeaf(TreePath treePath) { Node node = FindNode(treePath); if (node != null) return node.IsLeaf; else throw new ArgumentException("treePath"); }
public GameObject FindNode(TreePath path) { if (path.IsEmpty()) return Root; else return path.LastNode as GameObject; }