1 /**********************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
;
14 import java
.util
.List
;
16 import org
.eclipse
.core
.runtime
.IAdaptable
;
17 import org
.eclipse
.swt
.graphics
.Image
;
18 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.TargetNodeState
;
19 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.service
.ILttngControlService
;
23 * Interface for trace control components that can be displayed in the
24 * trace control tree viewer.
27 * @author Bernd Hufmann
29 public interface ITraceControlComponent
extends IAdaptable
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
36 * @return the name of the component
40 * Sets the name of the component to the given value.
41 * @param name - name to set
43 void setName(String name
);
46 * @return the image representing the component.
50 * Sets the image path of the component.
51 * @param path - path to the image location
53 void setImage(String path
);
55 * Sets the image the component.
56 * @param image - image to the image location
58 void setImage(Image image
);
61 * @return tool tip with information about the component.
65 * Sets the tool tip with information about the component.
66 * @param toolTip - the tool tip to set.
68 void setToolTip(String toolTip
);
71 * @return the node's connection state
73 TargetNodeState
getTargetNodeState();
75 * Sets the node's connection state.
76 * @param state - the state to set
78 void setTargetNodeState(TargetNodeState state
);
81 * @return returns the parent component.
83 ITraceControlComponent
getParent();
85 * Sets the parent component.
86 * @param parent - the parent to set.
88 void setParent(ITraceControlComponent parent
);
91 * @return the children components
93 ITraceControlComponent
[] getChildren();
95 * Sets the children components.
96 * @param children - the children to set.
98 void setChildren(List
<ITraceControlComponent
> children
);
100 * Returns the child component with given name.
101 * @param name - name of child to find.
102 * @return child component or null.
104 ITraceControlComponent
getChild(String name
);
106 * Gets children for given class type.
107 * @param clazz - a class type to get
108 * @return list of trace control components matching given class type.
110 List
<ITraceControlComponent
> getChildren(Class
<?
extends ITraceControlComponent
> clazz
);
113 * @return the LTTng control service implementation.
115 ILttngControlService
getControlService();
118 * Sets the LTTng control service implementation.
119 * @param service - the service to set.
121 void setControlService(ILttngControlService service
);
123 // ------------------------------------------------------------------------
125 // ------------------------------------------------------------------------
127 * Dispose any resource.
132 * Adds a child component.
133 * @param component - child to add.
135 void addChild(ITraceControlComponent component
);
138 * Removes the given child component.
139 * @param component - the child to remove.
141 void removeChild(ITraceControlComponent component
);
144 * Removes all children.
146 void removeAllChildren();
149 * Checks if child with given name exists.
150 * @param name - child name to search for.
151 * @return - true if exists else false.
153 boolean containsChild(String name
);
156 * Checks for children.
157 * @return true if one or more children exist else false
159 boolean hasChildren();
162 * Adds a component listener for notification of component changes.
163 * @param listener - listener interface implementation to add.
165 void addComponentListener(ITraceControlComponentChangedListener listener
);
168 * Removes a component listener for notification of component changes.
169 * @param listener - listener interface implementation to remove.
171 void removeComponentListener(ITraceControlComponentChangedListener listener
);
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.
178 void fireComponentAdded(ITraceControlComponent parent
, ITraceControlComponent component
);
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.
185 void fireComponentRemoved(ITraceControlComponent parent
, ITraceControlComponent component
);
188 * Notifies listeners about the change of a component.
189 * @param component - the component that was changed.
191 void fireComponentChanged(ITraceControlComponent component
);