| 1 | /***************************************************************************** |
| 2 | * Copyright (c) 2007, 2015 Intel Corporation, Ericsson |
| 3 | * |
| 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 |
| 13 | * Geneviève Bastien - Added methods to save a time range selection |
| 14 | * Patrick Tasse - Refactoring, support for range selection |
| 15 | *****************************************************************************/ |
| 16 | |
| 17 | package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets; |
| 18 | |
| 19 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat; |
| 20 | |
| 21 | /** |
| 22 | * Time data provider interface, for use in the timegraph widget. |
| 23 | * |
| 24 | * @author Alvaro Sanchez-Leon |
| 25 | * @author Patrick Tasse |
| 26 | * @author Xavier Raynaud |
| 27 | */ |
| 28 | public interface ITimeDataProvider { |
| 29 | |
| 30 | /** |
| 31 | * Updates the selection begin and end time and notifies any registered |
| 32 | * listeners about the new time range (if necessary) |
| 33 | * |
| 34 | * @param beginTime the selection begin time |
| 35 | * @param endTime the selection end time |
| 36 | */ |
| 37 | void setSelectionRangeNotify(long beginTime, long endTime); |
| 38 | |
| 39 | /** |
| 40 | * Updates the selection begin and end time |
| 41 | * |
| 42 | * @param beginTime the selection begin time |
| 43 | * @param endTime the selection end time |
| 44 | */ |
| 45 | void setSelectionRange(long beginTime, long endTime); |
| 46 | |
| 47 | /** |
| 48 | * @return The begin time of the current selection |
| 49 | */ |
| 50 | long getSelectionBegin(); |
| 51 | |
| 52 | /** |
| 53 | * @return The end time of the current selection |
| 54 | */ |
| 55 | long getSelectionEnd(); |
| 56 | |
| 57 | /** |
| 58 | * Get the user-specified bounds begin time. May be set to SWT.DEFAULT. For |
| 59 | * the actual bound use {@link #getMinTime()}. |
| 60 | * |
| 61 | * @return The user-specified begin time, or SWT.DEFAULT if input bound used |
| 62 | */ |
| 63 | long getBeginTime(); |
| 64 | |
| 65 | /** |
| 66 | * Get the user-specified bounds end time. May be set to SWT.DEFAULT. For |
| 67 | * the actual bound use {@link #getMaxTime()}. |
| 68 | * |
| 69 | * @return The user-specified end time, or SWT.DEFAULT if input bound used |
| 70 | */ |
| 71 | long getEndTime(); |
| 72 | |
| 73 | /** |
| 74 | * @return The bounds minimum time |
| 75 | */ |
| 76 | long getMinTime(); |
| 77 | |
| 78 | /** |
| 79 | * @return The bounds maximum time |
| 80 | */ |
| 81 | long getMaxTime(); |
| 82 | |
| 83 | /** |
| 84 | * @return The current window start time |
| 85 | */ |
| 86 | long getTime0(); |
| 87 | |
| 88 | /** |
| 89 | * @return The current window end time |
| 90 | */ |
| 91 | long getTime1(); |
| 92 | |
| 93 | /** |
| 94 | * @return The minimal time interval |
| 95 | */ |
| 96 | long getMinTimeInterval(); |
| 97 | |
| 98 | /** |
| 99 | * Updates the time range and notify registered listeners |
| 100 | * |
| 101 | * @param time0 |
| 102 | * @param time1 |
| 103 | */ |
| 104 | void setStartFinishTimeNotify(long time0, long time1); |
| 105 | |
| 106 | /** |
| 107 | * Update the time range but do not trigger event notification |
| 108 | * |
| 109 | * @param time0 |
| 110 | * @param time1 |
| 111 | */ |
| 112 | void setStartFinishTime(long time0, long time1); |
| 113 | |
| 114 | /** |
| 115 | * Notify registered listeners without updating the time range |
| 116 | */ |
| 117 | void notifyStartFinishTime(); |
| 118 | |
| 119 | /** |
| 120 | * Updates the selected time, adjusts the time range if necessary and |
| 121 | * notifies any registered listeners about the new selected time and new |
| 122 | * range (if necessary) |
| 123 | * |
| 124 | * @param time |
| 125 | * A Time to set |
| 126 | * @param ensureVisible |
| 127 | * Ensure visibility of new time (will adjust time range if |
| 128 | * necessary) |
| 129 | */ |
| 130 | void setSelectedTimeNotify(long time, boolean ensureVisible); |
| 131 | |
| 132 | /** |
| 133 | * Updates the selected time and adjusts the time range if necessary without |
| 134 | * notifying registered listeners. |
| 135 | * |
| 136 | * @param time |
| 137 | * A Time to set |
| 138 | * @param ensureVisible |
| 139 | * Ensure visibility of new time (will adjust time range if |
| 140 | * necessary) |
| 141 | */ |
| 142 | void setSelectedTime(long time, boolean ensureVisible); |
| 143 | |
| 144 | /** |
| 145 | * Reset the start and end times and notify the registered listeners |
| 146 | */ |
| 147 | void resetStartFinishTime(); |
| 148 | |
| 149 | /** |
| 150 | * @return The names' width |
| 151 | */ |
| 152 | int getNameSpace(); |
| 153 | |
| 154 | /** |
| 155 | * Set the names' width |
| 156 | * |
| 157 | * @param width |
| 158 | */ |
| 159 | void setNameSpace(int width); |
| 160 | |
| 161 | /** |
| 162 | * @return The width for timestamps |
| 163 | */ |
| 164 | int getTimeSpace(); |
| 165 | |
| 166 | /** |
| 167 | * @return the time format, one of: |
| 168 | * <ul> |
| 169 | * <li>{@link TimeFormat#CALENDAR} absolute time, displayed as year/month/day/hours/minutes/seconds/ms/us/ns |
| 170 | * <li>{@link TimeFormat#RELATIVE} relative time, displayed as seconds/ms/us/ns |
| 171 | * <li>{@link TimeFormat#NUMBER} number, displayed as long values. |
| 172 | * </ul> |
| 173 | */ |
| 174 | TimeFormat getTimeFormat(); |
| 175 | } |