1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 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
.linuxtools
.tmf
.ui
.widgets
.timegraph
;
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
;
24 * Interface for the time graph widget provider
27 * @author Patrick Tasse
29 public interface ITimeGraphPresentationProvider
{
31 /** State table index for an invisible event
34 final int INVISIBLE
= -1;
36 /** State table index for a transparent event (only borders drawn)
39 final int TRANSPARENT
= -2;
42 * Returns the name of state types.
44 * @return the name of state types
46 String
getStateTypeName();
49 * Returns the name of state type depending on the given entry.
50 * Note that this overwrites the name which is return by getStateTypeName().
54 * @return the name of state type depending on the given entry or null.
57 String
getStateTypeName(ITimeGraphEntry entry
);
60 * Returns table of states with state name to state color relationship.
62 * @return table of states with color and name
64 * @see #getStateTableIndex
66 StateItem
[] getStateTable();
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.
75 * @param event the time event
76 * @return the corresponding state table index
82 int getStateTableIndex(ITimeEvent event
);
85 * Called after drawing the control
88 * The drawing rectangle
90 * The graphics context
92 void postDrawControl(Rectangle bounds
, GC gc
);
95 * Called after drawing an entry
98 * the entry that was drawn
100 * the drawing rectangle
102 * the graphics context
104 void postDrawEntry(ITimeGraphEntry entry
, Rectangle bounds
, GC gc
);
107 * Called after drawing an event
110 * the event that was drawn
112 * the drawing rectangle
114 * the graphics context
116 void postDrawEvent(ITimeEvent event
, Rectangle bounds
, GC gc
);
119 * Returns the height of this item. This value is ignored if the time graph has a fixed item height.
121 * @param entry the entry
122 * @return the item height
124 * @see TimeGraphViewer#setItemHeight
126 int getItemHeight(ITimeGraphEntry entry
);
129 * Provides the image icon for a given entry.
131 * @param entry the entry
132 * @return the image icon
134 Image
getItemImage(ITimeGraphEntry entry
);
137 * Returns the name of this event.
141 * @return The event name
143 String
getEventName(ITimeEvent event
);
146 * Returns a map of name and value providing additional information
147 * to display in the tool tip for this event.
149 * @param event the time event
150 * @return a map of tool tip information
152 Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
);
155 * Returns a map of name and value providing additional information
156 * to display in the tool tip for this event.
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
164 Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
, long hoverTime
);