/// <summary> /// Creates the data model. /// Construct a CellEditor for the specified type /// </summary> /// <param name="p_Type">Cell Type</param> /// <param name="p_DefaultValue">Default value of the editor</param> /// <param name="p_bAllowNull">Allow null</param> /// <param name="p_StandardValues">List of available values or null if there is no available values list</param> /// <param name="p_bStandardValueExclusive">Indicates whether the p_StandardValue are the unique values supported</param> /// <param name="p_TypeConverter">Type converter used for conversion for the specified type</param> /// <param name="p_UITypeEditor">UITypeEditor if null must be populated the TypeConverter</param> /// <returns></returns> public static DataModels.IDataModel CreateDataModel(Type p_Type, object p_DefaultValue, bool p_bAllowNull, System.Collections.ICollection p_StandardValues, bool p_bStandardValueExclusive, System.ComponentModel.TypeConverter p_TypeConverter, System.Drawing.Design.UITypeEditor p_UITypeEditor) { DataModels.DataModelBase l_Editor; if (p_UITypeEditor == null) { if (p_StandardValues != null) { DataModels.EditorComboBox l_EditCombo = new DataModels.EditorComboBox(p_Type); l_Editor = l_EditCombo; } else if (p_TypeConverter != null && p_TypeConverter.CanConvertFrom(typeof(string)))//txtbox { DataModels.EditorTextBox l_EditTextBox = new DataModels.EditorTextBox(p_Type); l_Editor = l_EditTextBox; } else // if no editor no edit support { l_Editor = null; } } else // UITypeEditor supported { DataModels.EditorUITypeEditor l_UITypeEditor = new DataModels.EditorUITypeEditor(p_Type, p_UITypeEditor); l_Editor = l_UITypeEditor; } if (l_Editor != null) { l_Editor.DefaultValue = p_DefaultValue; l_Editor.AllowNull = p_bAllowNull; ////l_Editor.CellType = p_Type; l_Editor.StandardValues = p_StandardValues; l_Editor.StandardValuesExclusive = p_bStandardValueExclusive; l_Editor.TypeConverter = p_TypeConverter; } return(l_Editor); }
/// <summary> /// Creates the data model. /// Construct a CellEditor for the specified type /// </summary> /// <param name="p_Type">Cell Type</param> /// <param name="p_DefaultValue">Default value of the editor</param> /// <param name="p_bAllowNull">Allow null</param> /// <param name="p_StandardValues">List of available values or null if there is no available values list</param> /// <param name="p_bStandardValueExclusive">Indicates whether the p_StandardValue are the unique values supported</param> /// <param name="p_TypeConverter">Type converter used for conversion for the specified type</param> /// <param name="p_UITypeEditor">UITypeEditor if null must be populated the TypeConverter</param> /// <returns></returns> public static DataModels.IDataModel CreateDataModel(Type p_Type, object p_DefaultValue, bool p_bAllowNull, System.Collections.ICollection p_StandardValues, bool p_bStandardValueExclusive, System.ComponentModel.TypeConverter p_TypeConverter, System.Drawing.Design.UITypeEditor p_UITypeEditor) { DataModels.DataModelBase l_Editor; if (p_UITypeEditor == null) { if (p_StandardValues != null) { DataModels.EditorComboBox l_EditCombo = new DataModels.EditorComboBox(p_Type); l_Editor = l_EditCombo; } else if (p_TypeConverter != null && p_TypeConverter.CanConvertFrom(typeof(string)))//txtbox { DataModels.EditorTextBox l_EditTextBox = new DataModels.EditorTextBox(p_Type); l_Editor = l_EditTextBox; } else // if no editor no edit support { l_Editor = null; } } else // UITypeEditor supported { DataModels.EditorUITypeEditor l_UITypeEditor = new DataModels.EditorUITypeEditor(p_Type, p_UITypeEditor); l_Editor = l_UITypeEditor; } if (l_Editor != null) { l_Editor.DefaultValue = p_DefaultValue; l_Editor.AllowNull = p_bAllowNull; ////l_Editor.CellType = p_Type; l_Editor.StandardValues = p_StandardValues; l_Editor.StandardValuesExclusive = p_bStandardValueExclusive; l_Editor.TypeConverter = p_TypeConverter; } return l_Editor; }