Exemple #1
0
        public void Add(LComponent comp, int index)
        {
            if (comp.GetContainer() != null)
            {
                throw new InvalidOperationException(comp
                                                    + " already reside in another container!!!");
            }
            comp.SetContainer(this);
            LComponent[] newChilds = new LComponent[this.childs.Length + 1];
            this.childCount++;
            int ctr = 0;

            for (int i = 0; i < this.childCount; i++)
            {
                if (i != index)
                {
                    newChilds[i] = this.childs[ctr];
                    ctr++;
                }
            }
            this.childs        = newChilds;
            this.childs[index] = comp;
            this.desktop.SetDesktop(comp);
            this.SortComponents();
            this.latestInserted = comp;
        }
Exemple #2
0
 public void Add(LComponent comp)
 {
     if (this.Contains(comp))
     {
         return;
     }
     if (comp.GetContainer() != null)
     {
         comp.SetContainer(null);
     }
     comp.SetContainer(this);
     this.childs = (LComponent[])CollectionUtils.Expand(this.childs, 1,
                                                        false);
     this.childs[0] = comp;
     this.childCount++;
     this.desktop.SetDesktop(comp);
     this.SortComponents();
     this.latestInserted = comp;
 }
Exemple #3
0
        public LComponent Remove(int index)
        {
            LComponent comp = this.childs[index];

            this.desktop.SetComponentStat(comp, false);
            comp.SetContainer(null);
            // comp.dispose();
            this.childs = (LComponent[])CollectionUtils.Cut(this.childs, index);
            this.childCount--;

            return(comp);
        }