Пример #1
0
        public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipSecurityFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);

                if (propertyConfig != null && propertyConfig.PropertyConfiguration != null)
                {
                    IAccessPolicy accessSecurity = GetAccess(propertyConfig.PropertyConfiguration.Security);
                    if (accessSecurity != null)
                    {
                        propertyBag.Enabled    = accessSecurity.Enabled;
                        propertyBag.ReadOnly   = accessSecurity.ReadOnly;
                        propertyBag.Visibility = accessSecurity.Visibility;
                    }
                }
                else
                {
                    setDefalutSecurity(propertyBag);
                }
            }
            else
            {
                setDefalutSecurity(propertyBag);
            }
        }
Пример #2
0
        public static MvcHtmlString BallyTextArea <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, StylePropertyBag style = null, short tabIndex = 0, string onLeaveFunction = "", string onKeyUpFunction = "", string onKeyDownFunction = "", string onChangeFunction = "", string cssClass = "", bool?isEnabled = null, bool?isReadOnly = null, IDictionary <string, object> attributes = null)
        {
            string propertyName       = string.Empty;
            string modelName          = string.Empty;
            object value              = string.Empty;
            string errMsg             = string.Empty;
            string textAreaHTMLString = string.Empty;
            string configKey          = string.Empty;
            Dictionary <string, string> overrideSettings;

            ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey);

            overrideSettings = GetTextAreaOverrideSettings(style, tabIndex, onLeaveFunction, onKeyUpFunction, onKeyDownFunction, onChangeFunction, cssClass);

            var          fillers             = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams        = new FillerParams(modelName, propertyName, overrideSettings, isEnabled: isEnabled, isReadOnly: isReadOnly, attributes: attributes, configKey: configKey);
            var          textAreapropertyBag = new TextAreaPropertyBag(fillerParams);

            textAreapropertyBag.Accept(fillers);
            textAreapropertyBag.ErrorMessage = errMsg;
            textAreapropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;

            var textAreaHTMLEmitter = new TextAreaHTMLEmitter(value != null ? value.ToString() : string.Empty, textAreapropertyBag);

            textAreaHTMLEmitter.Emit(out textAreaHTMLString);
            return(MvcHtmlString.Create(textAreaHTMLString));
        }
        public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex          = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnLeaveFunction   = fillerParams.OverrideSettings[ControlLibConstants.ON_LEAVE_FUNCTION];
                propertyBag.OnKeyUpFunction   = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_UP_FUNCTION];
                propertyBag.OnKeyDownFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_DOWN_FUNCTION];
                propertyBag.OnChangeFunction  = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];
                propertyBag.Attributes        = fillerParams.Attributes;

                if (propertyBag.Style == null && (fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) || fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT)))
                {
                    propertyBag.Style = new StylePropertyBag();
                }
                if (propertyBag.Style != null)
                {
                    propertyBag.Style.Width  = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) ? fillerParams.OverrideSettings[ControlLibConstants.WIDTH] : string.Empty;
                    propertyBag.Style.Height = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT) ? fillerParams.OverrideSettings[ControlLibConstants.HEIGHT] : string.Empty;
                }
                if (fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS] != string.Empty)
                {
                    propertyBag.CssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS];
                }
            }
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled  = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }
Пример #4
0
        public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyTextArea);

            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass    = controlDefault.ControlErrorCssClass;
            }
        }
Пример #5
0
 public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
Пример #6
0
 public TextAreaHTMLEmitter(string value, TextAreaPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
 }
Пример #7
0
        public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipSecurityFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);

                if (propertyConfig != null && propertyConfig.PropertyConfiguration != null)
                {
                    IAccessPolicy accessSecurity = GetAccess(propertyConfig.PropertyConfiguration.Security);
                    if (accessSecurity != null)
                    {
                        propertyBag.Enabled = accessSecurity.Enabled;
                        propertyBag.ReadOnly = accessSecurity.ReadOnly;
                        propertyBag.Visibility = accessSecurity.Visibility;
                    }
                }
                else
                {
                    setDefalutSecurity(propertyBag);
                }
            }
            else
            {
                setDefalutSecurity(propertyBag);
            }
        }
Пример #8
0
 public virtual void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams) { }
Пример #9
0
 public virtual void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
 {
 }
Пример #10
0
 public TextAreaHTMLEmitter(string value, TextAreaPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
 }
Пример #11
0
 public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
Пример #12
0
        public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyTextArea);
            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass;
            }
        }
        public override void Fill(TextAreaPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnLeaveFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_LEAVE_FUNCTION];
                propertyBag.OnKeyUpFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_UP_FUNCTION];
                propertyBag.OnKeyDownFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_DOWN_FUNCTION];
                propertyBag.OnChangeFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];
                propertyBag.Attributes = fillerParams.Attributes;

                if (propertyBag.Style == null && (fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) || fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT)))
                {
                    propertyBag.Style = new StylePropertyBag();
                }
                if (propertyBag.Style != null)
                {
                    propertyBag.Style.Width = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) ? fillerParams.OverrideSettings[ControlLibConstants.WIDTH] : string.Empty;
                    propertyBag.Style.Height = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT) ? fillerParams.OverrideSettings[ControlLibConstants.HEIGHT] : string.Empty;
                }
                if (fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS] != string.Empty)
                {
                    propertyBag.CssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS];
                }
            }
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }