Bug 378401: Implementation of time graph widget.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / TimeGraphPresentationProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010, 2012 Ericsson
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 *******************************************************************************/
13
14 package org.eclipse.linuxtools.tmf.ui.widgets.timegraph;
15
16 import java.util.Map;
17
18 import org.eclipse.linuxtools.internal.tmf.ui.Messages;
19 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
20 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
21 import org.eclipse.swt.graphics.GC;
22 import org.eclipse.swt.graphics.Image;
23 import org.eclipse.swt.graphics.Rectangle;
24
25 public abstract class TimeGraphPresentationProvider implements ITimeGraphPresentationProvider {
26
27 // ------------------------------------------------------------------------
28 // Constants
29 // ------------------------------------------------------------------------
30 private static final int DEFAULT_ITEM_HEIGHT = 19;
31
32 // ------------------------------------------------------------------------
33 // Operations
34 // ------------------------------------------------------------------------
35 /*
36 * (non-Javadoc)
37 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateTypeName()
38 */
39 @Override
40 public String getStateTypeName() {
41 return Messages.TmfTimeLegend_TRACE_STATES;
42 }
43
44 /*
45 * (non-Javadoc)
46 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#postDrawItems(org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.GC)
47 */
48 @Override
49 public void postDrawControl(Rectangle bounds, GC gc) {
50 // Override to add own drawing code
51 }
52
53 /*
54 * (non-Javadoc)
55 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#postDrawItem(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry, org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.GC)
56 */
57 @Override
58 public void postDrawEntry(ITimeGraphEntry entry, Rectangle bounds, GC gc) {
59 // Override to add own drawing code
60 }
61
62 /*
63 * (non-Javadoc)
64 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#drawState(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent, org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.GC)
65 */
66 @Override
67 public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) {
68 // Override to add own drawing code
69 }
70
71 // /* (non-Javadoc)
72 // * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#getEventColorTable()
73 // */
74 // @Override
75 // public RGB[] getEventColorTable() {
76 // return null;
77 // }
78 //
79 // /*
80 // * (non-Javadoc)
81 // * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getEventNameTable()
82 // */
83 // @Override
84 // public String[] getEventNameTable() {
85 // return null;
86 // }
87
88 /*
89 * (non-Javadoc)
90 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateItems()
91 */
92 @Override
93 public StateItem[] getStateTable() {
94 return null;
95 }
96
97 /*
98 * (non-Javadoc)
99 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getEventTableIndex(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
100 */
101 @Override
102 public int getEventTableIndex(ITimeEvent event) {
103 return 0;
104 }
105
106 /*
107 * (non-Javadoc)
108 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getItemHeight(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)
109 */
110 @Override
111 public int getItemHeight(ITimeGraphEntry entry) {
112 return DEFAULT_ITEM_HEIGHT;
113 }
114
115 /*
116 * (non-Javadoc)
117 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#getTraceClassName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)
118 */
119 @Override
120 public String getTraceClassName(ITimeGraphEntry trace) {
121 return null;
122 }
123
124 /* (non-Javadoc)
125 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#getEventName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
126 */
127 @Override
128 public abstract String getEventName(ITimeEvent event);
129
130 /*
131 * (non-Javadoc)
132 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#composeTraceName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry, boolean)
133 */
134 @Override
135 public String composeTraceName(ITimeGraphEntry trace, boolean inclState) {
136 String name = trace.getName();
137 String threadClass = getTraceClassName(trace);
138 if (threadClass != null && threadClass.length() > 0) {
139 name += " [" + threadClass + "]"; //$NON-NLS-1$ //$NON-NLS-2$
140 }
141 return name;
142 }
143
144 /* (non-Javadoc)
145 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#composeEventName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
146 */
147 @Override
148 public String composeEventName(ITimeEvent event) {
149 String name = event.getEntry().getName();
150 String threadClass = getTraceClassName(event.getEntry());
151 if (threadClass != null && threadClass.length() > 0) {
152 name += " [" + threadClass + "]"; //$NON-NLS-1$ //$NON-NLS-2$
153 }
154 name += " (" + getEventName(event) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
155 return name;
156 }
157
158 /* (non-Javadoc)
159 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#getEventHoverToolTipInfo(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
160 */
161 @Override
162 public abstract Map<String, String> getEventHoverToolTipInfo(ITimeEvent event);
163
164 /* (non-Javadoc)
165 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphProvider#getItemImage(java.lang.Object)
166 */
167 @Override
168 public Image getItemImage(Object obj) {
169 return null;
170 }
171
172 }
This page took 0.039074 seconds and 5 git commands to generate.