Ejemplo n.º 1
0
        public virtual void AddNode(LNNode node, int z)
        {
            if (this.Contains(node))
            {
                return;
            }
            if (node.GetContainer() != null)
            {
                node.SetContainer(null);
            }
            node.SetContainer(this);
            int  index = 0;
            bool flag  = false;

            for (int i = 0; i < this._childCount; i++)
            {
                LNNode node2 = this.childs[i];
                int    zd    = 0;
                if (node2 != null)
                {
                    zd = node2.GetZOrder();
                }
                if (zd > z)
                {
                    flag        = true;
                    this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1,
                                                                   false);
                    childs[index] = node;
                    _childCount++;
                    node.SetScreen(_screen);
                    this.latestInserted = node;
                    break;
                }
                index++;
            }
            if (!flag)
            {
                this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1,
                                                               false);
                this.childs[0] = node;
                this._childCount++;
                node.SetScreen(_screen);
                this.latestInserted = node;
            }
            node.SetZOrder(z);
            node.SetParent(this);
            Arrays.Sort(childs, comparator);
        }
Ejemplo n.º 2
0
        public virtual void Add(LNNode node, int index)
        {
            if (node.GetContainer() != null)
            {
                throw new InvalidOperationException(node
                                                    + " already reside in another node!!!");
            }
            node.SetContainer(this);
            LNNode[] newChilds = new LNNode[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] = node;
            node.SetScreen(_screen);
            this.SortComponents();
            this.latestInserted = node;
        }
Ejemplo n.º 3
0
        public virtual LNNode RemoveNode(int index)
        {
            LNNode node = this.childs[index];

            this._screen.SetNodeStat(node, false);
            node.SetContainer(null);
            this.childs = (LNNode[])CollectionUtils.Cut(this.childs, index);
            this._childCount--;
            return(node);
        }