コード例 #1
0
 /// <summary>
 /// Adds the node.
 /// </summary>
 /// <param name="node">The node.</param>
 public virtual void AddNode(ZeroitFastTreeNode node)
 {
     if (node.Parent != this)
     {
         childs.Add(node);
     }
     SetParent(this);
 }
コード例 #2
0
        /// <summary>
        /// Sets the parent.
        /// </summary>
        /// <param name="value">The value.</param>
        protected virtual void SetParent(ZeroitFastTreeNode value)
        {
            if (parent != null && parent != value)
            {
                parent.childs.Remove(this);
            }

            parent = value;
        }
コード例 #3
0
        /// <summary>
        /// Gets the parent.
        /// </summary>
        /// <param name="tagCondition">The tag condition.</param>
        /// <returns>ZeroitFastTreeNode.</returns>
        public ZeroitFastTreeNode GetParent(Predicate <object> tagCondition)
        {
            var parent = Parent;

            while (parent != null && !tagCondition(parent.Tag))
            {
                parent = parent.parent;
            }
            return(parent);
        }
コード例 #4
0
        /// <summary>
        /// Inserts the node before.
        /// </summary>
        /// <param name="existsNode">The exists node.</param>
        /// <param name="nodes">The nodes.</param>
        public virtual void InsertNodeBefore(ZeroitFastTreeNode existsNode, IEnumerable <ZeroitFastTreeNode> nodes)
        {
            var i = childs.IndexOf(existsNode);

            if (i < 0)
            {
                i = 0;
            }

            InsertNode(i, nodes);
        }
コード例 #5
0
        /// <summary>
        /// Inserts the node before.
        /// </summary>
        /// <param name="existsNode">The exists node.</param>
        /// <param name="node">The node.</param>
        public virtual void InsertNodeBefore(ZeroitFastTreeNode existsNode, ZeroitFastTreeNode node)
        {
            var i = childs.IndexOf(existsNode);

            if (i < 0)
            {
                i = 0;
            }

            InsertNode(i, node);
        }
コード例 #6
0
 /// <summary>
 /// Removes the node.
 /// </summary>
 /// <param name="node">The node.</param>
 public virtual void RemoveNode(ZeroitFastTreeNode node)
 {
     childs.Remove(node);
     SetParent(null);
 }
コード例 #7
0
 /// <summary>
 /// Indexes the of.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns>System.Int32.</returns>
 public int IndexOf(ZeroitFastTreeNode node)
 {
     return(childs.IndexOf(node));
 }
コード例 #8
0
        /// <summary>
        /// Inserts the node after.
        /// </summary>
        /// <param name="existsNode">The exists node.</param>
        /// <param name="nodes">The nodes.</param>
        public virtual void InsertNodeAfter(ZeroitFastTreeNode existsNode, IEnumerable <ZeroitFastTreeNode> nodes)
        {
            var i = childs.IndexOf(existsNode) + 1;

            InsertNode(i, nodes);
        }
コード例 #9
0
        /// <summary>
        /// Inserts the node after.
        /// </summary>
        /// <param name="existsNode">The exists node.</param>
        /// <param name="node">The node.</param>
        public virtual void InsertNodeAfter(ZeroitFastTreeNode existsNode, ZeroitFastTreeNode node)
        {
            var i = childs.IndexOf(existsNode) + 1;

            InsertNode(i, node);
        }
コード例 #10
0
 /// <summary>
 /// Inserts the node.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="node">The node.</param>
 public virtual void InsertNode(int index, ZeroitFastTreeNode node)
 {
     childs.Insert(index, node);
     SetParent(this);
 }