PageRenderTime 26ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/IZWebFileManager/NewDocumentTemplateCollection.cs

http://izwebfilemanager.googlecode.com/
C# | 77 lines | 48 code | 14 blank | 15 comment | 2 complexity | d8c1856a546cfc91abcbd78178a49d6c MD5 | raw file
 1// Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
 2//
 3// This program is free software; you can redistribute it and/or modify
 4// it under the terms of the GNU General Public License as published by
 5// the Free Software Foundation; either version 2 of the License, or
 6// (at your option) any later version.
 7//
 8// This program is distributed in the hope that it will be useful,
 9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17using System;
18using System.Collections.Generic;
19using System.Text;
20using System.Web.UI;
21using System.Collections;
22
23namespace IZ.WebFileManager
24{
25	public sealed class NewDocumentTemplateCollection : StateManagedCollection
26	{
27		private static readonly Type [] _knownTypes = new Type [] { typeof (NewDocumentTemplate) };
28
29		public NewDocumentTemplate this [int i] {
30			get { return (NewDocumentTemplate) ((IList) this) [i]; }
31			set { ((IList) this) [i] = value; }
32		}
33
34		public int Add (NewDocumentTemplate template) {
35			return ((IList) this).Add (template);
36		}
37
38		public bool Contains (NewDocumentTemplate template) {
39			return ((IList) this).Contains (template);
40		}
41
42		public void CopyTo (NewDocumentTemplate [] templateArray, int index) {
43			base.CopyTo (templateArray, index);
44		}
45
46		public int IndexOf (NewDocumentTemplate template) {
47			return ((IList) this).IndexOf (template);
48		}
49
50		public void Insert (int index, NewDocumentTemplate template) {
51			((IList) this).Insert (index, template);
52		}
53
54		public void Remove (NewDocumentTemplate template) {
55			((IList) this).Remove (template);
56		}
57
58		public void RemoveAt (int index) {
59			((IList) this).RemoveAt (index);
60		}
61
62		protected override object CreateKnownType (int index) {
63			if (index != 0)
64				throw new ArgumentOutOfRangeException ("Unknown Type");
65
66			return new NewDocumentTemplate ();
67		}
68
69		protected override Type [] GetKnownTypes () {
70			return _knownTypes;
71		}
72
73		protected override void SetDirtyObject (object o) {
74			((NewDocumentTemplate) o).SetDirty ();
75		}
76	}
77}