Change some @since to 1.1 for things that were really added in 1.1
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / widgets / timegraph / TimeGraphPresentationProvider.java
... / ...
CommitLineData
1/*******************************************************************************
2 * Copyright (c) 2009, 2014 Ericsson, École Polytechnique de Montréal
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 * Alvaro Sanchez-Leon - Initial API and implementation
11 * Patrick Tasse - Refactoring
12 * Geneviève Bastien - Add drawing helper methods
13 *******************************************************************************/
14
15package org.eclipse.tracecompass.tmf.ui.widgets.timegraph;
16
17import java.util.ArrayList;
18import java.util.List;
19import java.util.Map;
20
21import org.eclipse.swt.graphics.GC;
22import org.eclipse.swt.graphics.Image;
23import org.eclipse.swt.graphics.Rectangle;
24import org.eclipse.tracecompass.internal.tmf.ui.Messages;
25import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
26import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
27import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITmfTimeGraphDrawingHelper;
28
29/**
30 * Provider class for the time graph provider
31 *
32 * @author Patrick Tasse
33 *
34 */
35public class TimeGraphPresentationProvider implements ITimeGraphPresentationProvider2 {
36
37 private ITmfTimeGraphDrawingHelper fDrawingHelper;
38 private final String fStateTypeName;
39
40 // The list of listeners for graph color changes
41 private final List<ITimeGraphColorListener> fListeners = new ArrayList<>();
42
43 // ------------------------------------------------------------------------
44 // Constants
45 // ------------------------------------------------------------------------
46 private static final int DEFAULT_ITEM_HEIGHT = 19;
47
48 // ------------------------------------------------------------------------
49 // Operations
50 // ------------------------------------------------------------------------
51
52 /**
53 * Constructor
54 *
55 * @param stateTypeName The state type name
56 */
57 public TimeGraphPresentationProvider(String stateTypeName) {
58 fStateTypeName = stateTypeName;
59 }
60
61 /**
62 * Constructor
63 */
64 public TimeGraphPresentationProvider() {
65 this(Messages.TmfTimeLegend_TRACE_STATES);
66 }
67
68 @Override
69 public String getStateTypeName() {
70 return fStateTypeName;
71 }
72
73 @Override
74 public String getStateTypeName(ITimeGraphEntry entry) {
75 return null;
76 }
77
78 @Override
79 public StateItem[] getStateTable() {
80 return null;
81 }
82
83 @Override
84 public int getStateTableIndex(ITimeEvent event) {
85 return 0;
86 }
87
88 @Override
89 public ITmfTimeGraphDrawingHelper getDrawingHelper() {
90 return fDrawingHelper;
91 }
92
93 @Override
94 public void setDrawingHelper(ITmfTimeGraphDrawingHelper helper) {
95 fDrawingHelper = helper;
96 }
97
98 @Override
99 public void postDrawControl(Rectangle bounds, GC gc) {
100 // Override to add own drawing code
101 }
102
103 @Override
104 public void postDrawEntry(ITimeGraphEntry entry, Rectangle bounds, GC gc) {
105 // Override to add own drawing code
106 }
107
108 @Override
109 public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) {
110 // Override to add own drawing code
111 }
112
113 @Override
114 public int getItemHeight(ITimeGraphEntry entry) {
115 return DEFAULT_ITEM_HEIGHT;
116 }
117
118 @Override
119 public Image getItemImage(ITimeGraphEntry entry) {
120 return null;
121 }
122
123 @Override
124 public String getEventName(ITimeEvent event) {
125 return null;
126 }
127
128 @Override
129 public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) {
130 return null;
131 }
132
133 @Override
134 public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) {
135 return getEventHoverToolTipInfo(event);
136 }
137
138 @Override
139 public boolean displayTimesInTooltip() {
140 return true;
141 }
142
143 @Override
144 public void addColorListener(ITimeGraphColorListener listener) {
145 if (!fListeners.contains(listener)) {
146 fListeners.add(listener);
147 }
148 }
149
150 @Override
151 public void removeColorListener(ITimeGraphColorListener listener) {
152 fListeners.remove(listener);
153 }
154
155 /**
156 * Notifies listeners of the state table change
157 */
158 protected void fireColorSettingsChanged() {
159 for (ITimeGraphColorListener listener : fListeners) {
160 listener.colorSettingsChanged(getStateTable());
161 }
162 }
163
164}
This page took 0.061009 seconds and 5 git commands to generate.