1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
;
17 import org
.eclipse
.swt
.graphics
.GC
;
18 import org
.eclipse
.swt
.graphics
.Image
;
19 import org
.eclipse
.swt
.graphics
.Rectangle
;
20 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
21 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
24 * Interface for the time graph widget provider
26 * @author Patrick Tasse
28 public interface ITimeGraphPresentationProvider
{
30 /** State table index for an invisible event
32 final int INVISIBLE
= -1;
34 /** State table index for a transparent event (only borders drawn)
36 final int TRANSPARENT
= -2;
39 * Returns the name of state types.
41 * @return the name of state types
43 String
getStateTypeName();
46 * Returns the name of state type depending on the given entry.
47 * Note that this overwrites the name which is return by getStateTypeName().
51 * @return the name of state type depending on the given entry or null.
53 String
getStateTypeName(ITimeGraphEntry entry
);
56 * Returns table of states with state name to state color relationship.
58 * @return table of states with color and name
60 * @see #getStateTableIndex
62 StateItem
[] getStateTable();
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.
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.
71 * @param event the time event
72 * @return the corresponding state table index
78 int getStateTableIndex(ITimeEvent event
);
81 * Called after drawing the control
84 * The drawing rectangle
86 * The graphics context
88 void postDrawControl(Rectangle bounds
, GC gc
);
91 * Called after drawing an entry
94 * the entry that was drawn
96 * the drawing rectangle
98 * the graphics context
100 void postDrawEntry(ITimeGraphEntry entry
, Rectangle bounds
, GC gc
);
103 * Called after drawing an event
106 * the event that was drawn
108 * the drawing rectangle
110 * the graphics context
112 void postDrawEvent(ITimeEvent event
, Rectangle bounds
, GC gc
);
115 * Returns the height of this item. This value is ignored if the time graph has a fixed item height.
117 * @param entry the entry
118 * @return the item height
120 * @see TimeGraphViewer#setItemHeight
122 int getItemHeight(ITimeGraphEntry entry
);
125 * Provides the image icon for a given entry.
127 * @param entry the entry
128 * @return the image icon
130 Image
getItemImage(ITimeGraphEntry entry
);
133 * Returns the name of this event.
137 * @return The event name
139 String
getEventName(ITimeEvent event
);
142 * Returns a map of name and value providing additional information
143 * to display in the tool tip for this event.
145 * @param event the time event
146 * @return a map of tool tip information
148 Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
);
151 * Returns a map of name and value providing additional information
152 * to display in the tool tip for this event.
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
158 Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
, long hoverTime
);
161 * Check whether time and duration should be displayed in tooltip (after items from
162 * {@link #getEventHoverToolTipInfo(ITimeEvent)}).
164 * @return <code>true</code> if times and duration should be displayed on tooltip, <code>false</code> otherwise.
166 public boolean displayTimesInTooltip();