|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Text; |
|
19 using System.Collections.Generic; |
|
20 using CrashItemLib.Crash; |
|
21 using CrashItemLib.Crash.Base; |
|
22 using CrashItemLib.Crash.Base.DataBinding; |
|
23 using CrashItemLib.Crash.Utils; |
|
24 using CrashItemLib.Crash.Container; |
|
25 |
|
26 namespace CrashItemLib.Crash.Events |
|
27 { |
|
28 [CIDBAttributeColumn( "Name", 0 )] |
|
29 [CIDBAttributeColumn( "Value", 1, true )] |
|
30 public class CIEventList : CIElement, IEnumerable<CIEvent> |
|
31 { |
|
32 #region Constructors |
|
33 [CIElementAttributeMandatory()] |
|
34 public CIEventList( CIContainer aContainer ) |
|
35 : base( aContainer ) |
|
36 { |
|
37 // Restrict children to events |
|
38 base.AddSupportedChildType( typeof( CIEvent ) ); |
|
39 base.AddSupportedChildType( typeof( CrashItemLib.Crash.Messages.CIMessage ) ); |
|
40 } |
|
41 #endregion |
|
42 |
|
43 #region From IEnumerable<CIEvent> |
|
44 public new IEnumerator<CIEvent> GetEnumerator() |
|
45 { |
|
46 foreach ( CIElement element in base.Children ) |
|
47 { |
|
48 if ( element is CIEvent ) |
|
49 { |
|
50 CIEvent reg = (CIEvent) element; |
|
51 yield return reg; |
|
52 } |
|
53 } |
|
54 } |
|
55 |
|
56 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
|
57 { |
|
58 foreach ( CIElement element in base.Children ) |
|
59 { |
|
60 if ( element is CIEvent ) |
|
61 { |
|
62 CIEvent reg = (CIEvent) element; |
|
63 yield return reg; |
|
64 } |
|
65 } |
|
66 } |
|
67 #endregion |
|
68 |
|
69 #region From CIElementBase |
|
70 public override void PrepareRows() |
|
71 { |
|
72 DataBindingModel.ClearRows(); |
|
73 |
|
74 // Our data binding model is based upon the event object, rather |
|
75 // than any key-value-pair properties. |
|
76 foreach ( CIEvent e in this ) |
|
77 { |
|
78 DataBindingModel.Add( e ); |
|
79 } |
|
80 } |
|
81 #endregion |
|
82 } |
|
83 } |