Esempio n. 1
0
 private void InitGridCommand()
 {
     if ((this.EditorConfig != null) && (this.EditorConfig.Mode == EditorMode.Window))
     {
         Window window = new Window
         {
             AutoShow = false,
             Hidden = true,
             CloseAction = CloseAction.Hide,
             Closable = true,
             ConstrainHeader = true,
             Constrain = true,
             Modal = true,
             BodyPadding = 10
         };
         ComponentLoader loader = new ComponentLoader
         {
             DisableCaching = true,
             AutoLoad = false,
             Mode = LoadMode.Frame
         };
         window.Loader = loader;
         this._editWindow = window;
         this._editWindow.Loader.LoadMask.ShowMask = true;
         this._editWindow.Loader.LoadMask.Msg = "正在加载";
         this._editWindow.ID = "_editWindow";
         this.Controls.Add(this._editWindow);
         CommandColumn item = (CommandColumn)this.ColumnModel.Columns.FirstOrDefault<ColumnBase>(x => (x is CommandColumn));
         GridCommand command = null;
         if (this.EnableEdit)
         {
             command = new GridCommand
             {
                 Text = "编辑",
                 Icon = Ext.Net.Icon.ApplicationEdit,
                 CommandName = "edit"
             };
         }
         GridCommand commandRemove = null;
         if (this.EnableRemove)
         {
             commandRemove = new GridCommand
             {
                 Text = "删除",
                 Icon = Ext.Net.Icon.ApplicationDelete,
                 CommandName = "delete"
             };
         }
         if (item == null)
         {
             item = new CommandColumn();
             item.DirectEvents.Command.Confirmation.ConfirmRequest = true;
             item.DirectEvents.Command.Confirmation.Message = "确认删除?";
             item.DirectEvents.Command.Confirmation.Title = "提示";
             item.DirectEvents.Command.Confirmation.BeforeConfirm = "if(command=='delete')return true;return false;";
             item.Width = 150;
             if (this.EnableEdit)
             {
                 item.Commands.Add(command);
             }
             if (this.EnableRemove)
             {
                 item.Commands.Add(commandRemove);
             }
             this.ColumnModel.Columns.Insert(0, item);
             this.InitGridCommand(item);
             if (EditorConfig.EditWindow != null)
                 item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
         }
         else
         {
             GridCommand commandEdit = (GridCommand)item.Commands.FirstOrDefault<GridCommandBase>(x => (((GridCommand)x).CommandName == "edit"));
             if (commandEdit == null)
             {
                 commandEdit = command;
                 this.InitGridCommand(item);
                 if (EnableRemove)
                     item.Commands.Insert(0, commandRemove);
                 if (EnableEdit)
                     item.Commands.Insert(0, commandEdit);
                 if (EditorConfig.EditWindow != null)
                     item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
             }
         }
     }
 }
Esempio n. 2
0
 public static void Render(UserControl userControl, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender, bool registerResources)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToConfig(userControl, componentPreRender, registerResources));
 }
Esempio n. 3
0
 public static string ToConfig(UserControl userControl, bool registerResources)
 {
     return(ComponentLoader.ToConfig(userControl, null, registerResources));
 }
Esempio n. 4
0
 public static string ToConfig(string path, string userControlId, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender, bool registerResources)
 {
     return(ComponentLoader.ToConfig(UserControlRenderer.LoadControl(path, userControlId), componentPreRender, registerResources));
 }
Esempio n. 5
0
 public static void Render(UserControl userControl, bool registerResources)
 {
     ComponentLoader.Render(userControl, null, registerResources);
 }
Esempio n. 6
0
 public static void Render(string path, string userControlId, bool registerResources)
 {
     ComponentLoader.Render(UserControlRenderer.LoadControl(path, userControlId), registerResources);
 }
Esempio n. 7
0
 public static string ToConfig(string path, string userControlId)
 {
     return(ComponentLoader.ToConfig(UserControlRenderer.LoadControl(path, userControlId)));
 }
Esempio n. 8
0
 public static void Render(AbstractComponent component, bool registerResources)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToConfig(component, registerResources));
 }
Esempio n. 9
0
 public static string ToConfig(AbstractComponent component)
 {
     return(ComponentLoader.ToConfig(new AbstractComponent[] { component }, true));
 }
Esempio n. 10
0
        private static string AttachResources(IEnumerable <AbstractComponent> components, string config)
        {
            InsertOrderedDictionary <string, string> scripts = new InsertOrderedDictionary <string, string>();
            InsertOrderedDictionary <string, string> styles  = new InsertOrderedDictionary <string, string>();
            List <string> ns = new List <string>();

            foreach (AbstractComponent seed in components)
            {
                ComponentLoader.FindResources(seed, scripts, styles, ns);
            }

            if (scripts.Count == 0 && styles.Count == 0 && ns.Count == 0)
            {
                return(config);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("{'x.res':{");


            if (ns.Count > 0)
            {
                sb.Append("ns:");
                sb.Append(JSON.Serialize(ns));
            }

            if (scripts.Count == 0 || styles.Count == 0)
            {
                if (ns.Count > 0)
                {
                    sb.Append(",");
                }

                sb.Append("res:[");

                bool comma = false;
                foreach (KeyValuePair <string, string> item in scripts)
                {
                    if (comma)
                    {
                        sb.Append(",");
                    }

                    comma = true;
                    sb.Append("{url:").Append(JSON.Serialize(item.Value)).Append("}");
                }

                foreach (KeyValuePair <string, string> item in styles)
                {
                    if (comma)
                    {
                        sb.Append(",");
                    }

                    comma = true;
                    sb.Append("{mode:\"css\",url:").Append(JSON.Serialize(item.Value)).Append("}");
                }

                sb.Append("]");
            }

            sb.Append("},config:").Append(JSON.Serialize(config));
            sb.Append("}");
            return(sb.ToString());
        }
Esempio n. 11
0
 public static void Render(AbstractComponent component)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToConfig(component, true));
 }
 /// <summary>
 ///
 /// </summary>
 public ComponentLoader.Builder ComponentLoader(ComponentLoader component)
 {
     return(new ComponentLoader.Builder(component));
 }
Esempio n. 13
0
 public virtual void LoadContent(ComponentLoader config)
 {
     this.Call("load", new JRawValue(new ClientConfig().Serialize(config, true)));
 }
Esempio n. 14
0
 public static void Render(UserControl userControl)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToJson(userControl));
 }
    protected void openWinMantenedorFamilia(object sender, DirectEventArgs e)
    {
      try
      {
        string url = "wf_re_familias_adm.aspx";
        string command = e.ExtraParams["command"];
        string id = e.ExtraParams["id"];
        Icon icono = Icon.None;
        string titulo = String.Empty;
        switch (command)
        {
          case "Agregar":
            url += "?op=in";
            icono = Icon.Add;
            titulo = "Agregar Familia";
            break;
          case "Modificar":
            url += "?op=mo&k=" + id;
            icono = Icon.Pencil;
            titulo = "Modificar Familia";
            break;
          case "Eliminar":
            url += "?op=el&k=" + id;
            icono = Icon.Delete;
            titulo = "Eliminar Familia";
            break;
        }

        ComponentLoader loader = new ComponentLoader { Mode = LoadMode.Frame };
        loader.LoadMask.ShowMask = true;
        loader.Url = url;

        this.winMantenedorFamilia.LoadContent(loader);
        this.winMantenedorFamilia.Title = titulo;
        this.winMantenedorFamilia.Icon = icono;
        this.winMantenedorFamilia.Show();
      }
      catch (Exception ex)
      {
        Mensajes.Error(ex.Message);
      }
    }
Esempio n. 16
0
 public static string ToConfig(AbstractComponent component, bool registerResources)
 {
     return(ComponentLoader.ToConfig(new AbstractComponent[] { component }, registerResources));
 }
Esempio n. 17
0
 public static string ToJson(string path)
 {
     return(ComponentLoader.ToJson(UserControlRenderer.LoadControl(path)));
 }
Esempio n. 18
0
 public static void Render(IEnumerable <AbstractComponent> components, bool registerResources)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToConfig(components, registerResources));
 }
Esempio n. 19
0
 public static void Render(string path, string userControlId, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender, bool registerResources)
 {
     ComponentLoader.Render(UserControlRenderer.LoadControl(path, userControlId), componentPreRender, registerResources);
 }
Esempio n. 20
0
 public static void Render(IEnumerable <AbstractComponent> components, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender, bool registerResources)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToConfig(components, componentPreRender, registerResources));
 }
Esempio n. 21
0
 public static string ToConfig(string path, string userControlId, bool registerResources)
 {
     return(ComponentLoader.ToConfig(UserControlRenderer.LoadControl(path, userControlId), registerResources));
 }
Esempio n. 22
0
 public static string ToConfig(IEnumerable <AbstractComponent> components)
 {
     return(ComponentLoader.ToConfig(components, null));
 }
Esempio n. 23
0
 public static void Render(UserControl userControl)
 {
     ComponentLoader.Render(userControl, null);
 }
Esempio n. 24
0
 public static string ToConfig(IEnumerable <AbstractComponent> components, bool registerResources)
 {
     return(ComponentLoader.ToConfig(components, null, registerResources));
 }
Esempio n. 25
0
 public static void Render(UserControl userControl, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender)
 {
     ComponentLoader.Render(userControl, null, true);
 }
Esempio n. 26
0
 public static string ToConfig(IEnumerable <AbstractComponent> components, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender)
 {
     return(ComponentLoader.ToConfig(components, componentPreRender, true));
 }
Esempio n. 27
0
 public static string ToConfig(UserControl userControl)
 {
     return(ComponentLoader.ToConfig(userControl, null));
 }
Esempio n. 28
0
 public static void Render(string path, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender)
 {
     ComponentLoader.Render(UserControlRenderer.LoadControl(path), componentPreRender);
 }
Esempio n. 29
0
 public static string ToConfig(UserControl userControl, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender)
 {
     return(ComponentLoader.ToConfig(userControl, componentPreRender, true));
 }
Esempio n. 30
0
 public static string ToConfig(string path, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender)
 {
     return(ComponentLoader.ToConfig(UserControlRenderer.LoadControl(path), componentPreRender));
 }
Esempio n. 31
0
 private void InitGridCommand()
 {
     if ((this.EditorConfig != null) && (this.EditorConfig.Mode == EditorMode.Window))
     {
         Window window = new Window
         {
             AutoShow = false,
             Hidden = true,
             CloseAction = CloseAction.Hide,
             Closable = true,
             ConstrainHeader = true,
             Constrain = true,
             Modal = true,
             BodyPadding = 10
         };
         ComponentLoader loader = new ComponentLoader
         {
             DisableCaching = true,
             AutoLoad = false,
             Mode = LoadMode.Frame
         };
         window.Loader = loader;
         this._editWindow = window;
         this._editWindow.Loader.LoadMask.ShowMask = true;
         this._editWindow.Loader.LoadMask.Msg = "正在加载";
         this._editWindow.ID = "editWindow";
         _editWindow.Resizable = false;
         _editWindow.Icon = Ext.Net.Icon.UserAdd;
         this.Controls.Add(this._editWindow);
         CommandColumn item = (CommandColumn)this.ColumnModel.Columns.FirstOrDefault<ColumnBase>(x => (x is CommandColumn));
         GridCommand command = null;
         if (this.EnableEdit)
         {
             command = new GridCommand
             {
                 Text = "编辑",
                 Icon = Ext.Net.Icon.ApplicationEdit,
                 CommandName = "edit"
             };
         }
         GridCommand commandRemove = null;
         if (this.EnableRemove)
         {
             commandRemove = new GridCommand
             {
                 Text = "删除",
                 Icon = Ext.Net.Icon.ApplicationDelete,
                 CommandName = "delete"
             };
         }
         if (item == null)
         {
             item = new CommandColumn();
             item.DirectEvents.Command.Confirmation.ConfirmRequest = true;
             item.DirectEvents.Command.Confirmation.Message = "确认删除?";
             item.DirectEvents.Command.Confirmation.Title = "提示";
             item.DirectEvents.Command.Confirmation.BeforeConfirm = "if(command=='delete')return true;return false;";
             item.Width = 150;
             if (this.EnableEdit)
             {
                 item.Commands.Add(command);
             }
             if (this.EnableRemove)
             {
                 item.Commands.Add(commandRemove);
             }
             this.ColumnModel.Columns.Insert(0, item);
             this.InitGridCommand(item);
             if (EditorConfig.EditWindow != null)
             {
                 var replaceParamsScripts = new List<string>();
                 var scriptTpl = "url=url.replace('{0}',{1});";
                 foreach (var paras in EditorConfig.EditWindow.ExtraParams)
                 {
                     var script = string.Format(scriptTpl, "@" + paras.Name, paras.Value);
                     replaceParamsScripts.Add(script);
                 }
                 item.Listeners.Command.Handler = "if(command==\"edit\"){var url='" + EditorConfig.EditWindow.Url + "';" + string.Join(";", replaceParamsScripts) + "var editWindow=App." + _editWindow.ID + ";editWindow.show();editWindow.loader.load({url:url});editWindow.setTitle(\"" + EditorConfig.EditWindow.Title + "\");editWindow.setWidth(" + EditorConfig.EditWindow.Width + ");editWindow.setHeight(" + EditorConfig.EditWindow.Height + ");editWindow.center();}else{Ext.Msg.confirm(\"提示\",\"确认删除吗?\",function(r){if(r==\"yes\"){               }})}";
                 //item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
             }
         }
         else
         {
             GridCommand commandEdit = (GridCommand)item.Commands.FirstOrDefault<GridCommandBase>(x => (((GridCommand)x).CommandName == "edit"));
             if (commandEdit == null)
             {
                 commandEdit = command;
                 this.InitGridCommand(item);
                 if (EnableRemove)
                     item.Commands.Insert(0, commandRemove);
                 if (EnableEdit)
                     item.Commands.Insert(0, commandEdit);
                 if (EditorConfig.EditWindow != null)
                     item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
             }
         }
     }
 }
Esempio n. 32
0
 public static void Render(string path, string userControlId)
 {
     ComponentLoader.Render(UserControlRenderer.LoadControl(path, userControlId));
 }
 public virtual void LoadContent(ComponentLoader config)
 {
     this.Call("load", new JRawValue(new ClientConfig().Serialize(config, true)));
 }
Esempio n. 34
0
 public static void Render(IEnumerable <AbstractComponent> components)
 {
     CompressionUtils.GZipAndSend(ComponentLoader.ToJson(components));
 }