public override void Fill(TemplateListPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.SkipSecurityFill == false) { IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey); if (propertyConfig != 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); } }
public ListBoxHTMLEmitter(string value, TemplateListPropertyBag propertyBag) : base(propertyBag.Validators, propertyBag.Mandatory) { this._propertyBag = propertyBag; this.Value = value; getTemplateHtml(propertyBag.TemplateHTML, out _templateHtml); _templateScriptTagID = string.Format("template_{0}", this._propertyBag.ControlName); }
public TemplateListHTMLEmitter(string value, TemplateListPropertyBag propertyBag) : base(propertyBag.Validators, propertyBag.Mandatory) { this._propertyBag = propertyBag; this.Value = value; getTemplateHtml(propertyBag.TemplateHTML, out _templateHtml); _templateScriptTagID = string.Format("template_{0}", this._propertyBag.ControlName); }
public override void Fill(TemplateListPropertyBag propertyBag, FillerParams fillerParams) { //Filling implementation code if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0) { propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]); propertyBag.ListItem = ControlHelper.GetListItems(fillerParams.List, fillerParams.ValueMember, fillerParams.Param); propertyBag.ListDisplayLength = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.LIST_LENGTH]); propertyBag.OnClickFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CLICK_FUNCTION]; propertyBag.TemplateNameKey = fillerParams.OverrideSettings[ControlLibConstants.TEMPLATE_NAME_KEY]; if (!string.IsNullOrEmpty(fillerParams.OverrideSettings[ControlLibConstants.LISTITEM_TEMPLATE_CSSCLASS])) { propertyBag.ListItemTemplateCssClass = fillerParams.OverrideSettings[ControlLibConstants.LISTITEM_TEMPLATE_CSSCLASS]; } if (!string.IsNullOrEmpty(fillerParams.OverrideSettings[ControlLibConstants.LISTITEM_SELECTED_CSSCLASS])) { propertyBag.ListItemSelectedCssClass = fillerParams.OverrideSettings[ControlLibConstants.LISTITEM_SELECTED_CSSCLASS]; } IControlTemplateConfiguration templateObject = ControlLibraryConfig.ControlConfigReader.GetTemplateConfiguration(fillerParams.TemplateNameKey); if (templateObject != null) { propertyBag.TemplateHTML = templateObject.TemplateHTML; } 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; } } propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly; propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled; SetVisibility(propertyBag, fillerParams); }
public static MvcHtmlString BallyListBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, ItemDataSource dataSource, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", string listItemTemplateCssClass = "", string listItemMouseOverCssClass = "", string listItemSelectedCssClass = "") { string propertyName = string.Empty; string modelName = string.Empty; object value = string.Empty; string errMsg = string.Empty; string controlHtmlString = string.Empty; Dictionary <string, string> overrideSettings; string configKey = string.Empty; ListBoxHTMLEmitter controlHtmlEmitter; ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey); overrideSettings = GetBallyListBoxOverrideSettings(listLength, style, tabIndex, onClickFunction, value, listItemTemplateCssClass, listItemMouseOverCssClass, listItemSelectedCssClass); FillerParams fillerParams = null; if (dataSource != null) { string[] displayParam = new string[1]; displayParam[0] = dataSource.DisplayMember; fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, param: displayParam, templateKeyName: DefaultTemplate.SimpleListTemplate.ToString(), listType: ListBoxType.SimpleList, configKey: configKey); } else { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, param: null, templateKeyName: DefaultTemplate.SimpleListTemplate.ToString(), listType: ListBoxType.SimpleList, configKey: configKey); } var fillers = ControlPropertyFillerFactory.Get(); var controlPropertyBag = new TemplateListPropertyBag(fillerParams); controlPropertyBag.Accept(fillers); controlPropertyBag.ErrorMessage = errMsg; controlPropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; controlHtmlEmitter = new ListBoxHTMLEmitter(value != null ? value.ToString() : string.Empty, controlPropertyBag); controlHtmlEmitter.Emit(out controlHtmlString); return(MvcHtmlString.Create(controlHtmlString)); }
public override void Fill(TemplateListPropertyBag propertyBag, FillerParams fillerParam) { propertyBag.ControlName = fillerParam.ControlName; IControlDefaultPropertyBag controlDefault = null; if (fillerParam.ListType == ListBoxType.SimpleList) { controlDefault = ReadDefaultConfiguration(ControlNames.BallyListBox); } else { controlDefault = ReadDefaultConfiguration(ControlNames.BallyTemplateListBox); } if (controlDefault != null) { propertyBag.CssClass = controlDefault.CssClass; propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass; propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass; propertyBag.ListItemTemplateCssClass = controlDefault.ListItemTemplateCssClass; //propertyBag.ListItemMouseOverCssClass = controlDefault.ListItemMouseOverCssClass; propertyBag.ListItemSelectedCssClass = controlDefault.ListItemSelectedCssClass; } }
public override void Fill(TemplateListPropertyBag propertyBag, FillerParams fillerParams) { fillValidators(propertyBag, fillerParams); }
public virtual void Fill(TemplateListPropertyBag propertyBag, FillerParams fillerParams) { }