예제 #1
0
 void IStateManager.LoadViewState(object state)
 {
     if (state != null)
     {
         int      num;
         Pair     pair;
         object[] objArray = (object[])state;
         this.dirty = (bool)objArray[0];
         if (this.dirty)
         {
             this.items.Clear();
             for (num = 1; num < objArray.Length; num++)
             {
                 MyTreeNode node;
                 pair = objArray[num] as Pair;
                 if (pair == null)
                 {
                     throw new InvalidOperationException("Broken view state (item " + num + ")");
                 }
                 Type first = pair.First as Type;
                 if (first == null)
                 {
                     node = new MyTreeNode();
                 }
                 else
                 {
                     node = Activator.CreateInstance(pair.First as Type) as MyTreeNode;
                 }
                 this.Add(node);
                 object second = pair.Second;
                 if (second != null)
                 {
                     ((IStateManager)node).LoadViewState(second);
                 }
             }
         }
         else
         {
             for (num = 1; num < objArray.Length; num++)
             {
                 pair = objArray[num] as Pair;
                 if (pair == null)
                 {
                     throw new InvalidOperationException("Broken view state " + num + ")");
                 }
                 int        num2  = (int)pair.First;
                 MyTreeNode node2 = (MyTreeNode)this.items[num2];
                 ((IStateManager)node2).LoadViewState(pair.Second);
             }
         }
     }
 }
예제 #2
0
 public void AddAt(int index, MyTreeNode child)
 {
     this.items.Insert(index, child);
     child.SetParent(this.parent);
     child.Tree = this.tree;
     for (int i = index + 1; i < this.items.Count; i++)
     {
         if (this.marked)
         {
             ((IStateManager)child).TrackViewState();
             this.SetDirty();
         }
     }
 }
예제 #3
0
        public virtual object Clone()
        {
            MyTreeNode node = (this.tree != null) ? this.tree.CreateNode() : new MyTreeNode();

            foreach (DictionaryEntry entry in this.ViewState)
            {
                node.ViewState[(string)entry.Key] = ((StateItem)entry.Value).Value;
            }
            foreach (MyTreeNode node2 in this.ChildNodes)
            {
                node.ChildNodes.Add((MyTreeNode)node2.Clone());
            }
            return(node);
        }
예제 #4
0
        public void RemoveAt(int index)
        {
            MyTreeNode node = (MyTreeNode)this.items[index];

            this.items.RemoveAt(index);
            if (this.tree != null)
            {
                node.Tree = null;
            }
            if (this.marked)
            {
                this.SetDirty();
            }
        }
예제 #5
0
        internal void Add(MyTreeNode child, bool updateParent)
        {
            int num = this.items.Add(child);

            if ((this.parent == null) || updateParent)
            {
                child.SetParent(this.parent);
                child.Tree = this.tree;
                if (this.marked)
                {
                    ((IStateManager)child).TrackViewState();
                    this.SetDirty();
                }
            }
        }
예제 #6
0
        public void Remove(MyTreeNode node)
        {
            int index = this.IndexOf(node);

            if (index != -1)
            {
                this.items.RemoveAt(index);
                if (this.tree != null)
                {
                    node.Tree = null;
                }
                if (this.marked)
                {
                    this.SetDirty();
                }
            }
        }
예제 #7
0
 private void FillBoundChildrenRecursive(IHierarchicalEnumerable hEnumerable, MyTreeNodeCollection nodeCollection)
 {
     if (hEnumerable != null)
     {
         foreach (object obj2 in hEnumerable)
         {
             IHierarchyData hierarchyData = hEnumerable.GetHierarchyData(obj2);
             MyTreeNode     child         = new MyTreeNode(this);
             nodeCollection.Add(child);
             child.Bind(hierarchyData);
             if (((this.MaxDataBindDepth < 0) || (child.Depth != this.MaxDataBindDepth)) && ((hierarchyData != null) && hierarchyData.HasChildren))
             {
                 IHierarchicalEnumerable children = hierarchyData.GetChildren();
                 this.FillBoundChildrenRecursive(children, child.ChildNodes);
             }
         }
     }
 }
예제 #8
0
 public bool Contains(MyTreeNode child)
 {
     return(this.items.Contains(child));
 }
예제 #9
0
 public void Add(MyTreeNode child)
 {
     this.Add(child, true);
 }
예제 #10
0
 public MyTreeNodeCollection(MyTreeNode owner)
 {
     this.items  = new ArrayList();
     this.parent = owner;
     this.tree   = owner.Tree;
 }
예제 #11
0
 public int IndexOf(MyTreeNode node)
 {
     return(this.items.IndexOf(node));
 }
예제 #12
0
 public void SetParent(MyTreeNode node)
 {
     this.parent = node;
 }
예제 #13
0
        private void RenderNode(HtmlTextWriter writer, MyTreeNode node, int level, List <string> ExpandPathList)
        {
            bool   flag = node.ChildNodes.Count > 0;
            string str  = "";

            if (flag)
            {
                str = "folder";
                if (string.IsNullOrEmpty(node.NavigateUrl))
                {
                    str = "folder isCliecka";
                }
                if ((((this.Page.IsPostBack && this.SelectListStringValue.Contains(node.Value.ToString())) || (this.ShowExpandCollapse || (level <= this.ExpandDepth))) || (((ExpandPathList.Count > 0) && ExpandPathList.Contains(node.Value.ToString())) && flag)) || (this._SetIsExpanded && this._SetSelectValueList.Contains(node.Value.ToString())))
                {
                    str = str + " Expand";
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Class, str);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Li);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write("&nbsp;");
            writer.RenderEndTag();
            if ((this.ShowType != WTF.Controls.ShowType.None) && (!this.IsLastShowType || (!flag && this.IsLastShowType)))
            {
                if (this.ShowType == WTF.Controls.ShowType.Radio)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Name, "UL" + this.UniqueID);
                }
                else
                {
                    this.ID++;
                    writer.AddAttribute(HtmlTextWriterAttribute.Name, "UL" + this.ID);
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Value, node.Value);
                if (this.SelectListStringValue.Contains(node.Value) || this._SetSelectValueList.Contains(node.Value))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Checked, "Checked");
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Type, (this.ShowType == WTF.Controls.ShowType.CheckBox) ? "checkbox" : "radio");
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();
            }
            if (!string.IsNullOrEmpty(node.NavigateUrl))
            {
                if (!this.NavigateUrlIsClick)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, base.ResolveClientUrl(node.NavigateUrl));
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, node.NavigateUrl);
                }
                string target = node.Target;
                if (string.IsNullOrEmpty(target))
                {
                    target = this.Target;
                }
                if (!string.IsNullOrEmpty(target))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Target, target);
                }
            }
            if (!string.IsNullOrEmpty(node.ToolTip))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, node.ToolTip);
            }
            if (!string.IsNullOrEmpty(node.ImageUrl))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "treeAico");
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-image: url('" + node.ImageUrl + "')");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.WriteEncodedText(node.Text);
            writer.RenderEndTag();
            writer.RenderEndTag();
            if (flag)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "node");
                writer.AddAttribute("treeLevel", level.ToString());
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "display:none");
                writer.RenderBeginTag(HtmlTextWriterTag.Li);
                writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                int count = node.ChildNodes.Count;
                for (int i = 0; i < count; i++)
                {
                    this.RenderNode(writer, node.ChildNodes[i], level + 1, ExpandPathList);
                }
                writer.RenderEndTag();
                writer.RenderEndTag();
            }
        }