Beispiel #1
0
 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;
 }
Beispiel #2
0
 public Node FindNode(TreePath path)
 {
     if (path.IsEmpty())
         return _root;
     else
         return FindNode(_root, path, 0);
 }
Beispiel #3
0
        public TreePathEventArgs(TreePath path)
        {
            if (path == null)
                throw new ArgumentNullException();

            _path = path;
        }
Beispiel #4
0
 public System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
         return _list;
     else
         return null;
 }
Beispiel #5
0
 public bool IsLeaf(TreePath treePath)
 {
     GameObject node = FindNode(treePath);
     if (node != null)
         return node.NumChildrens == 0;
     else
         throw new ArgumentException("treePath");
 }
Beispiel #6
0
 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;
 }
Beispiel #7
0
        /// <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;
        }
Beispiel #8
0
 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);
 }
Beispiel #9
0
 public abstract bool IsLeaf(TreePath treePath);
Beispiel #10
0
 public abstract System.Collections.IEnumerable GetChildren(TreePath treePath);
Beispiel #11
0
        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;
        }
Beispiel #12
0
 public TreeNodeAdv FindNode(TreePath path, bool readChilds)
 {
     if (path.IsEmpty())
         return _root;
     else
         return FindNode(_root, path, 0, readChilds);
 }
Beispiel #13
0
 public System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     GameObject node = FindNode(treePath);
     return node.Children;
 }
Beispiel #14
0
 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;
 }
Beispiel #15
0
 /// <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)
 {
 }
Beispiel #16
0
 public override bool IsLeaf(TreePath treePath)
 {
     return InnerModel.IsLeaf(treePath);
 }
Beispiel #17
0
 public TreePathEventArgs()
 {
     _path = new TreePath();
 }
Beispiel #18
0
 public bool IsLeaf(TreePath treePath)
 {
     return true;
 }
Beispiel #19
0
 public override IEnumerable GetChildren(TreePath treePath)
 {
     return _list;
 }
Beispiel #20
0
 public override bool IsLeaf(TreePath treePath)
 {
     return true;
 }
Beispiel #21
0
 public TreeNodeAdv FindNode(TreePath path)
 {
     return FindNode(path, false);
 }
Beispiel #22
0
 public bool IsLeaf(TreePath treePath)
 {
     Node node = FindNode(treePath);
     if (node != null)
         return node.IsLeaf;
     else
         throw new ArgumentException("treePath");
 }
Beispiel #23
0
 public GameObject FindNode(TreePath path)
 {
     if (path.IsEmpty()) return Root;
     else return path.LastNode as GameObject;
 }