Esempio n. 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;
        }
Esempio n. 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;
 }