Exemplo n.º 1
0
        private Strip CreateStripFromData(object data,
                                          DeclarativeTemplateBuildContext bc,
                                          Component parent,
                                          int rowComponentNumber)
        {
            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);
            Strip      strip    = bc.Ribbon.CreateStrip(parent.Id + "-" + rowComponentNumber);

            for (int i = 0; i < children.Length; i++)
            {
                string name = DataNodeWrapper.GetNodeName(children[i]);
                if (name == DataNodeWrapper.CONTROL)
                {
                    ControlComponent comp = CreateControlComponentFromData(children[i], bc);
                    if (!CUIUtility.IsNullOrUndefined(comp))
                    {
                        strip.AddChild(comp);
                    }
                }
                else
                {
                    HandleOverflow(children[i], bc, strip, i);
                }
            }

            // If there are no children in the strip then there is no reason to add it
            // If we ever support dynamically adding and removing components out of the ribbon
            // then this will need to be revisitited.
            if (strip.Children.Count == 0)
            {
                return(null);
            }

            return(strip);
        }
Exemplo n.º 2
0
        internal override Component Clone(bool deep)
        {
            Strip strip = Ribbon.CreateStrip("clonedStrip-" + Ribbon.GetUniqueNumber());

            if (!deep)
            {
                return(strip);
            }

            foreach (ControlComponent comp in Children)
            {
                strip.AddChild(comp.Clone(deep));
            }
            return(strip);
        }