Bug 378401: Implementation of time graph widget.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui.tests / widgetStubs / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / test / stub / adaption / TsfImplProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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 (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.adaption;
13
14 import java.util.HashMap;
15 import java.util.Map;
16
17 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphProvider;
18 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
19 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
20 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model.EventImpl;
21 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model.TraceImpl;
22
23 @SuppressWarnings("nls")
24 public class TsfImplProvider extends TimeGraphProvider {
25
26 // ========================================================================
27 // Methods
28 // ========================================================================
29 @Override
30 public StateColor getEventColor(ITimeEvent event) {
31 if (event instanceof EventImpl) {
32 EventImpl devent = (EventImpl) event;
33 switch (devent.getType()) {
34 case ALARM:
35 return StateColor.DARK_GREEN;
36 case ERROR:
37 return StateColor.DARK_YELLOW;
38 case EVENT:
39 return StateColor.MAGENTA3;
40 case INFORMATION:
41 return StateColor.PURPLE1;
42 case TIMEADJUSTMENT:
43 return StateColor.PINK1;
44 case WARNING:
45 return StateColor.AQUAMARINE;
46 case INFO1:
47 return StateColor.RED;
48 case INFO2:
49 return StateColor.GREEN;
50 case INFO3:
51 return StateColor.DARK_BLUE;
52 case INFO4:
53 return StateColor.GOLD;
54 case INFO5:
55 return StateColor.ORANGE;
56 case INFO6:
57 return StateColor.GRAY;
58 case INFO7:
59 return StateColor.LIGHT_BLUE;
60 case INFO8:
61 return StateColor.CADET_BLUE;
62 case INFO9:
63 return StateColor.OLIVE;
64 }
65 }
66 return StateColor.BLACK;
67 }
68
69 @Override
70 public String getStateName(StateColor color) {
71 switch (color) {
72 case GOLD:
73 return "ALARM";
74 case RED:
75 return "ERROR";
76 case DARK_BLUE:
77 return "EVENT";
78 case GREEN:
79 return "INFORMATION";
80 case GRAY:
81 return "TIME ADJUSTMENT DKDKDKDKL";
82 case ORANGE:
83 return "WARNING";
84 default:
85 return "UNKNOWN";
86 }
87 }
88
89 @Override
90 public Map<String, String> getEventHoverToolTipInfo(ITimeEvent revent) {
91 Map<String, String> toolTipEventMsgs = new HashMap<String, String>();
92 if (revent instanceof EventImpl) {
93 toolTipEventMsgs.put("Test Tip1", "Test Value tip1");
94 toolTipEventMsgs.put("Test Tip2", "Test Value tip2");
95 }
96
97 return toolTipEventMsgs;
98 }
99
100 @Override
101 public String getEventName(ITimeEvent event, boolean upper, boolean extInfo) {
102 String name = "Unknown";
103 if (event instanceof EventImpl) {
104 EventImpl devent = (EventImpl) event;
105 name = devent.getType().toString();
106 }
107 return name;
108 }
109
110 @Override
111 public String getTraceClassName(ITimeGraphEntry trace) {
112 String name = "";
113 if (trace instanceof TraceImpl) {
114 TraceImpl dTrace = (TraceImpl) trace;
115 name = dTrace.getClassName();
116 }
117 return name;
118 }
119 }
This page took 0.036143 seconds and 6 git commands to generate.