| 1 | /***************************************************************************** |
| 2 | * Copyright (c) 2007, 2013 Intel Corporation, Ericsson. |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * Intel Corporation - Initial API and implementation |
| 10 | * Ruslan A. Scherbakov, Intel - Initial API and implementation |
| 11 | * Alvaro Sanchez-Leon - Updated for TMF |
| 12 | * Patrick Tasse - Refactoring |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets; |
| 16 | |
| 17 | import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat; |
| 18 | |
| 19 | /** |
| 20 | * Time data provider interface, for use in the timegraph widget. |
| 21 | * |
| 22 | * @version 1.0 |
| 23 | * @author Alvaro Sanchez-Leon |
| 24 | * @author Patrick Tasse |
| 25 | * @author Xavier Raynaud |
| 26 | */ |
| 27 | public interface ITimeDataProvider { |
| 28 | |
| 29 | /** |
| 30 | * @return The selected time |
| 31 | */ |
| 32 | long getSelectedTime(); |
| 33 | |
| 34 | /** |
| 35 | * @return The beginning time |
| 36 | */ |
| 37 | long getBeginTime(); |
| 38 | |
| 39 | /** |
| 40 | * @return The end time |
| 41 | */ |
| 42 | long getEndTime(); |
| 43 | |
| 44 | /** |
| 45 | * @return The minimum time |
| 46 | */ |
| 47 | long getMinTime(); |
| 48 | |
| 49 | /** |
| 50 | * @return The maximum time |
| 51 | */ |
| 52 | long getMaxTime(); |
| 53 | |
| 54 | /** |
| 55 | * @return The start time of the current selection window |
| 56 | */ |
| 57 | long getTime0(); |
| 58 | |
| 59 | /** |
| 60 | * @return The end time of the current selection window |
| 61 | */ |
| 62 | long getTime1(); |
| 63 | |
| 64 | /** |
| 65 | * @return The minimal time interval |
| 66 | */ |
| 67 | long getMinTimeInterval(); |
| 68 | |
| 69 | /** |
| 70 | * Updates the time range and notify registered listeners |
| 71 | * |
| 72 | * @param time0 |
| 73 | * @param time1 |
| 74 | */ |
| 75 | void setStartFinishTimeNotify(long time0, long time1); |
| 76 | |
| 77 | /** |
| 78 | * Update the time range but do not trigger event notification |
| 79 | * |
| 80 | * @param time0 |
| 81 | * @param time1 |
| 82 | */ |
| 83 | void setStartFinishTime(long time0, long time1); |
| 84 | |
| 85 | /** |
| 86 | * Notify registered listeners without updating the time range |
| 87 | */ |
| 88 | void notifyStartFinishTime(); |
| 89 | |
| 90 | /** |
| 91 | * Updates the selected time, adjusts the time range if necessary and |
| 92 | * notifies any registered listeners about the new selected time and new |
| 93 | * range (if necessary) |
| 94 | * |
| 95 | * @param time |
| 96 | * A Time to set |
| 97 | * @param ensureVisible |
| 98 | * Ensure visibility of new time (will adjust time range if |
| 99 | * necessary) |
| 100 | */ |
| 101 | public void setSelectedTimeNotify(long time, boolean ensureVisible); |
| 102 | |
| 103 | /** |
| 104 | * Updates the selected time and adjusts the time range if necessary without |
| 105 | * notifying registered listeners. |
| 106 | * |
| 107 | * @param time |
| 108 | * A Time to set |
| 109 | * @param ensureVisible |
| 110 | * Ensure visibility of new time (will adjust time range if |
| 111 | * necessary) |
| 112 | */ |
| 113 | public void setSelectedTime(long time, boolean ensureVisible); |
| 114 | |
| 115 | /** |
| 116 | * Reset the start and end times |
| 117 | */ |
| 118 | void resetStartFinishTime(); |
| 119 | |
| 120 | /** |
| 121 | * @return The names' width |
| 122 | */ |
| 123 | int getNameSpace(); |
| 124 | |
| 125 | /** |
| 126 | * Set the names' width |
| 127 | * |
| 128 | * @param width |
| 129 | */ |
| 130 | void setNameSpace(int width); |
| 131 | |
| 132 | /** |
| 133 | * @return The width for timestamps |
| 134 | */ |
| 135 | int getTimeSpace(); |
| 136 | |
| 137 | /** |
| 138 | * @return the time format, one of: |
| 139 | * <ul> |
| 140 | * <li>{@link TimeFormat#CALENDAR} absolute time, displayed as year/month/day/hours/minutes/seconds/ms/us/ns |
| 141 | * <li>{@link TimeFormat#RELATIVE} relative time, displayed as seconds/ms/us/ns |
| 142 | * <li>{@link TimeFormat#NUMBER} number, displayed as long values. |
| 143 | * </ul> |
| 144 | * @since 2.0 |
| 145 | */ |
| 146 | TimeFormat getTimeFormat(); |
| 147 | } |