Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Descriptors/DescriptorBase.cs

    r2768 r4068  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Text;
    42using System.ComponentModel;
    53
    6 namespace Netron.Diagramming.Core
    7 {
     4namespace Netron.Diagramming.Core {
     5  /// <summary>
     6  /// Abstract base class for custom descriptors based on our properties mechanism.
     7  /// <remarks>
     8  /// Usually you do not inherit from this class to describe properties of entities, use the appropriate
     9  /// specializations like the <see cref="ShapeBaseDescriptor"/> or <see cref="ConnectionBaseDescriptor"/> classes instead.
     10  /// Also, this class does not define any properties for the property grid but contains methods and basic stuff to make the construction of
     11  /// concrete descriptors easier.
     12  /// </remarks>
     13  /// </summary>
     14  abstract class DescriptorBase : CustomTypeDescriptor {
     15    #region Fields
     16    //the provider to which this descriptor is attached
     17    private TypeDescriptionProvider provider;
    818    /// <summary>
    9     /// Abstract base class for custom descriptors based on our properties mechanism.
    10     /// <remarks>
    11     /// Usually you do not inherit from this class to describe properties of entities, use the appropriate
    12     /// specializations like the <see cref="ShapeBaseDescriptor"/> or <see cref="ConnectionBaseDescriptor"/> classes instead.
    13     /// Also, this class does not define any properties for the property grid but contains methods and basic stuff to make the construction of
    14     /// concrete descriptors easier.
    15     /// </remarks>
     19    /// the type being served
    1620    /// </summary>
    17     abstract class DescriptorBase : CustomTypeDescriptor
    18     {
    19         #region Fields
    20         //the provider to which this descriptor is attached
    21         private TypeDescriptionProvider provider;
    22         /// <summary>
    23         /// the type being served
    24         /// </summary>
    25         private Type type;
    26         /// <summary>
    27         /// the collection of properties displayed
    28         /// </summary>
    29         private PropertyDescriptorCollection mProperties;
    30         #endregion
     21    private Type type;
     22    /// <summary>
     23    /// the collection of properties displayed
     24    /// </summary>
     25    private PropertyDescriptorCollection mProperties;
     26    #endregion
    3127
    32         #region Properties
    33         /// <summary>
    34         /// Gets the collection of property descrtiptors
    35         /// </summary>
    36         protected PropertyDescriptorCollection Properties
    37         {
    38             get { return mProperties; }
    39         }
    40         #endregion
     28    #region Properties
     29    /// <summary>
     30    /// Gets the collection of property descrtiptors
     31    /// </summary>
     32    protected PropertyDescriptorCollection Properties {
     33      get { return mProperties; }
     34    }
     35    #endregion
    4136
    42         #region Constructors
     37    #region Constructors
    4338
    44         /// <summary>
    45         /// Initializes a new instance of the <see cref="T:DescriptorBase"/> class.
    46         /// </summary>
    47         /// <param name="provider">The provider.</param>
    48         /// <param name="parentdescriptor">The parentdescriptor.</param>
    49         /// <param name="objectType">Type of the object.</param>
    50         public DescriptorBase(ShapeProvider provider, ICustomTypeDescriptor parentdescriptor, Type objectType)
    51             : base(parentdescriptor)
    52         {
    53             this.provider = provider;
    54             this.type = objectType;
    55             mProperties = new PropertyDescriptorCollection(null);
    56         }
     39    /// <summary>
     40    /// Initializes a new instance of the <see cref="T:DescriptorBase"/> class.
     41    /// </summary>
     42    /// <param name="provider">The provider.</param>
     43    /// <param name="parentdescriptor">The parentdescriptor.</param>
     44    /// <param name="objectType">Type of the object.</param>
     45    public DescriptorBase(ShapeProvider provider, ICustomTypeDescriptor parentdescriptor, Type objectType)
     46      : base(parentdescriptor) {
     47      this.provider = provider;
     48      this.type = objectType;
     49      mProperties = new PropertyDescriptorCollection(null);
     50    }
    5751
    58         /// <summary>
    59         /// Initializes a new instance of the <see cref="T:DescriptorBase"/> class.
    60         /// </summary>
    61         /// <param name="provider">The provider.</param>
    62         /// <param name="objectType">Type of the object.</param>
    63         public DescriptorBase(TypeDescriptionProvider provider, Type objectType)
    64             : base()
    65         {
    66             this.provider = provider;
    67             this.type = objectType;
    68             mProperties = new PropertyDescriptorCollection(null);           
    69         }
    70         #endregion
     52    /// <summary>
     53    /// Initializes a new instance of the <see cref="T:DescriptorBase"/> class.
     54    /// </summary>
     55    /// <param name="provider">The provider.</param>
     56    /// <param name="objectType">Type of the object.</param>
     57    public DescriptorBase(TypeDescriptionProvider provider, Type objectType)
     58      : base() {
     59      this.provider = provider;
     60      this.type = objectType;
     61      mProperties = new PropertyDescriptorCollection(null);
     62    }
     63    #endregion
    7164
    72         #region Methods
     65    #region Methods
    7366
    74         #region AddProperty overloads
    75         /// <summary>
    76         /// Adds a new property to the property descriptor collection.
    77         /// </summary>
    78         /// <param name="name">The name of the property displayed in the property grid.</param>
    79         /// <param name="type">The fully qualified name of the type of the property.</param>
    80         public void AddProperty(string name, Type type)
    81         {
    82             PropertySpec widthSpec = new PropertySpec(name, type);
    83             PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
    84             pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
    85             pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
    86             mProperties.Add(pd);
    87         }
    88         /// <summary>
    89         /// Adds a new property to the property descriptor collection.
    90         /// </summary>
    91         /// <param name="name">The name of the property displayed in the property grid.</param>
    92         /// <param name="type">The fully qualified name of the type of the property.</param>
    93         /// <param name="category">The category under which the property is displayed in the
    94         /// property grid.</param>
    95         public void AddProperty(string name, Type type, string category)
    96         {
    97             PropertySpec widthSpec = new PropertySpec(name, type, category);
    98             PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
    99             pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
    100             pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
    101             mProperties.Add(pd);
    102         }
    103         /// <summary>
    104         /// Adds a new property to the property descriptor collection.
    105         /// </summary>
    106         /// <param name="name">The name of the property displayed in the property grid.</param>
    107         /// <param name="type">The fully qualified name of the type of the property.</param>
    108         /// <param name="category">The category under which the property is displayed in the
    109         /// property grid.</param>
    110         /// <param name="description">A string that is displayed in the help area of the
    111         /// property grid.</param>
    112         public void AddProperty(string name, Type type, string category, string description)
    113         {
    114             PropertySpec widthSpec = new PropertySpec(name, type, category, description);
    115             PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
    116             pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
    117             pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
    118             mProperties.Add(pd);
    119         }
    120         /// <summary>
    121         /// Adds a new property to the property descriptor collection.
    122         /// </summary>
    123         /// <param name="name">The name of the property displayed in the property grid.</param>
    124         /// <param name="type">The fully qualified name of the type of the property.</param>
    125         /// <param name="category">The category under which the property is displayed in the
    126         /// property grid.</param>
    127         /// <param name="description">A string that is displayed in the help area of the
    128         /// property grid.</param>
    129         /// <param name="defaultValue">The default value of the property, or null if there is
    130         /// no default value.</param>
    131         public void AddProperty(string name, Type type, string category, string description, object defaultValue)
    132         {
    133             PropertySpec widthSpec = new PropertySpec(name, type, category, description, defaultValue);
    134             PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
    135             pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
    136             pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
    137             mProperties.Add(pd);
    138         }
    139         /// <summary>
    140         /// Adds a new property to the property descriptor collection.
    141         /// </summary>
    142         /// <param name="name">The name of the property displayed in the property grid.</param>
    143         /// <param name="type">A Type that represents the type of the property.</param>
    144         /// <param name="category">The category under which the property is displayed in the
    145         /// property grid.</param>
    146         /// <param name="description">A string that is displayed in the help area of the
    147         /// property grid.</param>
    148         /// <param name="defaultValue">The default value of the property, or null if there is
    149         /// no default value.</param>
    150         /// <param name="editor">The Type that represents the type of the editor for this
    151         /// property.  This type must derive from UITypeEditor.</param>
    152         /// <param name="typeConverter">The Type that represents the type of the type
    153         /// converter for this property.  This type must derive from TypeConverter.</param>
    154         public void AddProperty(string name, Type type, string category, string description, object defaultValue, Type editor, Type typeConverter)
    155         {
    156             PropertySpec widthSpec = new PropertySpec(name, type, category, description, defaultValue, editor, typeConverter);
    157             PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
    158             pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
    159             pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
    160             mProperties.Add(pd);
    161         }
    162         #endregion
     67    #region AddProperty overloads
     68    /// <summary>
     69    /// Adds a new property to the property descriptor collection.
     70    /// </summary>
     71    /// <param name="name">The name of the property displayed in the property grid.</param>
     72    /// <param name="type">The fully qualified name of the type of the property.</param>
     73    public void AddProperty(string name, Type type) {
     74      PropertySpec widthSpec = new PropertySpec(name, type);
     75      PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
     76      pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
     77      pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
     78      mProperties.Add(pd);
     79    }
     80    /// <summary>
     81    /// Adds a new property to the property descriptor collection.
     82    /// </summary>
     83    /// <param name="name">The name of the property displayed in the property grid.</param>
     84    /// <param name="type">The fully qualified name of the type of the property.</param>
     85    /// <param name="category">The category under which the property is displayed in the
     86    /// property grid.</param>
     87    public void AddProperty(string name, Type type, string category) {
     88      PropertySpec widthSpec = new PropertySpec(name, type, category);
     89      PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
     90      pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
     91      pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
     92      mProperties.Add(pd);
     93    }
     94    /// <summary>
     95    /// Adds a new property to the property descriptor collection.
     96    /// </summary>
     97    /// <param name="name">The name of the property displayed in the property grid.</param>
     98    /// <param name="type">The fully qualified name of the type of the property.</param>
     99    /// <param name="category">The category under which the property is displayed in the
     100    /// property grid.</param>
     101    /// <param name="description">A string that is displayed in the help area of the
     102    /// property grid.</param>
     103    public void AddProperty(string name, Type type, string category, string description) {
     104      PropertySpec widthSpec = new PropertySpec(name, type, category, description);
     105      PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
     106      pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
     107      pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
     108      mProperties.Add(pd);
     109    }
     110    /// <summary>
     111    /// Adds a new property to the property descriptor collection.
     112    /// </summary>
     113    /// <param name="name">The name of the property displayed in the property grid.</param>
     114    /// <param name="type">The fully qualified name of the type of the property.</param>
     115    /// <param name="category">The category under which the property is displayed in the
     116    /// property grid.</param>
     117    /// <param name="description">A string that is displayed in the help area of the
     118    /// property grid.</param>
     119    /// <param name="defaultValue">The default value of the property, or null if there is
     120    /// no default value.</param>
     121    public void AddProperty(string name, Type type, string category, string description, object defaultValue) {
     122      PropertySpec widthSpec = new PropertySpec(name, type, category, description, defaultValue);
     123      PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
     124      pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
     125      pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
     126      mProperties.Add(pd);
     127    }
     128    /// <summary>
     129    /// Adds a new property to the property descriptor collection.
     130    /// </summary>
     131    /// <param name="name">The name of the property displayed in the property grid.</param>
     132    /// <param name="type">A Type that represents the type of the property.</param>
     133    /// <param name="category">The category under which the property is displayed in the
     134    /// property grid.</param>
     135    /// <param name="description">A string that is displayed in the help area of the
     136    /// property grid.</param>
     137    /// <param name="defaultValue">The default value of the property, or null if there is
     138    /// no default value.</param>
     139    /// <param name="editor">The Type that represents the type of the editor for this
     140    /// property.  This type must derive from UITypeEditor.</param>
     141    /// <param name="typeConverter">The Type that represents the type of the type
     142    /// converter for this property.  This type must derive from TypeConverter.</param>
     143    public void AddProperty(string name, Type type, string category, string description, object defaultValue, Type editor, Type typeConverter) {
     144      PropertySpec widthSpec = new PropertySpec(name, type, category, description, defaultValue, editor, typeConverter);
     145      PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor();
     146      pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue);
     147      pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue);
     148      mProperties.Add(pd);
     149    }
     150    #endregion
    163151
    164152
    165        
    166153
    167         /// <summary>
    168         /// Overrides the method to retun the collection of properties we defined internally
    169         /// </summary>
    170         /// <param name="attributes"></param>
    171         /// <returns></returns>
    172         public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
    173         {
    174             return mProperties;
    175         }
    176154
    177         /// <summary>
    178         /// Returns a collection of property descriptors for the object represented by this type descriptor.
    179         /// </summary>
    180         /// <returns>
    181         /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"></see> containing the property descriptions for the object represented by this type descriptor. The default is <see cref="F:System.ComponentModel.PropertyDescriptorCollection.Empty"></see>.
    182         /// </returns>
    183         public override PropertyDescriptorCollection GetProperties()
    184         {
    185             return GetProperties(null);
    186         }
    187         /// <summary>
    188         /// Override this method to return the appropriate value corresponding to the property
    189         /// </summary>
    190         /// <param name="sender"></param>
    191         /// <param name="e"></param>
    192         protected virtual void GetValue(object sender, PropertyEventArgs e)
    193         {
     155    /// <summary>
     156    /// Overrides the method to retun the collection of properties we defined internally
     157    /// </summary>
     158    /// <param name="attributes"></param>
     159    /// <returns></returns>
     160    public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) {
     161      return mProperties;
     162    }
    194163
    195         }
     164    /// <summary>
     165    /// Returns a collection of property descriptors for the object represented by this type descriptor.
     166    /// </summary>
     167    /// <returns>
     168    /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"></see> containing the property descriptions for the object represented by this type descriptor. The default is <see cref="F:System.ComponentModel.PropertyDescriptorCollection.Empty"></see>.
     169    /// </returns>
     170    public override PropertyDescriptorCollection GetProperties() {
     171      return GetProperties(null);
     172    }
     173    /// <summary>
     174    /// Override this method to return the appropriate value corresponding to the property
     175    /// </summary>
     176    /// <param name="sender"></param>
     177    /// <param name="e"></param>
     178    protected virtual void GetValue(object sender, PropertyEventArgs e) {
    196179
    197         /// <summary>
    198         /// Override this method to set the appropriate value corresponding to the property
    199         /// </summary>
    200         /// <param name="sender"></param>
    201         /// <param name="e"></param>
    202         protected virtual void SetValue(object sender, PropertyEventArgs e)
    203         {
    204         }
    205         #endregion
    206180    }
     181
     182    /// <summary>
     183    /// Override this method to set the appropriate value corresponding to the property
     184    /// </summary>
     185    /// <param name="sender"></param>
     186    /// <param name="e"></param>
     187    protected virtual void SetValue(object sender, PropertyEventArgs e) {
     188    }
     189    #endregion
     190  }
    207191}
Note: See TracChangeset for help on using the changeset viewer.