/// <summary>
        ///
        /// </summary>
        public PropertyGridParameter.Builder PropertyGridParameter(PropertyGridParameter component)
        {
#if MVC
            component.ViewContext = this.HtmlHelper != null ? this.HtmlHelper.ViewContext : null;
#endif
            return(new PropertyGridParameter.Builder(component));
        }
Esempio n. 2
0
 void Source_AfterItemRemove(PropertyGridParameter item)
 {
     if (item.Editor.Count > 0)
     {
         this.RemoveEditor(item.Editor.Primary);
     }
 }
Esempio n. 3
0
        public void AddProperty(PropertyGridParameter property)
        {
            if (property.DisplayName.IsNotEmpty())
            {
                this.Set("propertyNames[{0}]".FormatWith(JSON.Serialize(property.Name)), property.DisplayName);
            }

            if (!property.Renderer.IsDefault)
            {
                this.Set("customRenderers[{0}]".FormatWith(JSON.Serialize(property.Name)), new JRawValue(property.Renderer.ToConfigString()));
            }

            if (property.Editor.Count > 0)
            {
                string options = property.EditorOptions.Serialize();
                options = options.Replace("{", "{{").Replace("}", "}}");
                string tpl = "new Ext.grid.CellEditor(Ext.apply({{field:{0}}}, " + options + "))";

                property.Editor[0].PreventRenderTo = true;
                property.Editor[0].Visible         = true;

                this.Set(string.Concat("customEditors[", JSON.Serialize(property.Name), "]"), new JRawValue(string.Format(tpl, property.Editor[0].ToConfig(LazyMode.Config))));
                property.Editor[0].Visible = false;
            }

            this.Call("setProperty", property.Name, property.Mode == ParameterMode.Raw ? (object)new JRawValue(property.Value) : (object)property.Value, true);
        }
Esempio n. 4
0
        void Source_AfterItemAdd(PropertyGridParameter item)
        {
            if (item.Editor.Count > 0)
            {
                this.AddEditor(item.Editor.Primary);
            }

            item.Editor.AfterItemAdd    += AddEditor;
            item.Editor.AfterItemRemove += RemoveEditor;
        }
Esempio n. 5
0
        public void AddProperty(PropertyGridParameter property)
        {
            string config = property.ToConfig(true);

            if (config.IsNotEmpty())
            {
                this.AddScript("Ext.apply({0}.sourceConfig, {{{1}}});", this.ClientID, config);
            }

            this.Call("setProperty", property.ToName(), property.ValueToString(), true);
        }
Esempio n. 6
0
        void BuildSource(string strSource)
        {
            if (this.dataChangedEventHandled)
            {
                return;
            }

            PropertyGridParameterCollection result = new PropertyGridParameterCollection();
            JObject jo = JObject.Parse(strSource);

            foreach (JProperty property in jo.Properties())
            {
                string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                PropertyGridParameter newP = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                PropertyGridParameter oldP = this.FindParam(property.Name);
                newP.Mode = oldP.Mode;

                if (oldP.Editor.Count > 0)
                {
                    newP.Editor.Add(oldP.Editor.Editor);
                }

                newP.IsChanged = newP.Name.IsEmpty() || oldP.Value != newP.Value;

                if (newP.IsChanged)
                {
                    raiseChanged = true;
                }
                result.Add(newP);
            }

            this.Source.Clear();

            foreach (PropertyGridParameter parameter in result)
            {
                this.Source.Add(parameter);
            }

            this.dataChangedEventHandled = true;
        }
Esempio n. 7
0
        public void AddProperty(PropertyGridParameter property)
        {
            if (property.DisplayName.IsNotEmpty())
            {
                this.Set("propertyNames[{0}]".FormatWith(JSON.Serialize(property.Name)), property.DisplayName);
            }

            if (!property.Renderer.IsDefault)
            {
                this.Set("customRenderers[{0}]".FormatWith(JSON.Serialize(property.Name)), new JRawValue(property.Renderer.ToConfigString()));
            }

            if (property.Editor.Count > 0)
            {
                property.Editor[0].AutoRender = false;
                property.Editor[0].Visible    = true;
                this.Set("customEditors[{0}]".FormatWith(JSON.Serialize(property.Name)), new JRawValue("new Ext.grid.GridEditor({0})".FormatWith(property.Editor[0].ToConfig(LazyMode.Instance))));
                property.Editor[0].Visible = false;
            }

            this.Call("setProperty", property.Name, property.Mode == ParameterMode.Raw ? (object)new JRawValue(property.Value) : (object)property.Value, true);
        }
Esempio n. 8
0
        void BuildSource(string strSource)
        {
            if (this.dataChangedEventHandled)
            {
                return;
            }

            PropertyGridParameterCollection result = new PropertyGridParameterCollection();
            JObject jo = JObject.Parse(strSource);

            foreach (JProperty property in jo.Properties())
            {
                string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                PropertyGridParameter newP  = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                PropertyGridParameter param = this.FindParam(property.Name);

                if (param == null)
                {
                    param           = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                    param.IsChanged = true;
                }
                else
                {
                    param.IsChanged = param.Value != value;
                    param.Value     = value;
                }

                if (param.IsChanged)
                {
                    raiseChanged = true;
                }
                result.Add(param);
            }

            this.Source.Clear();
            this.Source.AddRange(result);

            this.dataChangedEventHandled = true;
        }
Esempio n. 9
0
        public void AddProperty(PropertyGridParameter property)
        {
            if (property.DisplayName.IsNotEmpty())
            {
                this.Set("propertyNames[{0}]".FormatWith(JSON.Serialize(property.Name)), property.DisplayName);
            }

            if (!property.Renderer.IsDefault)
            {
                this.Set("customRenderers[{0}]".FormatWith(JSON.Serialize(property.Name)), new JRawValue(property.Renderer.ToConfigString()));
            }

            if (property.Editor.Count > 0)
            {
                property.Editor[0].AutoRender = false;
                property.Editor[0].Visible = true;
                this.Set("customEditors[{0}]".FormatWith(JSON.Serialize(property.Name)), new JRawValue("new Ext.grid.GridEditor({0})".FormatWith(property.Editor[0].ToConfig(LazyMode.Instance))));
                property.Editor[0].Visible = false;
            }

            this.Call("setProperty", property.Name, property.Mode == ParameterMode.Raw ? (object)new JRawValue(property.Value) : (object)property.Value, true);
        }
Esempio n. 10
0
        void BuildSource(string strSource)
        {
            if (this.dataChangedEventHandled)
            {
                return;
            }
            
            PropertyGridParameterCollection result = new PropertyGridParameterCollection();
            JObject jo = JObject.Parse(strSource);

            foreach (JProperty property in jo.Properties())
            {
                string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                PropertyGridParameter newP = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                PropertyGridParameter oldP = this.FindParam(property.Name);
                newP.Mode = oldP.Mode;
                
                if (oldP.Editor.Count > 0)
                {
                    newP.Editor.Add(oldP.Editor.Editor);    
                }

                newP.IsChanged = newP.Name.IsEmpty() || oldP.Value != newP.Value;

                if (newP.IsChanged)
                {
                    raiseChanged = true;
                }
                result.Add(newP);
            }

            this.Source.Clear();

            foreach (PropertyGridParameter parameter in result)
            {
                this.Source.Add(parameter);
            }

            this.dataChangedEventHandled = true;
        }
 /// <summary>
 ///
 /// </summary>
 public PropertyGridParameter.Builder PropertyGridParameter(PropertyGridParameter component)
 {
     return(new PropertyGridParameter.Builder(component));
 }
Esempio n. 12
0
        public void AddProperty(PropertyGridParameter property)
        {
            if (property.DisplayName.IsNotEmpty())
            {
                this.Set("propertyNames[{0}]".FormatWith(JSON.Serialize(property.Name)), property.DisplayName);
            }

            if (!property.Renderer.IsDefault)
            {
                this.Set("customRenderers[{0}]".FormatWith(JSON.Serialize(property.Name)), new JRawValue(property.Renderer.ToConfigString()));
            }

            if (property.Editor.Count > 0)
            {
                string options = property.EditorOptions.Serialize();
                options = options.Replace("{", "{{").Replace("}", "}}");
                string tpl = "new Ext.grid.CellEditor(Ext.apply({{field:{0}}}, " + options + "))";

                property.Editor[0].PreventRenderTo = true;
                property.Editor[0].Visible = true;

                this.Set(string.Concat("customEditors[", JSON.Serialize(property.Name), "]"), new JRawValue(string.Format(tpl,property.Editor[0].ToConfig(LazyMode.Config))));
                property.Editor[0].Visible = false;
            }

            this.Call("setProperty", property.Name, property.Mode == ParameterMode.Raw ? (object)new JRawValue(property.Value) : (object)property.Value, true);
        }
Esempio n. 13
0
 void Source_AfterItemRemove(PropertyGridParameter item)
 {
     if (item.Editor.Count > 0)
     {
         this.RemoveEditor(item.Editor.Primary);
     }
 }
Esempio n. 14
0
        void Source_AfterItemAdd(PropertyGridParameter item)
        {
            if (item.Editor.Count > 0)
            {
                this.AddEditor(item.Editor.Primary);
            }

            item.Editor.AfterItemAdd += AddEditor;
            item.Editor.AfterItemRemove += RemoveEditor;
        }
Esempio n. 15
0
        public void AddProperty(PropertyGridParameter property)
        {
            string config = property.ToConfig(true);
            
            if (config.IsNotEmpty())
            {
                this.AddScript("Ext.apply({0}.sourceConfig, {{{1}}});", this.ClientID, config);
            }

            this.Call("setProperty", property.ToName(), property.ValueToString(), true);
        }
Esempio n. 16
0
        void BuildSource(string strSource)
        {
            if (this.dataChangedEventHandled)
            {
                return;
            }
            
            PropertyGridParameterCollection result = new PropertyGridParameterCollection();
            JObject jo = JObject.Parse(strSource);

            foreach (JProperty property in jo.Properties())
            {
                string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                PropertyGridParameter newP = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                PropertyGridParameter param = this.FindParam(property.Name);

                if (param == null)
                {
                    param = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                    param.IsChanged = true;
                }
                else
                {
                    param.IsChanged = param.Value != value;
                    param.Value = value;                    
                }

                if (param.IsChanged)
                {
                    raiseChanged = true;
                }
                result.Add(param);
            }

            this.Source.Clear();
            this.Source.AddRange(result);

            this.dataChangedEventHandled = true;
        }