Create() private method

private Create ( XControl control ) : DefaultScriptBuilder
control XControl
return DefaultScriptBuilder
        /// <summary>
        ///
        /// </summary>
        public string Serialize()
        {
            if (this.CombineModuleID)
            {
                this.Module.ModuleID = this.Parent.ID + this.Module.ModuleID;
                this.Module.Shortcut.SetModule(this.Module.ModuleID);
                this.CombineModuleID = false;
            }

            var           desktop = "Ext.ComponentQuery.query('desktop')[0].app";
            StringBuilder sb      = new StringBuilder();

            sb.AppendFormat(desktop + ".addModule({0});", this.Module.RenderToString());

            if (this.Module.Launcher != null)
            {
                var script = DefaultScriptBuilder.Create(this.Module.Launcher).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(desktop, this.Module.ModuleID), null, true, false, "addLauncher", true);
                sb.Append(script);
            }

            if (this.Module.Window.Count > 0)
            {
                this.Module.Window.Primary.SuspendScripting();
                this.Module.Window.Primary.AutoRender = false;
                this.Module.Window.Primary.ResumeScripting();
                var script = DefaultScriptBuilder.Create(this.Module.Window.Primary).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(desktop, this.Module.ModuleID), null, true, false, "setWindow", true);
                sb.Append(string.Format("{0}.getModule(\"{1}\").addWindow(function(){{{2}}});", desktop, this.Module.ModuleID, script));
            }

            this.added = true;

            return(sb.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="window"></param>
        public virtual void CreateWindow(AbstractWindow window)
        {
            window.AutoRender = false;
            var script = DefaultScriptBuilder.Create(window).Build(RenderMode.AddTo, this.ClientID + ".desktop", null, true, false, "showWindow", true);

            this.AddScript(script);
        }
Exemplo n.º 3
0
        public string ToScript(RenderMode mode, string element, int index, bool selfRendering)
        {
            if (this.AlreadyRendered)
            {
                return(this.directScript);
            }

            this.directScript = DefaultScriptBuilder.Create(this).Build(mode, element, index, selfRendering);

            return(this.directScript);
        }
Exemplo n.º 4
0
        public virtual string ToScript(bool selfRendering)
        {
            if (this.AlreadyRendered && this.directScript != null)
            {
                return(this.directScript);
            }

            this.directScript = DefaultScriptBuilder.Create(this).Build(selfRendering);

            return(this.directScript);
        }
Exemplo n.º 5
0
        public string ToScript(RenderMode mode, string element, int?index, bool?selfRendering, bool forceResources, string method, bool forceLazy, bool clearContainer)
        {
            if (this.AlreadyRendered)
            {
                return(this.directScript);
            }

            this.directScript = DefaultScriptBuilder.Create(this).Build(mode, element, index, selfRendering ?? this.Page == null, forceResources, method, forceLazy, clearContainer);

            return(this.directScript);
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="module"></param>
        public virtual void AddModule(DesktopModule module)
        {
            this.Call("addModule", JRawValue.From(module.RenderToString()));

            if (module.Launcher != null)
            {
                var script = DefaultScriptBuilder.Create(module.Launcher).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(this.ClientID, module.ModuleID), null, true, false, "addLauncher", true);

                this.AddScript(script);
            }

            if (module.Window.Count > 0)
            {
                var script = DefaultScriptBuilder.Create(module.Window.Primary).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(this.ClientID, module.ModuleID), null, true, false, "addWindow", true);

                this.AddScript(script);
            }
        }