Commit | Line | Data |
---|---|---|
34313553 PT |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 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 | /** | |
32 | * Returns the name of state types. | |
33 | * | |
34 | * @return the name of state types | |
35 | */ | |
36 | public String getStateTypeName(); | |
37 | ||
38 | /** | |
39 | * Returns the name of state type depending on the given entry. | |
40 | * Note that this overwrites the name which is return by getStateTypeName(). | |
41 | * | |
42 | * @param entry | |
43 | * the entry | |
44 | * @return the name of state type depending on the given entry or null. | |
45 | * @since 2.0 | |
46 | */ | |
47 | public String getStateTypeName(ITimeGraphEntry entry); | |
48 | ||
49 | /** | |
50 | * Returns table of states with state name to state color relationship. | |
51 | * | |
52 | * @return table of states with color and name | |
53 | * | |
54 | * @see #getStateTableIndex | |
55 | */ | |
56 | public StateItem[] getStateTable(); | |
57 | ||
58 | /** | |
59 | * Returns the index in the state table corresponding to this time event. | |
60 | * The index should correspond to a state in the state table, | |
61 | * otherwise the color SWT.COLOR_BLACK will be used. | |
62 | * If the index returned is negative, the event will not be drawn. | |
63 | * | |
64 | * @param event the time event | |
65 | * @return the corresponding state table index | |
66 | * | |
67 | * @see #getStateTable | |
68 | */ | |
69 | public int getStateTableIndex(ITimeEvent event); | |
70 | ||
71 | /** | |
72 | * Called after drawing the control | |
73 | * | |
74 | * @param bounds | |
75 | * The drawing rectangle | |
76 | * @param gc | |
77 | * The graphics context | |
78 | */ | |
79 | public void postDrawControl(Rectangle bounds, GC gc); | |
80 | ||
81 | /** | |
82 | * Called after drawing an entry | |
83 | * | |
84 | * @param entry | |
85 | * the entry that was drawn | |
86 | * @param bounds | |
87 | * the drawing rectangle | |
88 | * @param gc | |
89 | * the graphics context | |
90 | */ | |
91 | public void postDrawEntry(ITimeGraphEntry entry, Rectangle bounds, GC gc); | |
92 | ||
93 | /** | |
94 | * Called after drawing an event | |
95 | * | |
96 | * @param event | |
97 | * the event that was drawn | |
98 | * @param bounds | |
99 | * the drawing rectangle | |
100 | * @param gc | |
101 | * the graphics context | |
102 | */ | |
103 | public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc); | |
104 | ||
105 | /** | |
106 | * Returns the height of this item. This value is ignored if the time graph has a fixed item height. | |
107 | * | |
108 | * @param entry the entry | |
109 | * @return the item height | |
110 | * | |
111 | * @see TimeGraphViewer#setItemHeight | |
112 | */ | |
113 | public int getItemHeight(ITimeGraphEntry entry); | |
114 | ||
115 | /** | |
116 | * Provides the image icon for a given entry. | |
117 | * | |
118 | * @param entry the entry | |
119 | * @return the image icon | |
120 | */ | |
121 | public Image getItemImage(ITimeGraphEntry entry); | |
122 | ||
123 | /** | |
124 | * Returns the name of this event. | |
125 | * | |
126 | * @param event | |
127 | * The event | |
128 | * @return The event name | |
129 | */ | |
130 | public String getEventName(ITimeEvent event); | |
131 | ||
132 | /** | |
133 | * Returns a map of name and value providing additional information | |
134 | * to display in the tool tip for this event. | |
135 | * | |
136 | * @param event the time event | |
137 | * @return a map of tool tip information | |
138 | */ | |
139 | public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event); | |
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 | * @param hoverTime the time corresponding to the mouse hover position | |
147 | * @return a map of tool tip information | |
148 | * | |
149 | * @since 2.0 | |
150 | */ | |
151 | public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime); | |
152 | ||
b83af2c3 | 153 | } |