Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.ui.views.control.model.impl; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo; | |
15 | import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent; | |
16 | import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType; | |
17 | import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel; | |
18 | ||
19 | /** | |
20 | * <b><u>BaseEventComponent</u></b> | |
21 | * <p> | |
22 | * Implementation of the base trace event component. | |
23 | * </p> | |
24 | */ | |
25 | public class BaseEventComponent extends TraceControlComponent { | |
26 | // ------------------------------------------------------------------------ | |
27 | // Constants | |
28 | // ------------------------------------------------------------------------ | |
29 | /** | |
30 | * Path to icon file for this component. | |
31 | */ | |
32 | public static final String TRACE_EVENT_ICON_FILE_ENABLED = "icons/obj16/event_enabled.gif"; //$NON-NLS-1$ | |
33 | ||
34 | // ------------------------------------------------------------------------ | |
35 | // Attributes | |
36 | // ------------------------------------------------------------------------ | |
37 | /** | |
38 | * The Event information implementation. | |
39 | */ | |
40 | private IBaseEventInfo fEventInfo; | |
41 | ||
42 | // ------------------------------------------------------------------------ | |
43 | // Constructors | |
44 | // ------------------------------------------------------------------------ | |
45 | ||
46 | /** | |
47 | * Constructor | |
48 | * @param name - the name of the component. | |
49 | * @param parent - the parent of this component. | |
50 | */ | |
51 | public BaseEventComponent(String name, ITraceControlComponent parent) { | |
52 | super(name, parent); | |
53 | setImage(TRACE_EVENT_ICON_FILE_ENABLED); | |
54 | fEventInfo = new EventInfo(name); | |
55 | } | |
56 | ||
57 | // ------------------------------------------------------------------------ | |
58 | // Accessors | |
59 | // ------------------------------------------------------------------------ | |
60 | /** | |
61 | * Sets the event information. | |
62 | * @param eventInfo - the event info to set. | |
63 | */ | |
64 | public void setEventInfo(IBaseEventInfo eventInfo) { | |
65 | fEventInfo = eventInfo; | |
66 | } | |
67 | ||
68 | /** | |
69 | * @return the event type. | |
70 | */ | |
71 | public TraceEventType getEventType() { | |
72 | return fEventInfo.getEventType(); | |
73 | } | |
74 | ||
75 | /** | |
76 | * Sets the event type to the given value. | |
77 | * @param type - type to set. | |
78 | */ | |
79 | public void setEventType(TraceEventType type) { | |
80 | fEventInfo.setEventType(type); | |
81 | } | |
82 | ||
83 | /** | |
84 | * Sets the event type to the value specified by the give name. | |
85 | * @param typeName - the type name. | |
86 | */ | |
87 | public void setEventType(String typeName) { | |
88 | fEventInfo.setEventType(typeName); | |
89 | } | |
90 | ||
91 | /** | |
92 | * @return the trace event log level | |
93 | */ | |
94 | public TraceLogLevel getLogLevel() { | |
95 | return fEventInfo.getLogLevel(); | |
96 | } | |
97 | ||
98 | /** | |
99 | * Sets the trace event log level to the given level | |
100 | * @param level - event log level to set | |
101 | */ | |
102 | public void setLogLevel(TraceLogLevel level) { | |
103 | fEventInfo.setLogLevel(level); | |
104 | } | |
105 | ||
106 | /** | |
107 | * Sets the trace event log level to the level specified by the given name. | |
108 | * @param levelName - event log level name | |
109 | */ | |
110 | public void setLogLevel(String levelName) { | |
111 | fEventInfo.setLogLevel(levelName); | |
112 | } | |
113 | ||
114 | // ------------------------------------------------------------------------ | |
115 | // Operations | |
116 | // ------------------------------------------------------------------------ | |
117 | } |