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