Exemple #1
0
        /// <summary>
        /// 获取添加选项卡的脚本
        /// </summary>
        /// <param name="tabID">选项卡ID</param>
        /// <param name="iframeUrl">IFrame地址</param>
        /// <param name="tabTitle">选项卡标题</param>
        /// <param name="iconUrl">选项卡图标</param>
        /// <param name="enableClose">是否可以关闭</param>
        /// <returns>客户端脚本</returns>
        public string GetAddTabReference(string tabID, string iframeUrl, string tabTitle, string iconUrl, bool enableClose)
        {
            if (!String.IsNullOrEmpty(iframeUrl))
            {
                iframeUrl = ResolveIFrameUrl(iframeUrl);
            }

            JsObjectBuilder options = new JsObjectBuilder();

            options.AddProperty("id", tabID);
            options.AddProperty("url", iframeUrl);
            options.AddProperty("title", tabTitle);
            options.AddProperty("closable", enableClose);

            string iconScript = String.Empty;

            if (!String.IsNullOrEmpty(iconUrl))
            {
                string className = String.Format("icon_{0}", System.Guid.NewGuid().ToString("N"));
                iconScript = String.Format("F.addCSS('{0}','{1}');", className, StyleUtil.GetNoRepeatBackgroundStyle("." + className, ResolveUrl(iconUrl)));

                options.AddProperty("iconCls", className);
            }

            return(iconScript + String.Format("{0}.addTab({1});", ScriptID, options));
        }
Exemple #2
0
        /// <summary>
        /// 获取显示对话框的客户端脚本
        /// </summary>
        /// <param name="message">对话框消息</param>
        /// <param name="title">对话框标题</param>
        /// <param name="messageBoxIcon"></param>
        /// <param name="okScript">点击确定按钮执行的客户端脚本</param>
        /// <param name="target">显示对话框的目标页面</param>
        /// <param name="icon"></param>
        /// <param name="iconUrl">自定义对话框图标地址</param>
        /// <returns>客户端脚本</returns>
        public static string GetShowReference(string message, string title, MessageBoxIcon messageBoxIcon, string okScript, Target target, Icon icon, string iconUrl)
        {
            if (message == null)
            {
                message = String.Empty;
            }
            if (title == null)
            {
                title = String.Empty;
            }

            string addCSSScript       = String.Empty;
            string iconScriptFragment = String.Empty;
            string resolvedIconUrl    = IconHelper.GetResolvedIconUrl(icon, iconUrl);

            Page page = HttpContext.Current.CurrentHandler as Page;

            if (page != null)
            {
                resolvedIconUrl = page.ResolveUrl(resolvedIconUrl);
            }

            // Icon 或者 IconUrl 不为空
            if (!String.IsNullOrEmpty(resolvedIconUrl))
            {
                string className = String.Format("box-{0}-alert-icon", System.Guid.NewGuid().ToString("N"));

                var addCSSPrefix = String.Empty;
                if (target == Target.Parent)
                {
                    addCSSPrefix = "parent.";
                }
                else if (target == Target.Top)
                {
                    addCSSPrefix = "top.";
                }
                addCSSScript = String.Format("{0}X.util.addCSS('{1}','{2}');", addCSSPrefix, className, StyleUtil.GetNoRepeatBackgroundStyle("." + className, resolvedIconUrl));

                iconScriptFragment = String.Format("'{0}'", className);
            }
            else
            {
                iconScriptFragment = MessageBoxIconHelper.GetName(messageBoxIcon);
            }

            message = message.Replace("\r\n", "\n").Replace("\n", "<br/>");
            title   = title.Replace("\r\n", "\n").Replace("\n", "<br/>");
            string targetScript = "window";

            if (target != Target.Self)
            {
                targetScript = TargetHelper.GetScriptName(target);
            }

            if (String.IsNullOrEmpty(title) &&
                messageBoxIcon == DefaultMessageBoxIcon &&
                String.IsNullOrEmpty(okScript) &&
                String.IsNullOrEmpty(resolvedIconUrl))
            {
                return(addCSSScript + String.Format("{0}.X.alert({1});", targetScript, JsHelper.GetJsString(message)));
            }
            else
            {
                return(addCSSScript + String.Format("{0}.X.alert({1},{2},{3},{4});",
                                                    targetScript,
                                                    JsHelper.GetJsStringWithScriptTag(message),
                                                    JsHelper.GetJsString(title),
                                                    iconScriptFragment,
                                                    String.IsNullOrEmpty(okScript) ? "''" : JsHelper.GetFunction(okScript)));
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取显示对话框的客户端脚本
        /// </summary>
        /// <returns>客户端脚本</returns>
        public string GetShowReference()
        {
            //return GetShowReference(Message, Title, MessageBoxIcon, OkScript, Target, Icon, IconUrl);

            //if (message == null)
            //{
            //    message = String.Empty;
            //}
            //if (title == null)
            //{
            //    title = String.Empty;
            //}

            string message = "";
            string title   = "";

            if (!String.IsNullOrEmpty(Message))
            {
                message = Message;
            }
            if (!String.IsNullOrEmpty(Title))
            {
                title = Title;
            }


            string addCSSScript       = String.Empty;
            string iconScriptFragment = String.Empty;
            string resolvedIconUrl    = IconHelper.GetResolvedIconUrl(Icon, IconUrl);

            Page page = HttpContext.Current.CurrentHandler as Page;

            if (page != null)
            {
                resolvedIconUrl = page.ResolveUrl(resolvedIconUrl);
            }

            Target target = Target;

            // Icon 或者 IconUrl 不为空
            if (!String.IsNullOrEmpty(resolvedIconUrl))
            {
                string className = String.Format("f-{0}-alert-icon", System.Guid.NewGuid().ToString("N"));

                var addCSSPrefix = String.Empty;
                if (target == Target.Parent)
                {
                    addCSSPrefix = "parent.";
                }
                else if (target == Target.Top)
                {
                    addCSSPrefix = "top.";
                }
                addCSSScript = String.Format("{0}F.addCSS('{1}','{2}');", addCSSPrefix, className, StyleUtil.GetNoRepeatBackgroundStyle("." + className, resolvedIconUrl));

                iconScriptFragment = String.Format("'{0}'", className);
            }
            else
            {
                iconScriptFragment = MessageBoxIconHelper.GetName(MessageBoxIcon);
            }

            message = message.Replace("\r\n", "\n").Replace("\n", "<br/>");
            title   = title.Replace("\r\n", "\n").Replace("\n", "<br/>");
            string targetScript = "window";

            if (target != Target.Self)
            {
                targetScript = TargetHelper.GetScriptName(target);
            }

            JsObjectBuilder jsob = new JsObjectBuilder();

            if (!String.IsNullOrEmpty(CssClass))
            {
                jsob.AddProperty("cls", CssClass);
            }
            if (!String.IsNullOrEmpty(title))
            {
                jsob.AddProperty("title", title);
            }
            if (!String.IsNullOrEmpty(OkScript))
            {
                jsob.AddProperty("ok", JsHelper.GetFunction(OkScript), true);
            }
            if (!String.IsNullOrEmpty(message))
            {
                jsob.AddProperty("message", JsHelper.EnquoteWithScriptTag(message), true);
            }
            if (!String.IsNullOrEmpty(iconScriptFragment))
            {
                jsob.AddProperty("messageIcon", iconScriptFragment, true);
            }

            return(addCSSScript + String.Format("{0}.F.alert({1});", targetScript, jsob));
        }
Exemple #4
0
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();



            #region options
            if (!ShowTrigger)
            {
                OB.AddProperty("hideTrigger", true);
            }

            if (!EnableEdit)
            {
                OB.AddProperty("editable", false);
            }



            #endregion

            #region TriggerIcon

            if (TriggerIcon != TriggerIcon.None)
            {
                OB.AddProperty("triggerClass", TriggerIconHelper.GetName(TriggerIcon));
            }
            else if (!String.IsNullOrEmpty(TriggerIconUrl))
            {
                string className = String.Format("fineui_{0}_triggerbox_icon", XID);
                string selector  = String.Format(".x-form-field-wrap .{0}", className);
                AddStartupCSS(className, StyleUtil.GetBackgroundStyle(selector, ResolveUrl(TriggerIconUrl)));

                OB.AddProperty("triggerClass", className);
            }


            #endregion

            #region TriggerClick

            if (Enabled)
            {
                string clientClickScript = OnClientTriggerClick;
                if (!String.IsNullOrEmpty(clientClickScript) && !clientClickScript.EndsWith(";"))
                {
                    clientClickScript += ";";
                }

                string postbackScript = String.Empty;
                if (EnablePostBack)
                {
                    postbackScript = GetPostBackEventReference();
                }

                OB.AddProperty("onTriggerClick", JsHelper.GetFunction(clientClickScript + postbackScript), true);
            }

            #endregion

            #region Specialkey

            if (Enabled)
            {
                // 首先启用enableKeyEvents
                //OB.AddProperty("enableKeyEvents", true);
                OB.Listeners.AddProperty("specialkey", String.Format("function(field,e){{if(e.getKey()==e.ENTER){{{0}.onTriggerClick();e.stopEvent();}}}}", XID), true);

                //OB.Listeners.AddProperty("keydown", JsHelper.GetFunction("var i=0;"), true);
            }

            #endregion

            #region old code

            //// 只禁用文本框,不禁用Trigger
            //if (Readonly)
            //{
            //    //OB.AddProperty(OptionName.Disabled, true);
            //    //AddAbsoluteStartupScript( String.Format("{0}.el.dom.disabled=true;", ClientID));



            //    //OB.Listeners.AddProperty(OptionName.Focus, String.Format("function(field){{field.blur.defer(10,field);\r\n}}"), true);
            //    //OB.Listeners.AddProperty(OptionName.Keydown, String.Format("function(){{return false;}}"), true);


            //    // 晕,最后的解决方案居然是设置 readonly=true
            //    OB.AddProperty(OptionName.ReadOnly, true);

            //    //string cssClassName = CssClass;
            //    //cssClassName += "x-item-disabled";

            //    //OB.RemoveProperty(OptionName.Cls);
            //    //OB.AddProperty(OptionName.Cls, cssClassName);
            //    //OB.AddProperty(OptionName.FocusClass, "");
            //}

            #endregion

            string jsContent = String.Format("var {0}=new Ext.form.TriggerField({1});", XID, OB.ToString());
            AddStartupScript(jsContent);
        }
Exemple #5
0
        /// <summary>
        /// 渲染 HTML 之前调用(页面第一次加载或者普通回发)
        /// </summary>
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();

            #region options

            if (!ShowTrigger)
            {
                OB.AddProperty("hideTrigger", true);
            }

            if (!EnableEdit)
            {
                OB.AddProperty("editable", false);
            }


            string renderScript = String.Empty;
            if (!ShowTrigger1)
            {
                renderScript += String.Format("this.triggerCell.item(0).setDisplayed(false);");
            }
            if (!ShowTrigger2)
            {
                renderScript += String.Format("this.triggerCell.item(1).setDisplayed(false);");
            }

            if (!String.IsNullOrEmpty(renderScript))
            {
                //renderScript += "this.updateLayout();";
                OB.Listeners.AddProperty("afterrender", JsHelper.GetFunction(renderScript), true);
            }


            #endregion

            #region Trigger1Icon/Trigger2Icon

            if (Trigger1Icon != TriggerIcon.None)
            {
                OB.AddProperty("trigger1Cls", TriggerIconHelper.GetName(Trigger1Icon));
            }
            else if (!String.IsNullOrEmpty(Trigger1IconUrl))
            {
                string className = String.Format("f_{0}_twintriggerbox_icon1", XID);
                string selector  = String.Format(".x-form-field-wrap .x-form-twin-triggers .{0}", className);
                AddStartupCSS(className, StyleUtil.GetBackgroundStyle(selector, ResolveUrl(Trigger1IconUrl)));

                OB.AddProperty("trigger1Cls", className);
            }


            if (Trigger2Icon != TriggerIcon.None)
            {
                OB.AddProperty("trigger2Cls", TriggerIconHelper.GetName(Trigger2Icon));
            }
            else if (!String.IsNullOrEmpty(Trigger2IconUrl))
            {
                string className = String.Format("f_{0}_twintriggerbox_icon2", XID);
                string selector  = String.Format(".x-form-field-wrap .x-form-twin-triggers .{0}", className);
                AddStartupCSS(className, StyleUtil.GetBackgroundStyle(selector, ResolveUrl(Trigger2IconUrl)));

                OB.AddProperty("trigger2Cls", className);
            }


            #endregion

            #region Trigger1Click/Trigger1Click

            if (Enabled)
            {
                string clientTrigger1ClickScript = OnClientTrigger1Click;
                if (!String.IsNullOrEmpty(clientTrigger1ClickScript) && !clientTrigger1ClickScript.EndsWith(";"))
                {
                    clientTrigger1ClickScript += ";";
                }
                string trigger1PostbackScript = String.Empty;
                if (EnableTrigger1PostBack)
                {
                    trigger1PostbackScript = GetPostBackEventReference("Trigger$1");
                }
                //string trigger1ClickScript = String.Format("function(){{{0}}}", clientTrigger1ClickScript + trigger1PostbackScript);
                //// createDelegate 用来为一个Function创建一个Scope
                //OB.AddProperty(OptionName.OnTrigger1Click, String.Format("({0}).createDelegate(box)", trigger1ClickScript), true);
                OB.AddProperty("onTrigger1Click", JsHelper.GetFunction(clientTrigger1ClickScript + trigger1PostbackScript), true);


                string clientTrigger2ClickScript = OnClientTrigger2Click;
                if (!String.IsNullOrEmpty(clientTrigger2ClickScript) && !clientTrigger2ClickScript.EndsWith(";"))
                {
                    clientTrigger2ClickScript += ";";
                }
                string trigger2PostbackScript = String.Empty;
                if (EnableTrigger2PostBack)
                {
                    trigger2PostbackScript = GetPostBackEventReference("Trigger$2");
                }
                //string trigger2ClickScript = String.Format("function(){{{0}}}", clientTrigger2ClickScript + Trigger2PostbackScript);
                //// createDelegate 用来为一个Function创建一个Scope
                //OB.AddProperty(OptionName.OnTrigger2Click, String.Format("({0}).createDelegate(box)", trigger2ClickScript), true);
                OB.AddProperty("onTrigger2Click", JsHelper.GetFunction(clientTrigger2ClickScript + trigger2PostbackScript), true);
            }

            #endregion

            #region Specialkey

            if (Enabled)
            {
                // 首先启用enableKeyEvents
                //OB.AddProperty("enableKeyEvents", true);
                OB.Listeners.AddProperty("specialkey", String.Format("function(field,e){{if(e.getKey()==e.ENTER){{{0}.onTrigger2Click();e.stopEvent();}}}}", XID), true);
            }

            #endregion

            // F('SimpleForm1_ttbxMyBox2').triggerEl.item(0).show();

            string jsContent = String.Format("var {0}=Ext.create('Ext.form.field.Trigger',{1});", XID, OB.ToString());
            AddStartupScript(jsContent);
        }
        /// <summary>
        /// 渲染 HTML 之前调用(页面第一次加载或者普通回发)
        /// </summary>
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();

            #region options

            if (!ShowTrigger)
            {
                OB.AddProperty("hideTrigger", true);
            }


            if (!ShowTrigger1)
            {
                OB.AddProperty("hideTrigger1", true);
            }
            if (!ShowTrigger2)
            {
                OB.AddProperty("hideTrigger2", true);
            }

            if (!EnableEdit)
            {
                OB.AddProperty("editable", false);
            }

            #endregion

            #region Trigger1Icon/Trigger2Icon

            if (Trigger1Icon != TriggerIcon.None)
            {
                OB.AddProperty("trigger1Class", TriggerIconHelper.GetName(Trigger1Icon));
            }
            else if (!String.IsNullOrEmpty(Trigger1IconUrl))
            {
                string className = String.Format("fineui_{0}_twintriggerbox_icon1", XID);
                string selector  = String.Format(".x-form-field-wrap .x-form-twin-triggers .{0}", className);
                AddStartupCSS(className, StyleUtil.GetBackgroundStyle(selector, ResolveUrl(Trigger1IconUrl)));

                OB.AddProperty("trigger1Class", className);
            }


            if (Trigger2Icon != TriggerIcon.None)
            {
                OB.AddProperty("trigger2Class", TriggerIconHelper.GetName(Trigger2Icon));
            }
            else if (!String.IsNullOrEmpty(Trigger2IconUrl))
            {
                string className = String.Format("fineui_{0}_twintriggerbox_icon2", XID);
                string selector  = String.Format(".x-form-field-wrap .x-form-twin-triggers .{0}", className);
                AddStartupCSS(className, StyleUtil.GetBackgroundStyle(selector, ResolveUrl(Trigger2IconUrl)));

                OB.AddProperty("trigger2Class", className);
            }


            #endregion

            #region Trigger1Click/Trigger1Click

            if (Enabled)
            {
                string clientTrigger1ClickScript = OnClientTrigger1Click;
                if (!String.IsNullOrEmpty(clientTrigger1ClickScript) && !clientTrigger1ClickScript.EndsWith(";"))
                {
                    clientTrigger1ClickScript += ";";
                }
                string trigger1PostbackScript = String.Empty;
                if (EnableTrigger1PostBack)
                {
                    trigger1PostbackScript = GetPostBackEventReference("Trigger$1");
                }
                //string trigger1ClickScript = String.Format("function(){{{0}}}", clientTrigger1ClickScript + trigger1PostbackScript);
                //// createDelegate 用来为一个Function创建一个Scope
                //OB.AddProperty(OptionName.OnTrigger1Click, String.Format("({0}).createDelegate(box)", trigger1ClickScript), true);
                OB.AddProperty("onTrigger1Click", JsHelper.GetFunction(clientTrigger1ClickScript + trigger1PostbackScript), true);


                string clientTrigger2ClickScript = OnClientTrigger2Click;
                if (!String.IsNullOrEmpty(clientTrigger2ClickScript) && !clientTrigger2ClickScript.EndsWith(";"))
                {
                    clientTrigger2ClickScript += ";";
                }
                string trigger2PostbackScript = String.Empty;
                if (EnableTrigger2PostBack)
                {
                    trigger2PostbackScript = GetPostBackEventReference("Trigger$2");
                }
                //string trigger2ClickScript = String.Format("function(){{{0}}}", clientTrigger2ClickScript + Trigger2PostbackScript);
                //// createDelegate 用来为一个Function创建一个Scope
                //OB.AddProperty(OptionName.OnTrigger2Click, String.Format("({0}).createDelegate(box)", trigger2ClickScript), true);
                OB.AddProperty("onTrigger2Click", JsHelper.GetFunction(clientTrigger2ClickScript + trigger2PostbackScript), true);
            }

            #endregion

            #region Specialkey

            if (Enabled)
            {
                // 首先启用enableKeyEvents
                //OB.AddProperty("enableKeyEvents", true);
                OB.Listeners.AddProperty("specialkey", String.Format("function(field,e){{if(e.getKey()==e.ENTER){{{0}.onTrigger2Click();e.stopEvent();}}}}", XID), true);
            }

            #endregion

            #region old code

            //string renderScript = String.Empty;


            ////// 只禁用文本框,不禁用Trigger
            ////if (!EnableTextBox)
            ////{
            ////    //AddAbsoluteStartupScript(String.Format("{0}.el.dom.disabled=true;", ClientJavascriptID));
            ////    renderScript += String.Format("{0}.el.dom.disabled=true;", ClientJavascriptID);
            ////}


            //if (AjaxPropertyChanged("ShowTrigger1", ShowTrigger1))
            //{
            //    AddAjaxPropertyChangedScript(String.Format("{0}.getTrigger(0).{1}();", XID, ShowTrigger1 ? "show" : "hide"));
            //}

            //if (AjaxPropertyChanged("ShowTrigger2", ShowTrigger2))
            //{
            //    AddAjaxPropertyChangedScript(String.Format("{0}.getTrigger(1).{1}();", XID, ShowTrigger2 ? "show" : "hide"));
            //}


            //renderScript = "(function(){" + renderScript + "}).defer(20);";
            //OB.Listeners.AddProperty("render", "function(component){" + renderScript + "}", true);

            #endregion

            string jsContent = String.Format("var {0}=new Ext.form.TwinTriggerField({1});", XID, OB.ToString());
            AddStartupScript(jsContent);
        }
Exemple #7
0
        /// <summary>
        /// 渲染 HTML 之前调用(页面第一次加载或者普通回发)
        /// </summary>
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();

            #region options

            OB.AddProperty("animCollapse", false);
            OB.AddProperty("collapsible", EnableCollapse);
            OB.AddProperty("collapsed", Collapsed);

            #endregion

            #region ShowHeader

            if (ShowHeader)
            {
                //OB.AddProperty("title", String.IsNullOrEmpty(Title) ? String.Format("[{0}]", ID) : Title);

                OB.AddProperty("title", Title);
            }
            else
            {
                OB.AddProperty("header", false);
            }

            #endregion

            #region IconUrl

            if (!String.IsNullOrEmpty(IconUrl))
            {
                // Window控件的特殊处理在Window控件中
                // 添加CSS样式
                string className = String.Format("f-{0}-panelbase-icon", XID);
                AddStartupCSS(className, StyleUtil.GetNoRepeatBackgroundStyle("." + className, ResolveUrl(IconUrl)));

                OB.AddProperty("iconCls", className);

                //// 下面这种方式不行,这个样式是要添加到Head中的,而不是最外层的DIV
                //AddExtraStyle("background", StyleUtil.GetNoRepeatBackgroundStyleValue(ResolveUrl(IconUrl)));
            }

            #endregion

            #region old code

            //if (IconClassName != "") OB.AddProperty(OptionName.IconCls, IconClassName);

            // Listeners, 折叠展开
            //JsObjectBuilder listenersBuilder = new JsObjectBuilder();
            //listenersBuilder.AddProperty("collapse", String.Format("function(panel){{Ext.get('{0}').dom.value=true;}}", CollapsedHiddenField.ClientID), true);
            //listenersBuilder.AddProperty("expand", String.Format("function(panel){{Ext.get('{0}').dom.value=false;}}", CollapsedHiddenField.ClientID), true);
            //OBuilder.AddProperty("listeners", listenersBuilder.ToString(), true);


            //if (EnableCollapse)
            //{
            //    OB.Listeners.AddProperty("collapse", String.Format("function(panel){{Ext.get('{0}').dom.value=true;}}", CollapsedHiddenFieldID), true);
            //    OB.Listeners.AddProperty("expand", String.Format("function(panel){{Ext.get('{0}').dom.value=false;}}", CollapsedHiddenFieldID), true);
            //}



            //string hiddenFieldsScript = String.Empty;

            //if (EnableCollapse)
            //{
            //    hiddenFieldsScript += GetSetHiddenFieldValueScript(CollapsedHiddenFieldID, Collapsed.ToString().ToLower());
            //}

            //hiddenFieldsScript += "\r\n";

            //// 在ControlBase的RegisterControlStartupScript函数中做过处理,会把在基类中注册的脚本合并后再整体注册
            ////AddStartupScript(this, hiddenFieldsScript);
            //AddPageFirstLoadScript(hiddenFieldsScript);

            #endregion

            #region EnableCollapseEvent

            if (EnableCollapseEvent)
            {
                //string collapseScript = JsHelper.GetFunction(GetPostBackEventReference("Collapse"));
                //OB.Listeners.AddProperty("collapse", collapseScript, true);
                AddListener("collapse", GetPostBackEventReference("Collapse"));
            }

            if (EnableExpandEvent)
            {
                //string expandScript = JsHelper.GetFunction(GetPostBackEventReference("Expand"));
                //OB.Listeners.AddProperty("expand", expandScript, true);
                AddListener("expand", GetPostBackEventReference("Expand"));
            }

            #endregion
        }
Exemple #8
0
        /// <summary>
        /// 渲染 HTML 之前调用(页面第一次加载或者普通回发)
        /// </summary>
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();

            if (EnableFrame)
            {
                OB.AddProperty("frame", true);
            }


            #region Items

            // 如果是 ContentPanel, 启用 IFrame 或者包含 Content, 则不生成 items
            if (RenderChildrenAsContent || EnableIFrame || (Content != null))
            {
                if (RenderChildrenAsContent || (Content != null))
                {
                    OB.AddProperty("contentEl", String.Format("{0}", ContentID));
                }
            }
            else
            {
                if (Items.Count > 0)
                {
                    JsArrayBuilder ab = new JsArrayBuilder();
                    foreach (ControlBase item in Items)
                    {
                        if (item.Visible)
                        {
                            ab.AddProperty(String.Format("{0}", item.XID), true);
                        }
                    }

                    OB.AddProperty("items", ab.ToString(), true);
                }
            }

            #endregion

            #region Toolbars

            //JsArrayBuilder dockItems = new JsArrayBuilder();
            //foreach (Toolbar bar in Toolbars)
            //{
            //    dockItems.AddProperty(bar.XID, true);
            //}

            //if (this is Grid)
            //{
            //    Grid grid = this as Grid;
            //    if (grid.AllowPaging)
            //    {
            //        dockItems.AddProperty(grid.Render_PagingID, true);
            //    }
            //}

            Dictionary <string, JsArrayBuilder> bars = new Dictionary <string, JsArrayBuilder>();
            foreach (Toolbar bar in Toolbars)
            {
                string barPosition = ToolbarPositionHelper.GetExtName(bar.Position);

                if (!bars.ContainsKey(barPosition))
                {
                    bars[barPosition] = new JsArrayBuilder();
                }
                bars[barPosition].AddProperty(bar.XID, true);
            }

            // 将底部工具栏的顺序反转
            if (bars.ContainsKey("bottom"))
            {
                bars["bottom"].Reverse();
            }
            // 表格的分页工具栏
            if (this is Grid)
            {
                Grid grid = this as Grid;
                if (grid.AllowPaging)
                {
                    if (!bars.ContainsKey("bottom"))
                    {
                        bars["bottom"] = new JsArrayBuilder();
                    }

                    bars["bottom"].AddProperty(grid.Render_PagingID, true);
                }
            }


            JsArrayBuilder dockItems = new JsArrayBuilder();
            foreach (string barPosition in bars.Keys)
            {
                foreach (string barItem in bars[barPosition].Properties)
                {
                    dockItems.AddProperty(barItem, true);
                }
            }
            OB.AddProperty("dockedItems", dockItems);


            #endregion

            #region BodyStyle/ShowBorder

            string bodyStyleStr = BodyStyle;
            if (!bodyStyleStr.Contains("padding"))
            {
                if (!String.IsNullOrEmpty(BodyPadding))
                {
                    bodyStyleStr += String.Format("padding:{0};", StyleUtil.GetMarginPaddingStyle(BodyPadding));
                }
            }

            //if (EnableBackgroundColor)
            //{
            //    if (!bodyStyleStr.Contains("background-color"))
            //    {
            //        string backgroundColorStyleStr = GlobalConfig.GetDefaultBackgroundColor();
            //        if (!String.IsNullOrEmpty(backgroundColorStyleStr))
            //        {
            //            bodyStyleStr += String.Format("background-color:{0};", backgroundColorStyleStr);
            //        }
            //    }
            //}

            OB.AddProperty("bodyStyle", bodyStyleStr);

            OB.AddProperty("border", ShowBorder);


            #endregion

            #region MinHeight/MinHeight

            if (MinHeight != Unit.Empty)
            {
                OB.AddProperty("minHeight", MinHeight.Value);
            }
            if (MinWidth != Unit.Empty)
            {
                OB.AddProperty("minWidth", MinWidth.Value);
            }
            if (MaxHeight != Unit.Empty)
            {
                OB.AddProperty("maxHeight", MaxHeight.Value);
            }
            if (MaxWidth != Unit.Empty)
            {
                OB.AddProperty("maxWidth", MaxWidth.Value);
            }


            //// 对于Panel,如果宽度/高度没有定义
            //if (Width == Unit.Empty && AutoWidth)
            //{
            //    OB.AddProperty("autoWidth", true);
            //}

            //if (Height == Unit.Empty && AutoHeight)
            //{
            //    OB.AddProperty("autoHeight", true);
            //}


            //// 如果父控件是容器控件(不是ContentPanel),并且Layout != LayoutType.Container,
            //// 则设置AutoWidth/AutoHeight都为false
            //if (Parent is PanelBase)
            //{
            //    PanelBase parent = Parent as PanelBase;
            //    if (!(parent is ContentPanel) && parent.Layout != Layout.Container)
            //    {
            //        OB.RemoveProperty("autoHeight");
            //        OB.RemoveProperty("autoWidth");
            //    }
            //}



            if (AutoScroll)
            {
                OB.AddProperty("autoScroll", true);
            }


            #region old code
            //// 如果是 PageLayout 中的Panel,不能设置AutoWidth
            //if (Parent is PageLayout)
            //{
            //    // region
            //    if (Region != Region_Default) OB.AddProperty(OptionName.Region, RegionTypeName.GetName(Region.Value));
            //}
            //else
            //{
            //    // 对于Panel,如果宽度/高度没有定义,则使用自动宽度和高度
            //    if (Width == Unit.Empty)
            //    {
            //        OB.AddProperty(OptionName.AutoWidth, true);
            //    }

            //    if (Height == Unit.Empty)
            //    {
            //        OB.AddProperty(OptionName.AutoHeight, true);
            //    }

            //}

            //// 如果父控件是容器控件,并且Layout=Fit,则设置AutoWidth/AutoHeight都为false
            //if (Parent is PanelBase)
            //{
            //    PanelBase parentPanel = Parent as PanelBase;
            //    if (parentPanel.Layout == LayoutType.Fit
            //        || parentPanel.Layout == LayoutType.Anchor
            //        || parentPanel.Layout == LayoutType.Border)
            //    {
            //        OB.RemoveProperty(OptionName.AutoHeight);
            //        OB.RemoveProperty(OptionName.AutoWidth);
            //    }

            //}

            #endregion

            #endregion

            #region EnableIFrame

            if (EnableIFrame)
            {
                #region old code

                //string iframeJsContent = String.Empty;

                //string frameUrl = ResolveUrl(IFrameUrl);
                //JsObjectBuilder iframeBuilder = new JsObjectBuilder();
                //if (IFrameDelayLoad)
                //{
                //    iframeBuilder.AddProperty(OptionName.Src, "#");
                //}
                //else
                //{
                //    iframeBuilder.AddProperty(OptionName.Src, frameUrl);
                //}
                //iframeBuilder.AddProperty(OptionName.LoadMask, false);
                //iframeJsContent += String.Format("var {0}=new Ext.ux.ManagedIFrame('{0}',{1});", IFrameID, iframeBuilder.ToString());

                //if (IFrameDelayLoad)
                //{
                //    iframeJsContent += String.Format("{0}_url='{1}';", IFrameID, frameUrl);
                //}

                //iframeJsContent += "\r\n";

                //AddStartupScript(this, iframeJsContent);

                #endregion

                // 注意:
                // 如下依附于现有对象的属性名称的定义规则:x_property1
                // 存储于当前对象实例中
                OB.AddProperty("f_iframe", true);
                OB.AddProperty("f_iframe_url", IFrameUrl);
                OB.AddProperty("f_iframe_name", IFrameName);

                // 如果定义了IFrameUrl,则直接写到页面中,否则先缓存到此对象中
                if (!String.IsNullOrEmpty(IFrameUrl))
                {
                    //_writeIframeToHtmlDocument = true;
                    OB.AddProperty("f_iframe_loaded", true);
                    // 直接添加iframe属性
                    OB.AddProperty("html", String.Format("<iframe src=\"{0}\" name=\"{1}\" frameborder=\"0\" style=\"height:100%;width:100%;overflow:auto;\"></iframe>", IFrameUrl, IFrameName));
                }
                else
                {
                    //_writeIframeToHtmlDocument = false;
                    OB.AddProperty("f_iframe_loaded", false);
                }

                #region old code

                //// If current panel is Tab, then process the IFrameDelayLoad property.
                //Tab tab = this as Tab;
                //if (tab != null && tab.IFrameDelayLoad)
                //{
                //    // 如果是Tab,并且此Tab不是激活的,则不添加iframe
                //    //_writeIframeToHtmlDocument = false;
                //    OB.AddProperty("box_property_iframe_loaded", false);
                //}
                //else
                //{
                //    // 如果定义了IFrameUrl,则直接写到页面中,否则先缓存到此对象中
                //    if (!String.IsNullOrEmpty(IFrameUrl))
                //    {
                //        //_writeIframeToHtmlDocument = true;
                //        OB.AddProperty("box_property_iframe_loaded", true);
                //        // 直接添加iframe属性
                //        OB.AddProperty("html", String.Format("<iframe src=\"{0}\" name=\"{1}\" frameborder=\"0\" style=\"height:100%;width:100%;overflow:auto;\"></iframe>", IFrameUrl, IFrameName));
                //    }
                //    else
                //    {
                //        //_writeIframeToHtmlDocument = false;
                //        OB.AddProperty("box_property_iframe_loaded", false);
                //    }
                //}

                #endregion
            }

            #endregion

            #region RoundBorder

            //if (RoundBorder) OB.AddProperty(OptionName.Frame, true);

            #endregion

            #region oldcode

            //if (EnableLargeHeader)
            //{
            //    OB.AddProperty("cls", "f-panel-big-header");
            //}


            //OB.AddProperty("animCollapse", false);

            #endregion

            #region ContentEl

            //string finallyScript = String.Empty;

            if (RenderChildrenAsContent)
            {
                OB.AddProperty("contentEl", ContentID);

                // 在页面元素渲染完成后,才显示容器控件的内容
                //string renderScript = String.Format("Ext.get('{0}').show();", ContentID);
                //OB.Listeners.AddProperty("render", JsHelper.GetFunction(renderScript), true);

                //string beforerenderScript = String.Format("Ext.get('{0}').setStyle('display','');", ChildrenContentID);
                //OB.Listeners.AddProperty("beforerender", "function(component){" + beforerenderScript + "}", true);


                // 这一段的逻辑(2008-9-1):
                // 如果是页面第一次加载 + 此Panel在Tab中 + 此Tab不是当前激活Tab + 此Tab的TabStrip启用了延迟加载
                // 那么在页面加载完毕后,把此Panel给隐藏掉,等此Panel渲染到页面中时再显示出来

                //Tab tab = ControlUtil.FindParentControl(this, typeof(Tab)) as Tab;
                //if (tab != null)
                //{
                //    TabStrip tabStrip = tab.Parent as TabStrip;
                //    if (tabStrip.EnableDeferredRender && tabStrip.Tabs[tabStrip.ActiveTabIndex] != tab)
                //    {
                //        // 页面第一次加载时,在显示(控件的render事件)之前要先隐藏
                //        AddStartupAbsoluteScript(String.Format("Ext.get('{0}').setStyle('display','none');", ContentID));
                //    }
                //}
            }

            #endregion
        }