Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
cfdb727a | 3 | * |
eb1bab5b BH |
4 | * All rights reserved. This program and the accompanying materials are |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
cfdb727a AM |
8 | * |
9 | * Contributors: | |
eb1bab5b BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
9bc60be7 | 12 | package org.eclipse.tracecompass.lttng2.control.ui.tests.model.component; |
eb1bab5b | 13 | |
9bc60be7 AM |
14 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent; |
15 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponentChangedListener; | |
eb1bab5b BH |
16 | |
17 | /** | |
18 | * The class can be used to validate the listener interface. | |
eb1bab5b | 19 | */ |
cfdb727a | 20 | @SuppressWarnings("javadoc") |
eb1bab5b BH |
21 | public class ListenerValidator implements ITraceControlComponentChangedListener { |
22 | ||
23 | // ------------------------------------------------------------------------ | |
24 | // Attributes | |
25 | // ------------------------------------------------------------------------ | |
26 | private boolean fisAddedCalled = false; | |
27 | private boolean fisRemoveCalled = false; | |
28 | private boolean fisChangedCalled = false; | |
cfdb727a | 29 | |
eb1bab5b BH |
30 | private ITraceControlComponent fParent = null; |
31 | private ITraceControlComponent fChild = null; | |
32 | private ITraceControlComponent fChangedComponent = null; | |
cfdb727a | 33 | |
eb1bab5b BH |
34 | // ------------------------------------------------------------------------ |
35 | // Accessors | |
36 | // ------------------------------------------------------------------------ | |
37 | public boolean isAddedCalled() { | |
38 | return fisAddedCalled; | |
39 | } | |
40 | ||
41 | public boolean isRemovedCalled() { | |
42 | return fisRemoveCalled; | |
43 | } | |
44 | ||
45 | public boolean isChangedCalled() { | |
46 | return fisChangedCalled; | |
47 | } | |
48 | ||
49 | public ITraceControlComponent getSavedParent() { | |
50 | return fParent; | |
51 | } | |
cfdb727a | 52 | |
eb1bab5b BH |
53 | public ITraceControlComponent getSavedChild() { |
54 | return fChild; | |
55 | } | |
cfdb727a | 56 | |
eb1bab5b BH |
57 | public ITraceControlComponent getSavedComponent() { |
58 | return fChangedComponent; | |
59 | } | |
60 | ||
61 | // ------------------------------------------------------------------------ | |
62 | // Operations | |
63 | // ------------------------------------------------------------------------ | |
64 | public void initialize() { | |
65 | fisAddedCalled = false; | |
66 | fisRemoveCalled = false; | |
67 | fisChangedCalled = false; | |
68 | fParent = null; | |
69 | fChild = null; | |
70 | fChangedComponent = null; | |
71 | } | |
72 | ||
73 | @Override | |
74 | public void componentAdded(ITraceControlComponent parent, ITraceControlComponent component) { | |
75 | fisAddedCalled = true; | |
76 | fParent = parent; | |
77 | fChild = component; | |
78 | } | |
79 | ||
80 | @Override | |
81 | public void componentRemoved(ITraceControlComponent parent, ITraceControlComponent component) { | |
82 | fisRemoveCalled = true; | |
83 | fParent = parent; | |
84 | fChild = component; | |
85 | } | |
86 | ||
87 | @Override | |
88 | public void componentChanged(ITraceControlComponent component) { | |
89 | fisChangedCalled = true; | |
90 | fParent = null; | |
91 | fChangedComponent = component; | |
92 | } | |
93 | ||
94 | } |