Exemplo n.º 1
0
 internal void RaiseControlCreatedEvent(System.Web.UI.WebControls.WebControl ctl, FieldSet f)
 {
     if (ControlCreated != null)
         ControlCreated(this, new ControlCreatedEventArgs(ctl, f));
 }
Exemplo n.º 2
0
 internal ControlCreatedEventArgs(System.Web.UI.WebControls.WebControl ctl, FieldSet f)
 {
     Control = ctl;
     FieldSet = f;
 }
Exemplo n.º 3
0
 public RadioEnumEditor(FieldSet f)
 {
     _EditedField = f;
 }
Exemplo n.º 4
0
 public CheckboxEditor(FieldSet f)
 {
     _EditedField = f;
 }
Exemplo n.º 5
0
 public EnumFiledEditor(FieldSet f)
 {
     _EditedField = f;
 }
Exemplo n.º 6
0
 public RadioCheckValuesEditor(FieldSet f)
 {
     _EditedField = f;
 }
Exemplo n.º 7
0
        /// <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 + "]û��ָ��Լ��ֵ��Լ��ֵ�ṩ�����޷������б���");
            }
        }
Exemplo n.º 8
0
 public DropDownCheckValuesEditor(FieldSet f)
 {
     _EditedField = f;
 }
Exemplo n.º 9
0
        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();
            }
        }
Exemplo n.º 10
0
        /// <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;
        }
Exemplo n.º 11
0
        /// <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;
        }