Commit | Line | Data |
---|---|---|
be222f56 | 1 | /***************************************************************************** |
50d36521 | 2 | * Copyright (c) 2007, 2015 Intel Corporation, Ericsson |
baf92cac | 3 | * |
be222f56 PT |
4 | * All rights reserved. This program and the accompanying materials |
5 | * are made available under the terms of the Eclipse Public License v1.0 | |
6 | * which accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Intel Corporation - Initial API and implementation | |
11 | * Ruslan A. Scherbakov, Intel - Initial API and implementation | |
12 | * Alvaro Sanchez-Leon - Updated for TMF | |
baf92cac AM |
13 | * Geneviève Bastien - Added methods to save a time range selection |
14 | * Patrick Tasse - Refactoring, support for range selection | |
be222f56 PT |
15 | *****************************************************************************/ |
16 | ||
2bdf0193 | 17 | package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets; |
be222f56 | 18 | |
2bdf0193 | 19 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat; |
026664b7 | 20 | |
be222f56 PT |
21 | /** |
22 | * Time data provider interface, for use in the timegraph widget. | |
23 | * | |
be222f56 PT |
24 | * @author Alvaro Sanchez-Leon |
25 | * @author Patrick Tasse | |
026664b7 | 26 | * @author Xavier Raynaud |
be222f56 PT |
27 | */ |
28 | public interface ITimeDataProvider { | |
29 | ||
30 | /** | |
84c8aef7 PT |
31 | * Updates the selection begin and end time and notifies the selection |
32 | * listeners about the new selection range (if it has changed). | |
33 | * <p> | |
34 | * If ensureVisible is true, the window range will be centered either on the | |
35 | * selection begin time (if it has changed) or otherwise on the selection | |
36 | * end time, if and only if that time is outside of the current window. If | |
37 | * the window range is modified, the range listeners will be notified. | |
baf92cac | 38 | * |
84c8aef7 PT |
39 | * @param beginTime |
40 | * the selection begin time | |
41 | * @param endTime | |
42 | * the selection end time | |
43 | * @param ensureVisible | |
44 | * if true, ensure visibility of the new selection range boundary | |
45 | * @since 2.0 | |
baf92cac | 46 | */ |
84c8aef7 | 47 | void setSelectionRangeNotify(long beginTime, long endTime, boolean ensureVisible); |
baf92cac AM |
48 | |
49 | /** | |
84c8aef7 PT |
50 | * Updates the selection begin and end time. |
51 | * <p> | |
52 | * If ensureVisible is true, the window range will be centered either on the | |
53 | * selection begin time (if it has changed) or otherwise on the selection | |
54 | * end time, if and only if that time is outside of the current window. If | |
55 | * the window range is modified, the range listeners will be notified. | |
0fcf3b09 | 56 | * |
84c8aef7 PT |
57 | * @param beginTime |
58 | * the selection begin time | |
59 | * @param endTime | |
60 | * the selection end time | |
61 | * @param ensureVisible | |
62 | * if true, ensure visibility of the new selection range boundary | |
63 | * @since 2.0 | |
baf92cac | 64 | */ |
84c8aef7 | 65 | void setSelectionRange(long beginTime, long endTime, boolean ensureVisible); |
baf92cac AM |
66 | |
67 | /** | |
68 | * @return The begin time of the current selection | |
baf92cac AM |
69 | */ |
70 | long getSelectionBegin(); | |
71 | ||
72 | /** | |
73 | * @return The end time of the current selection | |
be222f56 | 74 | */ |
baf92cac | 75 | long getSelectionEnd(); |
be222f56 PT |
76 | |
77 | /** | |
50d36521 PT |
78 | * Get the user-specified bounds begin time. May be set to SWT.DEFAULT. For |
79 | * the actual bound use {@link #getMinTime()}. | |
80 | * | |
81 | * @return The user-specified begin time, or SWT.DEFAULT if input bound used | |
be222f56 PT |
82 | */ |
83 | long getBeginTime(); | |
84 | ||
85 | /** | |
50d36521 PT |
86 | * Get the user-specified bounds end time. May be set to SWT.DEFAULT. For |
87 | * the actual bound use {@link #getMaxTime()}. | |
88 | * | |
89 | * @return The user-specified end time, or SWT.DEFAULT if input bound used | |
be222f56 PT |
90 | */ |
91 | long getEndTime(); | |
92 | ||
93 | /** | |
50d36521 | 94 | * @return The bounds minimum time |
be222f56 PT |
95 | */ |
96 | long getMinTime(); | |
97 | ||
98 | /** | |
50d36521 | 99 | * @return The bounds maximum time |
be222f56 PT |
100 | */ |
101 | long getMaxTime(); | |
102 | ||
103 | /** | |
50d36521 | 104 | * @return The current window start time |
be222f56 PT |
105 | */ |
106 | long getTime0(); | |
107 | ||
108 | /** | |
50d36521 | 109 | * @return The current window end time |
be222f56 PT |
110 | */ |
111 | long getTime1(); | |
112 | ||
113 | /** | |
114 | * @return The minimal time interval | |
115 | */ | |
116 | long getMinTimeInterval(); | |
117 | ||
118 | /** | |
84c8aef7 | 119 | * Updates the window range and notify the range listeners. |
be222f56 PT |
120 | * |
121 | * @param time0 | |
84c8aef7 | 122 | * the window start time |
be222f56 | 123 | * @param time1 |
84c8aef7 | 124 | * the window end time |
be222f56 PT |
125 | */ |
126 | void setStartFinishTimeNotify(long time0, long time1); | |
127 | ||
128 | /** | |
84c8aef7 | 129 | * Update the window range but do not notify the range listeners. |
be222f56 PT |
130 | * |
131 | * @param time0 | |
84c8aef7 | 132 | * the window start time |
be222f56 | 133 | * @param time1 |
84c8aef7 | 134 | * the window end time |
be222f56 PT |
135 | */ |
136 | void setStartFinishTime(long time0, long time1); | |
137 | ||
138 | /** | |
84c8aef7 | 139 | * Notify the range listeners without updating the time range. |
be222f56 PT |
140 | */ |
141 | void notifyStartFinishTime(); | |
142 | ||
143 | /** | |
84c8aef7 PT |
144 | * Updates the selection time and notifies the selection listeners about the |
145 | * new selection time (if it has changed). | |
146 | * <p> | |
147 | * If ensureVisible is true, the window range will be centered on the | |
148 | * selection time, if and only if that time is outside of the current | |
149 | * window. If the window range is modified, the range listeners will be | |
150 | * notified. | |
be222f56 PT |
151 | * |
152 | * @param time | |
84c8aef7 | 153 | * the selection time |
be222f56 | 154 | * @param ensureVisible |
84c8aef7 | 155 | * if true, ensure visibility of the new selection time |
be222f56 | 156 | */ |
f1fae91f | 157 | void setSelectedTimeNotify(long time, boolean ensureVisible); |
be222f56 PT |
158 | |
159 | /** | |
84c8aef7 PT |
160 | * Updates the selection time. |
161 | * <p> | |
162 | * If ensureVisible is true, the window range will be centered on the | |
163 | * selection time, if and only if that time is outside of the current | |
164 | * window. If the window range is modified, the range listeners will be | |
165 | * notified. | |
be222f56 PT |
166 | * |
167 | * @param time | |
84c8aef7 | 168 | * the selection time |
be222f56 | 169 | * @param ensureVisible |
84c8aef7 | 170 | * if true, ensure visibility of the new selection time |
be222f56 | 171 | */ |
f1fae91f | 172 | void setSelectedTime(long time, boolean ensureVisible); |
be222f56 PT |
173 | |
174 | /** | |
88de10c6 | 175 | * Reset the start and end times and notify the registered listeners |
be222f56 PT |
176 | */ |
177 | void resetStartFinishTime(); | |
178 | ||
179 | /** | |
180 | * @return The names' width | |
181 | */ | |
182 | int getNameSpace(); | |
183 | ||
184 | /** | |
185 | * Set the names' width | |
186 | * | |
187 | * @param width | |
188 | */ | |
189 | void setNameSpace(int width); | |
190 | ||
191 | /** | |
192 | * @return The width for timestamps | |
193 | */ | |
194 | int getTimeSpace(); | |
195 | ||
026664b7 XR |
196 | /** |
197 | * @return the time format, one of: | |
198 | * <ul> | |
199 | * <li>{@link TimeFormat#CALENDAR} absolute time, displayed as year/month/day/hours/minutes/seconds/ms/us/ns | |
200 | * <li>{@link TimeFormat#RELATIVE} relative time, displayed as seconds/ms/us/ns | |
201 | * <li>{@link TimeFormat#NUMBER} number, displayed as long values. | |
84c8aef7 | 202 | * <li>{@link TimeFormat#CYCLES} cycles, displayed as long values. |
026664b7 | 203 | * </ul> |
026664b7 XR |
204 | */ |
205 | TimeFormat getTimeFormat(); | |
be222f56 | 206 | } |