1 /*******************************************************************************
2 * Copyright (c) 2012 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
{
32 * Returns the name of state types.
34 * @return the name of state types
36 public String
getStateTypeName();
39 * Returns table of states with state name to state color relationship.
41 * @return table of states with color and name
43 * @see #getStateTableIndex
45 public StateItem
[] getStateTable();
48 * Returns the index in the state table corresponding to this time event.
49 * The index should correspond to a state in the state table,
50 * otherwise the color SWT.COLOR_BLACK will be used.
51 * If the index returned is negative, the event will not be drawn.
53 * @param event the time event
54 * @return the corresponding state table index
58 public int getStateTableIndex(ITimeEvent event
);
61 * Called after drawing the control
64 * The drawing rectangle
66 * The graphics context
68 public void postDrawControl(Rectangle bounds
, GC gc
);
71 * Called after drawing an entry
74 * the entry that was drawn
76 * the drawing rectangle
78 * the graphics context
80 public void postDrawEntry(ITimeGraphEntry entry
, Rectangle bounds
, GC gc
);
83 * Called after drawing an event
86 * the event that was drawn
88 * the drawing rectangle
90 * the graphics context
92 public void postDrawEvent(ITimeEvent event
, Rectangle bounds
, GC gc
);
95 * Returns the height of this item. This value is ignored if the time graph has a fixed item height.
97 * @param entry the entry
98 * @return the item height
100 * @see TimeGraphViewer#setItemHeight
102 public int getItemHeight(ITimeGraphEntry entry
);
105 * Provides the image icon for a given entry.
107 * @param entry the entry
108 * @return the image icon
110 public Image
getItemImage(ITimeGraphEntry entry
);
113 * Returns the name of this event.
117 * @return The event name
119 public String
getEventName(ITimeEvent event
);
122 * Returns a map of name and value providing additional information
123 * to display in the tool tip for this event.
125 * @param event the time event
126 * @return a map of tool tip information
128 public Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
);