|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Collections;
namespace Mullivan.Web.UI.WebControls
{
public class JQueryTabCollection : IList, ICollection, IEnumerable
{
private JQueryTabView _owner = null;
internal JQueryTabCollection(JQueryTabView owner)
{
this._owner = owner;
}
public void Add(JQueryTab tab)
{
if (tab == null)
{
throw new ArgumentNullException("wizardStep");
}
this.RemoveIfAlreadyExistsInTabs(tab);
tab.PreventAutoID();
tab.SetOwner(this._owner);
this.Tabs.Add(tab);
this.NotifyTabsChanged();
}
public void AddAt(int index, JQueryTab tab)
{
if (tab == null)
{
throw new ArgumentNullException("tab");
}
this.RemoveIfAlreadyExistsInTabs(tab);
tab.PreventAutoID();
tab.SetOwner(this._owner);
this.Tabs.AddAt(index, tab);
this.NotifyTabsChanged();
}
public void Clear()
{
this.Tabs.Clear();
this.NotifyTabsChanged();
}
public bool Contains(JQueryTab tab)
{
if (tab == null)
{
throw new ArgumentNullException("tab");
}
return this.Tabs.Contains(tab);
}
public void CopyTo(JQueryTab[] array, int index)
{
this.Tabs.CopyTo(array, index);
}
public IEnumerator GetEnumerator()
{
return this.Tabs.GetEnumerator();
}
private JQueryTab GetTabAndVerify(object value)
{
JQueryTab base2 = value as JQueryTab;
if (base2 == null)
{
throw new ArgumentException("Invalid type. Must be JQueryTab.");
}
return base2;
}
public int IndexOf(JQueryTab tab)
{
if (tab == null)
{
throw new ArgumentNullException("tab");
}
return this.Tabs.IndexOf(tab);
}
public void Insert(int index, JQueryTab tab)
{
this.AddAt(index, tab);
}
internal void NotifyTabsChanged()
{
}
public void Remove(JQueryTab tab)
{
if (tab == null)
{
throw new ArgumentNullException("tab");
}
this.Tabs.Remove(tab);
tab.SetOwner(null);
this.NotifyTabsChanged();
}
public void RemoveAt(int index)
{
JQueryTab base2 = this.Tabs[index] as JQueryTab;
if (base2 != null)
{
base2.SetOwner(null);
}
this.Tabs.RemoveAt(index);
this.NotifyTabsChanged();
}
private void RemoveIfAlreadyExistsInTabs(JQueryTab tab)
{
if (tab.Owner != null)
{
tab.Owner.Tabs.Remove(tab);
}
}
void ICollection.CopyTo(Array array, int index)
{
this.Tabs.CopyTo(array, index);
}
int IList.Add(object value)
{
JQueryTab stepAndVerify = this.GetTabAndVerify(value);
this.Add(stepAndVerify);
return this.IndexOf(stepAndVerify);
}
bool IList.Contains(object value)
{
return this.Contains(this.GetTabAndVerify(value));
}
int IList.IndexOf(object value)
{
return this.IndexOf(this.GetTabAndVerify(value));
}
void IList.Insert(int index, object value)
{
this.AddAt(index, this.GetTabAndVerify(value));
}
void IList.Remove(object value)
{
this.Remove(this.GetTabAndVerify(value));
}
// Properties
public int Count
{
get
{
return this.Tabs.Count;
}
}
public bool IsReadOnly
{
get
{
return this.Tabs.IsReadOnly;
}
}
public bool IsSynchronized
{
get
{
return false;
}
}
public JQueryTab this[int index]
{
get
{
return (JQueryTab)this.Tabs[index];
}
}
public object SyncRoot
{
get
{
return this;
}
}
bool IsFixedSize
{
get
{
return false;
}
}
bool IList.IsFixedSize
{
get
{
return false;
}
}
object IList.this[int index]
{
get
{
return this.Tabs[index];
}
set
{
this.RemoveAt(index);
this.AddAt(index, this.GetTabAndVerify(value));
}
}
private JQueryTabControlCollection Tabs
{
get
{
return this._owner.TabControls;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.