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 the name of state type depending on the given entry.
40 * Note that this overwrites the name which is return by getStateTypeName().
44 * @return the name of state type depending on the given entry or null.
47 public String
getStateTypeName(ITimeGraphEntry entry
);
50 * Returns table of states with state name to state color relationship.
52 * @return table of states with color and name
54 * @see #getStateTableIndex
56 public StateItem
[] getStateTable();
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.
64 * @param event the time event
65 * @return the corresponding state table index
69 public int getStateTableIndex(ITimeEvent event
);
72 * Called after drawing the control
75 * The drawing rectangle
77 * The graphics context
79 public void postDrawControl(Rectangle bounds
, GC gc
);
82 * Called after drawing an entry
85 * the entry that was drawn
87 * the drawing rectangle
89 * the graphics context
91 public void postDrawEntry(ITimeGraphEntry entry
, Rectangle bounds
, GC gc
);
94 * Called after drawing an event
97 * the event that was drawn
99 * the drawing rectangle
101 * the graphics context
103 public void postDrawEvent(ITimeEvent event
, Rectangle bounds
, GC gc
);
106 * Returns the height of this item. This value is ignored if the time graph has a fixed item height.
108 * @param entry the entry
109 * @return the item height
111 * @see TimeGraphViewer#setItemHeight
113 public int getItemHeight(ITimeGraphEntry entry
);
116 * Provides the image icon for a given entry.
118 * @param entry the entry
119 * @return the image icon
121 public Image
getItemImage(ITimeGraphEntry entry
);
124 * Returns the name of this event.
128 * @return The event name
130 public String
getEventName(ITimeEvent event
);
133 * Returns a map of name and value providing additional information
134 * to display in the tool tip for this event.
136 * @param event the time event
137 * @return a map of tool tip information
139 public Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
);