/*
* 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.Collections;
using System.ComponentModel;
using System.Reflection;
using DataHolder.Containers.Property;
namespace DataHolder.Containers{
/// <summary>
/// Used to view Generic Data Collections
/// </summary>
public class GenericDataCollectionView : BaseGenericDataCollectionView
{
#region constructors
public GenericDataCollectionView(GenericDataCollection gecoll):base(gecoll)
{
}
public GenericDataCollectionView(GenericDataCollection gecoll, bool allow_new, bool allow_remove, bool allow_edit):this(gecoll)
{
l_AllowNew = allow_new;
lAllowRemove = allow_remove;
lAllowEdit = allow_edit;
}
#endregion
/// <summary>
/// Collection that is viewed trough this view
/// </summary>
public GenericDataCollection SourceCollection
{
get
{
return innerCollection;
}
}
public GenericData this[int index]
{
get
{
return innerCollection.GetObjectAt(Positions[index]);
}
set
{
innerCollection.SetObjectAt(Positions[index], value);
}
}
public void Insert(int index, GenericData value)
{
innerCollection.Insert(Positions[index], value);
}
public void Remove(GenericData value)
{
innerCollection.Remove(value);
}
public bool Contains(GenericData value)
{
return innerCollection.Contains(value);
}
public int IndexOf(GenericData value)
{
for(int i = 0; i < Positions.Length; i++)
if(value == innerCollection.GetObjectAt(Positions[i]))
return i;
return -1;
}
public void Add(GenericData value)
{
innerCollection.Add(value);
}
public void CopyTo(GenericData [] array, int index)
{
innerCollection.CopyTo(array, index);
}
}
}
|