/*
* Namespace Summary
* Copyright (C) 2005+ Bogdan Damian Constantin
* E-Mail: damianbcpetro@gmail.com
* WEB: http://www.sourceforge.net/projects/dataholder
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License 2.1 or later, as
* published by the Free Software Foundation. See the included License.txt
* or http://www.gnu.org/copyleft/lesser.html for details.
*
*/
using System;
using System.ComponentModel;
using System.Collections;
using System.Reflection;
namespace DataHolder.Containers.Property{
/// <summary>
/// Summary description for GenericDataPropertyDescriptor.
/// </summary>
public class GenericDataPropertyDescriptor : PropertyDescriptor
{
private PropertyCollection l_propertyCollection;
private int l_propertyIndex;
internal GenericDataPropertyDescriptor(PropertyCollection l_propertyCollection, string name, Attribute[] attrs) :base(name, attrs)
{
this.l_propertyCollection = l_propertyCollection;
this.l_propertyIndex = l_propertyCollection.IndexOf(name);
}
public override void AddValueChanged(object component, EventHandler handler)
{
// TODO: Add GenericDataPropertyDescriptor.AddValueChanged implementation
base.AddValueChanged (component, handler);
}
public override bool CanResetValue(object component)
{
// TODO: Add GenericDataPropertyDescriptor.CanResetValue implementation
return false;
}
public override bool Equals(object obj)
{
// TODO: Add GenericDataPropertyDescriptor.Equals implementation
return base.Equals (obj);
}
public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter)
{
// TODO: Add GenericDataPropertyDescriptor.GetChildProperties implementation
return base.GetChildProperties (instance, filter);
}
public override object GetEditor(Type editorBaseType)
{
// TODO: Add GenericDataPropertyDescriptor.GetEditor implementation
return base.GetEditor (editorBaseType);
}
public override int GetHashCode()
{
// TODO: Add GenericDataPropertyDescriptor.GetHashCode implementation
return base.GetHashCode ();
}
public override object GetValue(object component)
{
return ((GenericData)component)[l_propertyIndex];
}
public override void ResetValue(object component)
{
throw new NotSupportedException();
}
public override void SetValue(object component, object value)
{
((GenericData)component)[l_propertyIndex] = value;
}
protected override void OnValueChanged(object component, EventArgs e)
{
// TODO: Add GenericDataPropertyDescriptor.OnValueChanged implementation
base.OnValueChanged (component, e);
}
public override void RemoveValueChanged(object component, EventHandler handler)
{
// TODO: Add GenericDataPropertyDescriptor.RemoveValueChanged implementation
base.RemoveValueChanged (component, handler);
}
public override bool ShouldSerializeValue(object component)
{
return true;
}
public override Type ComponentType
{
get
{
return l_propertyCollection[l_propertyIndex].PropertyType;
}
}
public int PropertyIndex
{
get{return l_propertyIndex;}
}
public PropertyCollection PropertyCollection
{
get{return l_propertyCollection;}
}
//
// public override TypeConverter Converter
// {
// get
// {
// // TODO: Add GenericDataPropertyDescriptor.Converter getter implementation
// return base.Converter;
// }
// }
public override bool IsLocalizable
{
get
{
return false;
}
}
public override bool IsReadOnly
{
get
{
return false;
}
}
public override Type PropertyType
{
get
{
return l_propertyCollection[l_propertyIndex].PropertyType;
}
}
}
}
|