internal void RaiseControlCreatedEvent(System.Web.UI.WebControls.WebControl ctl, FieldSet f) { if (ControlCreated != null) ControlCreated(this, new ControlCreatedEventArgs(ctl, f)); }
internal ControlCreatedEventArgs(System.Web.UI.WebControls.WebControl ctl, FieldSet f) { Control = ctl; FieldSet = f; }
public RadioEnumEditor(FieldSet f) { _EditedField = f; }
public CheckboxEditor(FieldSet f) { _EditedField = f; }
public EnumFiledEditor(FieldSet f) { _EditedField = f; }
public RadioCheckValuesEditor(FieldSet f) { _EditedField = f; }
/// <summary> /// �����б��� /// /// �����Լ��ֵ�����Լ��ֵ������ /// �����Լ��ֵ�ṩ���������֮������ /// �����׳��쳣 /// </summary> /// <param name="f"></param> /// <returns></returns> public static void BuildListItem( FieldSet f , ListControl ctl ) { if (f.CheckValues != null && f.CheckValues.Length > 0) { for (int i = 0; i < f.CheckValues.Length; i++) { ListItem item = new ListItem(); item.Text = f.CheckValues[i].ToString(); ctl.Items.Add( item ); } } else if (f.CheckValuesProvider != null) { IDictionary dic = f.CheckValuesProvider.GetCheckValues(); foreach( DictionaryEntry d in dic ) { ListItem item = new ListItem() ; item.Value = d.Key.ToString(); item.Text = d.Value.ToString(); ctl.Items.Add(item); } } else { throw new NotSupportedException("[" + f.UniqueName + "]û��ָ��Լ��ֵ��Լ��ֵ�ṩ�����������б���"); } }
public DropDownCheckValuesEditor(FieldSet f) { _EditedField = f; }
public static System.Web.UI.WebControls.WebControl GetFieldEditor(FieldSet f) { //if( f.CheckValues != null && f.CheckValues.Length > 0 ) // return if (f.EditorType == EditorType.Auto) { if (f.Type == typeof(DateTime)) return new DateTimeFiledEditor(); if (f.Type == typeof(Boolean)) return new BooleanFiledEditor(); if (f.Type.IsEnum) return new EnumFiledEditor(f); return new StringFiledEditor(); } else { if (f.EditorType == EditorType.DateTime) return new DateTimeFiledEditor(); if (f.EditorType == EditorType.Radio) { if (f.Type.IsEnum) { return new RadioEnumEditor(f); } else if (f.CheckValues != null && f.CheckValues.Length > 0) { return new RadioCheckValuesEditor(f); } else { throw new NotSupportedException("[" + f.UniqueName + "]��ֻ����ö�����ͻ�ָ����Լ���ſ�����Radio�༭��"); } } if (f.EditorType == EditorType.Checkbox) { //if (f.CheckValues == null || f.CheckValues.Length == 0) //{ // throw new NotSupportedException("[" + f.UniqueName + "]��ֻ��ָ����Լ���ſ�����Checkbox�༭��"); //} return new CheckboxEditor(f); } if (f.EditorType == EditorType.DropDownList) { if (f.Type.IsEnum) { return new EnumFiledEditor(f); } else if (f.CheckValues != null && f.CheckValues.Length > 0) { return new DropDownCheckValuesEditor(f); } else { throw new NotSupportedException("[" + f.UniqueName + "]��ֻ����ö�����ͻ�ָ����Լ���ſ�����DropDownList�༭��"); } } //if (f.EditorType == EditorType.Resource) //{ // if (f.EditorArgs == null) // { // throw new NotSupportedException("[" + f.UniqueName + "]��Resource�༭����Ҫ��Դ��ʾ��Ϣ"); // } // return new ResourceEditor(f); //} return new StringFiledEditor(); } }
/// <summary> /// ����Ԫ���� /// </summary> /// <param name="t"></param> internal ComponentSet( Type t) { Type = t; PropertyInfo[] ps = t.GetProperties(); this.Name = t.Name; //this.DisplayName = ComponentSet.GetDisplayName(t); foreach (PropertyInfo p in ps) { if (p.PropertyType.IsValueType || p.PropertyType == typeof(String)) { FieldSet f = new FieldSet(p, this); if( f.Ignore ==false ) this.Fields.Add(f); } else if (p.PropertyType.IsClass) { ComponentSet set = new ComponentSet(this, p ); if( set.Ignore == false ) this.SubSet.Add(set); } } IList<FieldSet> sortedFields = FieldsSort(this.Fields); Fields = sortedFields; }
/// <summary> /// �Ӷ���Ԫ���� /// </summary> /// <param name="parent"></param> /// <param name="property"></param> private ComponentSet(ComponentSet parent, PropertyInfo property) { this.Property = property ; Type t = property.PropertyType; this.ParentSet = parent; this.Depth = parent.Depth + 1; EditorAttribute disAtt = ComponentSet.GetEditorAttribute(property); if (disAtt != null) { this.DisplayName = disAtt.DisplayName; this.Ignore = disAtt.Ignore; } if (String.IsNullOrEmpty(this.DisplayName)) this.DisplayName = this.Name; PropertyInfo[] ps = t.GetProperties(); this.Name = t.Name; foreach (PropertyInfo p in ps) { if (p.PropertyType.IsValueType || p.PropertyType == typeof(String)) { FieldSet f = new FieldSet(p, this); if (f.Ignore == false) this.Fields.Add(f); } else if (p.PropertyType.IsClass && p.PropertyType != parent.Type ) //��ֹ�ݹ����� { ComponentSet set = new ComponentSet(this, p); if (set.Ignore == false) this.SubSet.Add(set); } } IList<FieldSet> sortedFields = FieldsSort(this.Fields); Fields = sortedFields; }