Exemplo n.º 1
0
        public override void AddChildren()
        {
            this.Nodes.Clear();

            if (this.PropertyMap.ReferenceType != ReferenceType.None)
            {
                this.Context.ObjectManager.EnsurePropertyIsLoaded(this.Obj, this.PropertyMap.Name);

                if (this.PropertyMap.IsCollection)
                {
                    IList list = (IList)this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                    foreach (object refObj in list)
                    {
                        TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                        this.Nodes.Add(child);
                    }
                }
                else
                {
                    object refObj = this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                    if (refObj != null)
                    {
                        TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                        this.Nodes.Add(child);
                    }
                }
            }
        }
        public override void AddChildren()
        {
            this.Nodes.Clear() ;

            if (this.PropertyMap.ReferenceType != ReferenceType.None)
            {
                this.Context.ObjectManager.EnsurePropertyIsLoaded(this.Obj, this.PropertyMap.Name);

                if (this.PropertyMap.IsCollection)
                {
                    IList list = (IList) this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                    foreach (object refObj in list)
                    {
                        TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                        this.Nodes.Add(child);
                    }
                }
                else
                {
                    object refObj = this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                    if (refObj != null)
                    {
                        TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                        this.Nodes.Add(child);
                    }
                }
            }
        }
        public override void Refresh()
        {
            if (this.IsExpanded)
            {
                if (this.PropertyMap.ReferenceType != ReferenceType.None)
                {
                    if (this.PropertyMap.IsCollection)
                    {
                        if (this.Nodes.Count > 0)
                        {
                            if (!(this.Nodes[0] is ObjectTreeNode))
                                this.Nodes.Clear() ;
                        }
                        IList added = new ArrayList();
                        IList list = (IList) this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                        foreach (object refObj in list)
                        {
                            bool found = false;
                            foreach (ObjectTreeNode test in this.Nodes)
                            {
                                if (test.Obj == refObj)
                                {
                                    added.Add(test);
                                    found = true;
                                    break;
                                }
                            }
                            if (found == false)
                            {
                                TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                                this.Nodes.Add(child);
                                added.Add(child);
                            }
                        }
                        IList remove = new ArrayList();
                        foreach (ObjectTreeNode removeNode in this.Nodes)
                        {
                            if (!added.Contains(removeNode))
                            {
                                remove.Add(removeNode);
                            }
                        }
                        foreach (ObjectTreeNode removeNode in remove)
                        {
                            this.Nodes.Remove(removeNode);
                        }

                    }
                    else
                    {
                        object refObj = this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                        if (refObj != null)
                        {
                            if (this.Nodes.Count > 0)
                            {
                                if (this.Nodes[0] is ObjectTreeNode)
                                {
                                    ObjectTreeNode child = (ObjectTreeNode) this.Nodes[0];
                                    if (child.Obj != refObj)
                                    {
                                        this.Nodes.Clear() ;
                                    }
                                }
                                else
                                {
                                    this.Nodes.Clear() ;
                                }
                            }
                            if (this.Nodes.Count < 1)
                            {
                                TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                                this.Nodes.Add(child);
                            }
                        }
                        else
                        {
                            if (this.Nodes.Count > 0)
                            {
                                this.Nodes.Clear() ;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 public override void Refresh()
 {
     if (this.IsExpanded)
     {
         if (this.PropertyMap.ReferenceType != ReferenceType.None)
         {
             if (this.PropertyMap.IsCollection)
             {
                 if (this.Nodes.Count > 0)
                 {
                     if (!(this.Nodes[0] is ObjectTreeNode))
                     {
                         this.Nodes.Clear();
                     }
                 }
                 IList added = new ArrayList();
                 IList list  = (IList)this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                 foreach (object refObj in list)
                 {
                     bool found = false;
                     foreach (ObjectTreeNode test in this.Nodes)
                     {
                         if (test.Obj == refObj)
                         {
                             added.Add(test);
                             found = true;
                             break;
                         }
                     }
                     if (found == false)
                     {
                         TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                         this.Nodes.Add(child);
                         added.Add(child);
                     }
                 }
                 IList remove = new ArrayList();
                 foreach (ObjectTreeNode removeNode in this.Nodes)
                 {
                     if (!added.Contains(removeNode))
                     {
                         remove.Add(removeNode);
                     }
                 }
                 foreach (ObjectTreeNode removeNode in remove)
                 {
                     this.Nodes.Remove(removeNode);
                 }
             }
             else
             {
                 object refObj = this.Obj.GetType().GetProperty(this.PropertyMap.Name).GetValue(this.Obj, null);
                 if (refObj != null)
                 {
                     if (this.Nodes.Count > 0)
                     {
                         if (this.Nodes[0] is ObjectTreeNode)
                         {
                             ObjectTreeNode child = (ObjectTreeNode)this.Nodes[0];
                             if (child.Obj != refObj)
                             {
                                 this.Nodes.Clear();
                             }
                         }
                         else
                         {
                             this.Nodes.Clear();
                         }
                     }
                     if (this.Nodes.Count < 1)
                     {
                         TreeNode child = new ObjectTreeNode(this.Context, refObj, this.Obj, this.PropertyMap);
                         this.Nodes.Add(child);
                     }
                 }
                 else
                 {
                     if (this.Nodes.Count > 0)
                     {
                         this.Nodes.Clear();
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
        private void TurnOnTreeDragHilite(ObjectTreeNode node)
        {
            if (node != m_TreeDragHilited)
                TurnOffTreeDragHilite();

            m_TreeDragHilited = node;

            m_TreeDragHilited.BackColor = Color.DarkBlue;
            m_TreeDragHilited.ForeColor = Color.White;
        }
Exemplo n.º 6
0
 private void TurnOffTreeDragHilite()
 {
     if (m_TreeDragHilited != null)
     {
         m_TreeDragHilited.BackColor = Color.White;
         m_TreeDragHilited.ForeColor = Color.Black;
         m_TreeDragHilited = null;
     }
 }
Exemplo n.º 7
0
 private void RefreshTreeNode(ObjectTreeNode treeNode)
 {
     if (treeNode.IsExpanded)
     {
         foreach (ObjectTreeNode child in treeNode.Nodes)
         {
             RefreshTreeNode(child);
         }
     }
     treeNode.Refresh();
 }
Exemplo n.º 8
0
 private void OpenObject(object obj)
 {
     objectTreeView.Nodes.Clear() ;
     TreeNode treeNode = new ObjectTreeNode(Context, obj) ;
     objectTreeView.Nodes.Add(treeNode);
     treeNode.Expand() ;
     SelectObject(obj);
 }