Commit | Line | Data |
---|---|---|
34313553 | 1 | /******************************************************************************* |
ad128fd8 | 2 | * Copyright (c) 2012, 2013 Ericsson |
34313553 PT |
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 | * Patrick Tasse - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.ui.widgets.timegraph; | |
14 | ||
15 | import java.util.Map; | |
16 | ||
17 | import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; | |
18 | import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; | |
19 | import org.eclipse.swt.graphics.GC; | |
20 | import org.eclipse.swt.graphics.Image; | |
21 | import org.eclipse.swt.graphics.Rectangle; | |
22 | ||
23 | /** | |
24 | * Interface for the time graph widget provider | |
25 | * | |
26 | * @version 1.0 | |
27 | * @author Patrick Tasse | |
28 | */ | |
29 | public interface ITimeGraphPresentationProvider { | |
30 | ||
ad128fd8 PT |
31 | /** State table index for an invisible event |
32 | * @since 2.0 | |
33 | */ | |
f1fae91f | 34 | final int INVISIBLE = -1; |
ad128fd8 PT |
35 | |
36 | /** State table index for a transparent event (only borders drawn) | |
37 | * @since 2.0 | |
38 | */ | |
f1fae91f | 39 | final int TRANSPARENT = -2; |
ad128fd8 | 40 | |
34313553 PT |
41 | /** |
42 | * Returns the name of state types. | |
43 | * | |
44 | * @return the name of state types | |
45 | */ | |
57a2a5ca | 46 | String getStateTypeName(); |
34313553 PT |
47 | |
48 | /** | |
49 | * Returns the name of state type depending on the given entry. | |
50 | * Note that this overwrites the name which is return by getStateTypeName(). | |
51 | * | |
52 | * @param entry | |
53 | * the entry | |
54 | * @return the name of state type depending on the given entry or null. | |
55 | * @since 2.0 | |
56 | */ | |
57a2a5ca | 57 | String getStateTypeName(ITimeGraphEntry entry); |
34313553 PT |
58 | |
59 | /** | |
60 | * Returns table of states with state name to state color relationship. | |
61 | * | |
62 | * @return table of states with color and name | |
63 | * | |
64 | * @see #getStateTableIndex | |
65 | */ | |
57a2a5ca | 66 | StateItem[] getStateTable(); |
34313553 PT |
67 | |
68 | /** | |
69 | * Returns the index in the state table corresponding to this time event. | |
70 | * The index should correspond to a state in the state table, | |
71 | * otherwise the color SWT.COLOR_BLACK will be used. | |
ad128fd8 PT |
72 | * If the index returned is TRANSPARENT, only the event borders will be drawn. |
73 | * If the index returned is INVISIBLE or another negative, the event will not be drawn. | |
34313553 PT |
74 | * |
75 | * @param event the time event | |
76 | * @return the corresponding state table index | |
77 | * | |
78 | * @see #getStateTable | |
ad128fd8 PT |
79 | * @see #TRANSPARENT |
80 | * @see #INVISIBLE | |
34313553 | 81 | */ |
57a2a5ca | 82 | int getStateTableIndex(ITimeEvent event); |
34313553 PT |
83 | |
84 | /** | |
85 | * Called after drawing the control | |
86 | * | |
87 | * @param bounds | |
88 | * The drawing rectangle | |
89 | * @param gc | |
90 | * The graphics context | |
91 | */ | |
57a2a5ca | 92 | void postDrawControl(Rectangle bounds, GC gc); |
34313553 PT |
93 | |
94 | /** | |
95 | * Called after drawing an entry | |
96 | * | |
97 | * @param entry | |
98 | * the entry that was drawn | |
99 | * @param bounds | |
100 | * the drawing rectangle | |
101 | * @param gc | |
102 | * the graphics context | |
103 | */ | |
57a2a5ca | 104 | void postDrawEntry(ITimeGraphEntry entry, Rectangle bounds, GC gc); |
34313553 PT |
105 | |
106 | /** | |
107 | * Called after drawing an event | |
108 | * | |
109 | * @param event | |
110 | * the event that was drawn | |
111 | * @param bounds | |
112 | * the drawing rectangle | |
113 | * @param gc | |
114 | * the graphics context | |
115 | */ | |
57a2a5ca | 116 | void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc); |
34313553 PT |
117 | |
118 | /** | |
119 | * Returns the height of this item. This value is ignored if the time graph has a fixed item height. | |
120 | * | |
121 | * @param entry the entry | |
122 | * @return the item height | |
123 | * | |
124 | * @see TimeGraphViewer#setItemHeight | |
125 | */ | |
57a2a5ca | 126 | int getItemHeight(ITimeGraphEntry entry); |
34313553 PT |
127 | |
128 | /** | |
129 | * Provides the image icon for a given entry. | |
130 | * | |
131 | * @param entry the entry | |
132 | * @return the image icon | |
133 | */ | |
57a2a5ca | 134 | Image getItemImage(ITimeGraphEntry entry); |
34313553 PT |
135 | |
136 | /** | |
137 | * Returns the name of this event. | |
138 | * | |
139 | * @param event | |
140 | * The event | |
141 | * @return The event name | |
142 | */ | |
57a2a5ca | 143 | String getEventName(ITimeEvent event); |
34313553 PT |
144 | |
145 | /** | |
146 | * Returns a map of name and value providing additional information | |
147 | * to display in the tool tip for this event. | |
148 | * | |
149 | * @param event the time event | |
150 | * @return a map of tool tip information | |
151 | */ | |
57a2a5ca | 152 | Map<String, String> getEventHoverToolTipInfo(ITimeEvent event); |
34313553 PT |
153 | |
154 | /** | |
155 | * Returns a map of name and value providing additional information | |
156 | * to display in the tool tip for this event. | |
157 | * | |
158 | * @param event the time event | |
159 | * @param hoverTime the time corresponding to the mouse hover position | |
160 | * @return a map of tool tip information | |
161 | * | |
162 | * @since 2.0 | |
163 | */ | |
57a2a5ca | 164 | Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime); |
34313553 | 165 | |
1e9f8bef XR |
166 | /** |
167 | * Check whether time and duration should be displayed in tooltip (after items from | |
168 | * {@link #getEventHoverToolTipInfo(ITimeEvent)}). | |
169 | * | |
170 | * @return <code>true</code> if times and duration should be displayed on tooltip, <code>false</code> otherwise. | |
171 | * | |
172 | * @since 3.0 | |
173 | */ | |
174 | public boolean displayTimesInTooltip(); | |
175 | ||
176 | ||
177 | } |