Commit | Line | Data |
---|---|---|
eb1bab5b | 1 | /********************************************************************** |
a6e6f7b4 BH |
2 | * Copyright (c) 2012, 2013 Ericsson |
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 | |
a6e6f7b4 BH |
8 | * |
9 | * Contributors: | |
eb1bab5b BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
115b4a01 | 12 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model; |
eb1bab5b BH |
13 | |
14 | import java.util.List; | |
15 | ||
16 | import org.eclipse.core.runtime.IAdaptable; | |
9315aeee | 17 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState; |
115b4a01 | 18 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService; |
eb1bab5b BH |
19 | import org.eclipse.swt.graphics.Image; |
20 | ||
21 | /** | |
eb1bab5b | 22 | * <p> |
a6e6f7b4 BH |
23 | * Interface for trace control components that can be displayed in the |
24 | * trace control tree viewer. | |
eb1bab5b | 25 | * </p> |
a6e6f7b4 | 26 | * |
dbd4432d | 27 | * @author Bernd Hufmann |
eb1bab5b BH |
28 | */ |
29 | public interface ITraceControlComponent extends IAdaptable { | |
6503ae0f | 30 | |
eb1bab5b BH |
31 | // ------------------------------------------------------------------------ |
32 | // Accessors | |
33 | // ------------------------------------------------------------------------ | |
34 | ||
35 | /** | |
36 | * @return the name of the component | |
37 | */ | |
a6e6f7b4 | 38 | String getName(); |
eb1bab5b BH |
39 | /** |
40 | * Sets the name of the component to the given value. | |
41 | * @param name - name to set | |
42 | */ | |
a6e6f7b4 | 43 | void setName(String name); |
eb1bab5b BH |
44 | |
45 | /** | |
46 | * @return the image representing the component. | |
47 | */ | |
a6e6f7b4 | 48 | Image getImage(); |
eb1bab5b BH |
49 | /** |
50 | * Sets the image path of the component. | |
51 | * @param path - path to the image location | |
52 | */ | |
a6e6f7b4 | 53 | void setImage(String path); |
eb1bab5b BH |
54 | /** |
55 | * Sets the image the component. | |
56 | * @param image - image to the image location | |
57 | */ | |
a6e6f7b4 | 58 | void setImage(Image image); |
6503ae0f | 59 | |
eb1bab5b BH |
60 | /** |
61 | * @return tool tip with information about the component. | |
62 | */ | |
a6e6f7b4 | 63 | String getToolTip(); |
eb1bab5b BH |
64 | /** |
65 | * Sets the tool tip with information about the component. | |
66 | * @param toolTip - the tool tip to set. | |
67 | */ | |
a6e6f7b4 BH |
68 | void setToolTip(String toolTip); |
69 | ||
eb1bab5b BH |
70 | /** |
71 | * @return the node's connection state | |
72 | */ | |
a6e6f7b4 | 73 | TargetNodeState getTargetNodeState(); |
eb1bab5b | 74 | /** |
a6e6f7b4 | 75 | * Sets the node's connection state. |
eb1bab5b BH |
76 | * @param state - the state to set |
77 | */ | |
a6e6f7b4 BH |
78 | void setTargetNodeState(TargetNodeState state); |
79 | ||
eb1bab5b BH |
80 | /** |
81 | * @return returns the parent component. | |
82 | */ | |
a6e6f7b4 | 83 | ITraceControlComponent getParent(); |
eb1bab5b BH |
84 | /** |
85 | * Sets the parent component. | |
86 | * @param parent - the parent to set. | |
87 | */ | |
a6e6f7b4 | 88 | void setParent(ITraceControlComponent parent); |
eb1bab5b BH |
89 | |
90 | /** | |
91 | * @return the children components | |
92 | */ | |
a6e6f7b4 | 93 | ITraceControlComponent[] getChildren(); |
eb1bab5b BH |
94 | /** |
95 | * Sets the children components. | |
96 | * @param children - the children to set. | |
97 | */ | |
a6e6f7b4 | 98 | void setChildren(List<ITraceControlComponent> children); |
eb1bab5b BH |
99 | /** |
100 | * Returns the child component with given name. | |
101 | * @param name - name of child to find. | |
102 | * @return child component or null. | |
103 | */ | |
a6e6f7b4 | 104 | ITraceControlComponent getChild(String name); |
6503ae0f BH |
105 | /** |
106 | * Gets children for given class type. | |
107 | * @param clazz - a class type to get | |
a6e6f7b4 | 108 | * @return list of trace control components matching given class type. |
6503ae0f | 109 | */ |
a6e6f7b4 | 110 | List<ITraceControlComponent> getChildren(Class<? extends ITraceControlComponent> clazz); |
eb1bab5b BH |
111 | |
112 | /** | |
113 | * @return the LTTng control service implementation. | |
114 | */ | |
a6e6f7b4 | 115 | ILttngControlService getControlService(); |
6503ae0f | 116 | |
eb1bab5b BH |
117 | /** |
118 | * Sets the LTTng control service implementation. | |
119 | * @param service - the service to set. | |
120 | */ | |
a6e6f7b4 | 121 | void setControlService(ILttngControlService service); |
6503ae0f | 122 | |
eb1bab5b BH |
123 | // ------------------------------------------------------------------------ |
124 | // Operations | |
125 | // ------------------------------------------------------------------------ | |
126 | /** | |
127 | * Dispose any resource. | |
128 | */ | |
a6e6f7b4 BH |
129 | void dispose(); |
130 | ||
eb1bab5b BH |
131 | /** |
132 | * Adds a child component. | |
133 | * @param component - child to add. | |
134 | */ | |
a6e6f7b4 BH |
135 | void addChild(ITraceControlComponent component); |
136 | ||
eb1bab5b | 137 | /** |
a6e6f7b4 | 138 | * Removes the given child component. |
eb1bab5b BH |
139 | * @param component - the child to remove. |
140 | */ | |
a6e6f7b4 BH |
141 | void removeChild(ITraceControlComponent component); |
142 | ||
eb1bab5b BH |
143 | /** |
144 | * Removes all children. | |
145 | */ | |
a6e6f7b4 BH |
146 | void removeAllChildren(); |
147 | ||
eb1bab5b BH |
148 | /** |
149 | * Checks if child with given name exists. | |
150 | * @param name - child name to search for. | |
151 | * @return - true if exists else false. | |
152 | */ | |
a6e6f7b4 BH |
153 | boolean containsChild(String name); |
154 | ||
eb1bab5b | 155 | /** |
a6e6f7b4 | 156 | * Checks for children. |
eb1bab5b BH |
157 | * @return true if one or more children exist else false |
158 | */ | |
a6e6f7b4 | 159 | boolean hasChildren(); |
eb1bab5b BH |
160 | |
161 | /** | |
162 | * Adds a component listener for notification of component changes. | |
163 | * @param listener - listener interface implementation to add. | |
164 | */ | |
a6e6f7b4 BH |
165 | void addComponentListener(ITraceControlComponentChangedListener listener); |
166 | ||
eb1bab5b BH |
167 | /** |
168 | * Removes a component listener for notification of component changes. | |
169 | * @param listener - listener interface implementation to remove. | |
170 | */ | |
a6e6f7b4 BH |
171 | void removeComponentListener(ITraceControlComponentChangedListener listener); |
172 | ||
eb1bab5b BH |
173 | /** |
174 | * Notifies listeners about the addition of a child. | |
175 | * @param parent - the parent where the child was added. | |
176 | * @param component - the child that was added. | |
177 | */ | |
a6e6f7b4 BH |
178 | void fireComponentAdded(ITraceControlComponent parent, ITraceControlComponent component); |
179 | ||
eb1bab5b BH |
180 | /** |
181 | * Notifies listeners about the removal of a child. | |
182 | * @param parent - the parent where the child was removed. | |
183 | * @param component - the child that was removed. | |
184 | */ | |
a6e6f7b4 BH |
185 | void fireComponentRemoved(ITraceControlComponent parent, ITraceControlComponent component); |
186 | ||
eb1bab5b BH |
187 | /** |
188 | * Notifies listeners about the change of a component. | |
189 | * @param component - the component that was changed. | |
190 | */ | |
a6e6f7b4 | 191 | void fireComponentChanged(ITraceControlComponent component); |
eb1bab5b | 192 | } |