tmf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / ITimeGraphPresentationProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
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
31 /** State table index for an invisible event
32 * @since 2.0
33 */
34 final int INVISIBLE = -1;
35
36 /** State table index for a transparent event (only borders drawn)
37 * @since 2.0
38 */
39 final int TRANSPARENT = -2;
40
41 /**
42 * Returns the name of state types.
43 *
44 * @return the name of state types
45 */
46 String getStateTypeName();
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 */
57 String getStateTypeName(ITimeGraphEntry entry);
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 */
66 StateItem[] getStateTable();
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.
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.
74 *
75 * @param event the time event
76 * @return the corresponding state table index
77 *
78 * @see #getStateTable
79 * @see #TRANSPARENT
80 * @see #INVISIBLE
81 */
82 int getStateTableIndex(ITimeEvent event);
83
84 /**
85 * Called after drawing the control
86 *
87 * @param bounds
88 * The drawing rectangle
89 * @param gc
90 * The graphics context
91 */
92 void postDrawControl(Rectangle bounds, GC gc);
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 */
104 void postDrawEntry(ITimeGraphEntry entry, Rectangle bounds, GC gc);
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 */
116 void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc);
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 */
126 int getItemHeight(ITimeGraphEntry entry);
127
128 /**
129 * Provides the image icon for a given entry.
130 *
131 * @param entry the entry
132 * @return the image icon
133 */
134 Image getItemImage(ITimeGraphEntry entry);
135
136 /**
137 * Returns the name of this event.
138 *
139 * @param event
140 * The event
141 * @return The event name
142 */
143 String getEventName(ITimeEvent event);
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 */
152 Map<String, String> getEventHoverToolTipInfo(ITimeEvent event);
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 */
164 Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime);
165
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 }
This page took 0.036063 seconds and 5 git commands to generate.