Beispiel #1
0
 protected virtual void InsertChildren(TreeListView.Branch br, int idx)
 {
     br.Expand();
     br.Sort(this.GetBranchComparer());
     this.objectList.InsertRange(idx, br.Flatten());
     this.RebuildObjectMap(idx);
 }
Beispiel #2
0
 public virtual int GetVisibleDescendentCount(object model)
 {
     TreeListView.Branch branch = this.GetBranch(model);
     if (!((branch != null) && branch.IsExpanded))
     {
         return(0);
     }
     return(branch.NumberVisibleDescendents);
 }
Beispiel #3
0
            public virtual int Expand(object model)
            {
                TreeListView.Branch br = this.GetBranch(model);
                if (!((((br != null) && br.CanExpand) && !br.IsExpanded) && br.Visible))
                {
                    return(-1);
                }
                int objectIndex = this.GetObjectIndex(model);

                this.InsertChildren(br, objectIndex + 1);
                return(objectIndex);
            }
Beispiel #4
0
 private void AddChild(object model)
 {
     TreeListView.Branch item = this.Tree.GetBranch(model);
     if (item == null)
     {
         item = this.MakeBranch(model);
     }
     else
     {
         item.ParentBranch = this;
     }
     this.ChildBranches.Add(item);
 }
Beispiel #5
0
            public virtual int Collapse(object model)
            {
                TreeListView.Branch branch = this.GetBranch(model);
                if (!(((branch != null) && branch.IsExpanded) && branch.Visible))
                {
                    return(-1);
                }
                int numberVisibleDescendents = branch.NumberVisibleDescendents;

                branch.Collapse();
                int objectIndex = this.GetObjectIndex(model);

                this.objectList.RemoveRange(objectIndex + 1, numberVisibleDescendents);
                this.RebuildObjectMap(objectIndex + 1);
                return(objectIndex);
            }
Beispiel #6
0
            public virtual int RebuildChildren(object model)
            {
                TreeListView.Branch br = this.GetBranch(model);
                if (!((br != null) && br.Visible))
                {
                    return(-1);
                }
                int numberVisibleDescendents = br.NumberVisibleDescendents;

                br.ClearCachedInfo();
                int objectIndex = this.GetObjectIndex(model);

                if (numberVisibleDescendents > 0)
                {
                    this.objectList.RemoveRange(objectIndex + 1, numberVisibleDescendents);
                }
                if (br.IsExpanded)
                {
                    this.InsertChildren(br, objectIndex + 1);
                }
                return(objectIndex);
            }
Beispiel #7
0
 public virtual void RegisterBranch(TreeListView.Branch br)
 {
     this.mapObjectToBranch[br.Model] = br;
 }
Beispiel #8
0
 public Tree(TreeListView treeView)
 {
     this.treeView         = treeView;
     this.trunk            = new TreeListView.Branch(null, this, null);
     this.trunk.IsExpanded = true;
 }
Beispiel #9
0
 private TreeListView.Branch MakeBranch(object model)
 {
     TreeListView.Branch br = new TreeListView.Branch(this, this.Tree, model);
     this.Tree.RegisterBranch(br);
     return(br);
 }
Beispiel #10
0
 public Branch(TreeListView.Branch parent, BrightIdeasSoftware.TreeListView.Tree tree, object model)
 {
     this.ParentBranch = parent;
     this.Tree         = tree;
     this.Model        = model;
 }