Beispiel #1
0
        /// <summary>
        /// Adds a control to the controls collection and sets references.
        /// Initializes any container pointers as well.
        /// Override for specialized handling.
        /// </summary>
        /// <param name="control"></param>
        /// <returns></returns>
        virtual public BaseGadgetControl AddControl(BaseGadgetControl control)
        {
            if (null == control)
            {
                return(null);
                //also log here
            }
            control.MyRootMaster = this.MyRootMaster;
            control.MyTemplate   = this.MyTemplate;
            control.Parent       = this;
            if (control.ViewMask <= 0)
            {
                control.ViewMask = this.ViewMask;
            }
            Controls.Add(control);

            if (MyRootMaster != null &&
                control is DataPipeline.IExternalDataSource &&
                ((DataPipeline.IExternalDataSource)control).ResolveLocation == DataPipeline.ResolveAt.Server)
            {
                MyRootMaster.RegisterExternalServerRenderControl((DataPipeline.IExternalDataSource)control, control.ViewMask);
            }

            return(control);
        }
Beispiel #2
0
        /// <summary>
        /// Return count control plus all child controls and their children
        /// by recursively traversing the tree.
        /// </summary>
        /// <param name="control"></param>
        /// <returns></returns>
        private int RecurseCountControls(BaseGadgetControl control)
        {
            if (control is BaseContainerControl)
            {
                BaseContainerControl container = (BaseContainerControl)control;
                if (container.Controls.Count == 0)
                {
                    return(1);
                }
                else
                {
                    int total = 1;                     //count self

                    foreach (BaseGadgetControl child in container.Controls)
                    {
                        total += RecurseCountControls(child);
                    }
                    return(total);
                }
            }
            else
            {
                return(1);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Recursively register all VariableTag controls for easy reference
        /// </summary>
        /// <param name="currentControl"></param>
        protected void BuildVariableTagsList(BaseGadgetControl currentControl)
        {
            if (null == currentControl)
            {
                return;
            }

            if (currentControl is VariableTag)
            {
                VariableTags.Add((VariableTag)currentControl);
            }
            else if (currentControl is BaseContainerControl)
            {
                foreach (BaseGadgetControl child in ((BaseContainerControl)currentControl).Controls)
                {
                    BuildVariableTagsList(child);
                }
            }
        }