1 /**********************************************************************
2 * Copyright (c) 2012 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
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
;
14 import java
.util
.List
;
16 import org
.eclipse
.core
.runtime
.IAdaptable
;
17 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TargetNodeState
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.service
.ILttngControlService
;
19 import org
.eclipse
.swt
.graphics
.Image
;
22 * <b><u>ITraceControlComponent</u></b>
24 * Interface for trace control components that can be displayed in the
25 * trace control tree viewer.
28 public interface ITraceControlComponent
extends IAdaptable
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
35 * @return the name of the component
37 public String
getName();
39 * Sets the name of the component to the given value.
40 * @param name - name to set
42 public void setName(String name
);
45 * @return the image representing the component.
47 public Image
getImage();
49 * Sets the image path of the component.
50 * @param path - path to the image location
52 public void setImage(String path
);
54 * Sets the image the component.
55 * @param image - image to the image location
57 public void setImage(Image image
);
60 * @return tool tip with information about the component.
62 public String
getToolTip();
64 * Sets the tool tip with information about the component.
65 * @param toolTip - the tool tip to set.
67 public void setToolTip(String toolTip
);
70 * @return the node's connection state
72 public TargetNodeState
getTargetNodeState();
74 * Sets the node's connection state.
75 * @param state - the state to set
77 public void setTargetNodeState(TargetNodeState state
);
80 * @return returns the parent component.
82 public ITraceControlComponent
getParent();
84 * Sets the parent component.
85 * @param parent - the parent to set.
87 public void setParent(ITraceControlComponent parent
);
90 * @return the children components
92 public ITraceControlComponent
[] getChildren();
94 * Sets the children components.
95 * @param children - the children to set.
97 public void setChildren(List
<ITraceControlComponent
> children
);
99 * Returns the child component with given name.
100 * @param name - name of child to find.
101 * @return child component or null.
103 public ITraceControlComponent
getChild(String name
);
105 * Gets children for given class type.
106 * @param clazz - a class type to get
107 * @return list of trace control components matching given class type.
109 public List
<ITraceControlComponent
> getChildren(Class
<?
extends ITraceControlComponent
> clazz
);
112 * @return the LTTng control service implementation.
114 public ILttngControlService
getControlService();
117 * Sets the LTTng control service implementation.
118 * @param service - the service to set.
120 public void setControlService(ILttngControlService service
);
122 // ------------------------------------------------------------------------
124 // ------------------------------------------------------------------------
126 * Dispose any resource.
128 public void dispose();
131 * Adds a child component.
132 * @param component - child to add.
134 public void addChild(ITraceControlComponent component
);
137 * Adds several components.
138 * @param components - array of components to add.
140 // public void addChildren(ITraceControlComponent[] components);
143 * Removes the given child component.
144 * @param component - the child to remove.
146 public void removeChild(ITraceControlComponent component
);
149 * Removes all children.
151 public void removeAllChildren();
154 * Checks if child with given name exists.
155 * @param name - child name to search for.
156 * @return - true if exists else false.
158 public boolean containsChild(String name
);
161 * Checks for children.
162 * @return true if one or more children exist else false
164 public boolean hasChildren();
167 * Adds a component listener for notification of component changes.
168 * @param listener - listener interface implementation to add.
170 public void addComponentListener(ITraceControlComponentChangedListener listener
);
173 * Removes a component listener for notification of component changes.
174 * @param listener - listener interface implementation to remove.
176 public void removeComponentListener(ITraceControlComponentChangedListener listener
);
179 * Notifies listeners about the addition of a child.
180 * @param parent - the parent where the child was added.
181 * @param component - the child that was added.
183 public void fireComponentAdded(ITraceControlComponent parent
, ITraceControlComponent component
);
186 * Notifies listeners about the removal of a child.
187 * @param parent - the parent where the child was removed.
188 * @param component - the child that was removed.
190 public void fireComponentRemoved(ITraceControlComponent parent
, ITraceControlComponent component
);
193 * Notifies listeners about the change of a component.
194 * @param component - the component that was changed.
196 public void fireComponentChanged(ITraceControlComponent component
);