/// <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> /// Constructor /// </summary> /// <param name="p_Value"></param> /// <param name="p_CellType"></param> /// <param name="p_StandardValues"></param> /// <param name="p_StandardValuesExclusive"></param> public ComboBox(object p_Value, Type p_CellType, System.Collections.ICollection p_StandardValues, bool p_StandardValuesExclusive) : base(p_Value) { DataModel = new DataModels.EditorComboBox(p_CellType, p_StandardValues, p_StandardValuesExclusive); }
/// <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> /// Initializes a new instance of the <see cref="ComboBoxCell"/> class. /// </summary> /// <param name="p_CellType">Type of the cell.</param> /// <param name="p_StandardValues">The standard values.</param> /// <param name="p_StandardValuesExclusive">if set to <c>true</c> standard values are exclusive.</param> protected ComboBoxCell(Type p_CellType, System.Collections.ICollection p_StandardValues, bool p_StandardValuesExclusive) { DataModel = new DataModels.EditorComboBox(p_CellType, p_StandardValues, p_StandardValuesExclusive); }
/// <summary> /// Initializes a new instance of the <see cref="ComboBoxCell"/> class. /// </summary> /// <param name="value">The value to display</param> /// <param name="p_CellType">The data type</param> /// <param name="p_StandardValues">The collection of items</param> /// <param name="p_StandardValuesExclusive">If true only the standard values are supported</param> public ComboBoxCell(object value, Type p_CellType, System.Collections.ICollection p_StandardValues, bool p_StandardValuesExclusive) : base(value) { DataModel = new DataModels.EditorComboBox(p_CellType, p_StandardValues, p_StandardValuesExclusive); }