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
;
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
38 public String
getName();
40 * Sets the name of the component to the given value.
41 * @param name - name to set
43 public void setName(String name
);
46 * @return the image representing the component.
48 public Image
getImage();
50 * Sets the image path of the component.
51 * @param path - path to the image location
53 public void setImage(String path
);
55 * Sets the image the component.
56 * @param image - image to the image location
58 public void setImage(Image image
);
61 * @return tool tip with information about the component.
63 public String
getToolTip();
65 * Sets the tool tip with information about the component.
66 * @param toolTip - the tool tip to set.
68 public void setToolTip(String toolTip
);
71 * @return the node's connection state
73 public TargetNodeState
getTargetNodeState();
75 * Sets the node's connection state.
76 * @param state - the state to set
78 public void setTargetNodeState(TargetNodeState state
);
81 * @return returns the parent component.
83 public ITraceControlComponent
getParent();
85 * Sets the parent component.
86 * @param parent - the parent to set.
88 public void setParent(ITraceControlComponent parent
);
91 * @return the children components
93 public ITraceControlComponent
[] getChildren();
95 * Sets the children components.
96 * @param children - the children to set.
98 public 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 public 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 public List
<ITraceControlComponent
> getChildren(Class
<?
extends ITraceControlComponent
> clazz
);
113 * @return the LTTng control service implementation.
115 public ILttngControlService
getControlService();
118 * Sets the LTTng control service implementation.
119 * @param service - the service to set.
121 public void setControlService(ILttngControlService service
);
123 // ------------------------------------------------------------------------
125 // ------------------------------------------------------------------------
127 * Dispose any resource.
129 public void dispose();
132 * Adds a child component.
133 * @param component - child to add.
135 public void addChild(ITraceControlComponent component
);
138 * Adds several components.
139 * @param components - array of components to add.
141 // public void addChildren(ITraceControlComponent[] components);
144 * Removes the given child component.
145 * @param component - the child to remove.
147 public void removeChild(ITraceControlComponent component
);
150 * Removes all children.
152 public void removeAllChildren();
155 * Checks if child with given name exists.
156 * @param name - child name to search for.
157 * @return - true if exists else false.
159 public boolean containsChild(String name
);
162 * Checks for children.
163 * @return true if one or more children exist else false
165 public boolean hasChildren();
168 * Adds a component listener for notification of component changes.
169 * @param listener - listener interface implementation to add.
171 public void addComponentListener(ITraceControlComponentChangedListener listener
);
174 * Removes a component listener for notification of component changes.
175 * @param listener - listener interface implementation to remove.
177 public void removeComponentListener(ITraceControlComponentChangedListener listener
);
180 * Notifies listeners about the addition of a child.
181 * @param parent - the parent where the child was added.
182 * @param component - the child that was added.
184 public void fireComponentAdded(ITraceControlComponent parent
, ITraceControlComponent component
);
187 * Notifies listeners about the removal of a child.
188 * @param parent - the parent where the child was removed.
189 * @param component - the child that was removed.
191 public void fireComponentRemoved(ITraceControlComponent parent
, ITraceControlComponent component
);
194 * Notifies listeners about the change of a component.
195 * @param component - the component that was changed.
197 public void fireComponentChanged(ITraceControlComponent component
);