using System;
namespace DelftTools.Utils.PropertyBag
{
///
/// Represents a single property in a PropertySpec.
///
public class PropertySpec
{
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
public PropertySpec(string name, string type) : this(name, type, null, null, null) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
public PropertySpec(string name, Type type)
:
this(name, type.AssemblyQualifiedName, null, null, null) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
public PropertySpec(string name, string type, string category) : this(name, type, category, null, null) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
///
public PropertySpec(string name, Type type, string category)
:
this(name, type.AssemblyQualifiedName, category, null, null) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
public PropertySpec(string name, string type, string category, string description)
:
this(name, type, category, description, null) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
public PropertySpec(string name, Type type, string category, string description)
:
this(name, type.AssemblyQualifiedName, category, description, null) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
public PropertySpec(string name, string type, string category, string description, object defaultValue)
{
Name = name;
TypeName = type;
Category = category;
Description = description;
DefaultValue = defaultValue;
Attributes = null;
}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
public PropertySpec(string name, Type type, string category, string description, object defaultValue)
:
this(name, type.AssemblyQualifiedName, category, description, defaultValue) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The fully qualified name of the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The fully qualified name of the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, string type, string category, string description, object defaultValue,
string editor, string typeConverter)
: this(name, type, category, description, defaultValue)
{
EditorTypeName = editor;
ConverterTypeName = typeConverter;
}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The fully qualified name of the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The fully qualified name of the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, Type type, string category, string description, object defaultValue,
string editor, string typeConverter)
:
this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor, typeConverter) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The Type that represents the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The fully qualified name of the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, string type, string category, string description, object defaultValue,
Type editor, string typeConverter)
:
this(name, type, category, description, defaultValue, editor.AssemblyQualifiedName,
typeConverter) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The Type that represents the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The fully qualified name of the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, Type type, string category, string description, object defaultValue,
Type editor, string typeConverter)
:
this(name, type.AssemblyQualifiedName, category, description, defaultValue,
editor.AssemblyQualifiedName, typeConverter) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The fully qualified name of the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The Type that represents the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, string type, string category, string description, object defaultValue,
string editor, Type typeConverter)
:
this(name, type, category, description, defaultValue, editor, typeConverter.AssemblyQualifiedName) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The fully qualified name of the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The Type that represents the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, Type type, string category, string description, object defaultValue,
string editor, Type typeConverter)
:
this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor,
typeConverter.AssemblyQualifiedName) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// The fully qualified name of the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The Type that represents the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The Type that represents the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, string type, string category, string description, object defaultValue,
Type editor, Type typeConverter)
:
this(name, type, category, description, defaultValue, editor.AssemblyQualifiedName,
typeConverter.AssemblyQualifiedName) {}
///
/// Initializes a new instance of the PropertySpec class.
///
/// The name of the property displayed in the property grid.
/// A Type that represents the type of the property.
/// The category under which the property is displayed in the
/// property grid.
/// A string that is displayed in the help area of the
/// property grid.
/// The default value of the property, or null if there is
/// no default value.
/// The Type that represents the type of the editor for this
/// property. This type must derive from UITypeEditor.
/// The Type that represents the type of the type
/// converter for this property. This type must derive from TypeConverter.
public PropertySpec(string name, Type type, string category, string description, object defaultValue,
Type editor, Type typeConverter)
:
this(name, type.AssemblyQualifiedName, category, description, defaultValue,
editor.AssemblyQualifiedName, typeConverter.AssemblyQualifiedName) {}
///
/// Gets or sets a collection of additional Attributes for this property. This can
/// be used to specify attributes beyond those supported intrinsically by the
/// PropertySpec class, such as ReadOnly and Browsable.
///
public Attribute[] Attributes { get; set; }
///
/// Gets or sets the category name of this property.
///
public string Category { get; set; }
///
/// Gets or sets the fully qualified name of the type converter
/// type for this property.
///
public string ConverterTypeName { get; set; }
///
/// Gets or sets the default value of this property.
///
public object DefaultValue { get; set; }
///
/// Gets or sets the help text description of this property.
///
public string Description { get; set; }
///
/// Gets or sets the fully qualified name of the editor type for
/// this property.
///
public string EditorTypeName { get; set; }
///
/// Gets or sets the name of this property.
///
public string Name { get; set; }
///
/// Gets or sets the fully qualfied name of the type of this
/// property.
///
public string TypeName { get; set; }
}
}