|
1 /* |
|
2 * Copyright (c) 2007 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 * Wrapper for list of traces |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracebuilder.view; |
|
20 |
|
21 import java.util.Iterator; |
|
22 |
|
23 import com.nokia.tracebuilder.model.Trace; |
|
24 import com.nokia.tracebuilder.model.TraceGroup; |
|
25 |
|
26 /** |
|
27 * Wrapper for list of traces |
|
28 * |
|
29 */ |
|
30 final class TraceListWrapper extends TraceObjectListWrapper { |
|
31 |
|
32 /** |
|
33 * Constructor. |
|
34 * |
|
35 * @param group |
|
36 * the owning trace group |
|
37 * @param parent |
|
38 * the parent wrapper |
|
39 * @param updater |
|
40 * the update notifier |
|
41 */ |
|
42 TraceListWrapper(TraceGroup group, WrapperBase parent, |
|
43 WrapperUpdater updater) { |
|
44 super(parent, updater); |
|
45 Iterator<Trace> itr = group.getTraces(); |
|
46 while (itr.hasNext()) { |
|
47 addTrace(itr.next()); |
|
48 } |
|
49 } |
|
50 |
|
51 /** |
|
52 * Adds a new trace to this list |
|
53 * |
|
54 * @param trace |
|
55 * the new trace |
|
56 * @return the wrapper to be refreshed |
|
57 */ |
|
58 WrapperBase addTrace(Trace trace) { |
|
59 add(new TraceWrapper(trace, this, getUpdater())); |
|
60 return this; |
|
61 } |
|
62 |
|
63 /** |
|
64 * Removes a trace from this list. |
|
65 * |
|
66 * @param trace |
|
67 * the trace to be removed |
|
68 * @return the wrapper to be refreshed |
|
69 */ |
|
70 WrapperBase removeTrace(Trace trace) { |
|
71 remove(trace.getExtension(TraceWrapper.class)); |
|
72 return this; |
|
73 } |
|
74 } |