|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.cpp.pi.power; |
|
19 |
|
20 import java.awt.Color; |
|
21 import java.awt.Graphics; |
|
22 import java.awt.event.MouseEvent; |
|
23 import java.awt.event.MouseListener; |
|
24 import java.awt.event.MouseMotionListener; |
|
25 import java.util.Enumeration; |
|
26 |
|
27 import org.eclipse.draw2d.FigureCanvas; |
|
28 import org.eclipse.draw2d.Panel; |
|
29 import org.eclipse.swt.graphics.GC; |
|
30 |
|
31 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTrace; |
|
32 import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph; |
|
33 |
|
34 |
|
35 public class PwrTraceGraph extends GenericTraceGraph implements MouseMotionListener, MouseListener |
|
36 { |
|
37 private boolean selected = true; |
|
38 |
|
39 public PwrTraceGraph(PwrTrace trace) |
|
40 { |
|
41 super(trace); |
|
42 } |
|
43 |
|
44 public void paint(Graphics g) |
|
45 { |
|
46 if(!selected) return; |
|
47 |
|
48 Enumeration samples = ((GenericSampledTrace)this.getTrace()).samples.elements(); |
|
49 g.setColor(Color.RED); |
|
50 |
|
51 while(samples.hasMoreElements()) |
|
52 { |
|
53 } |
|
54 } |
|
55 |
|
56 public void repaint() |
|
57 { |
|
58 } |
|
59 |
|
60 public void refreshDataFromTrace() |
|
61 { |
|
62 } |
|
63 |
|
64 public void mouseMoved(MouseEvent me) |
|
65 { |
|
66 if(!selected) return; |
|
67 |
|
68 Enumeration samples = ((GenericSampledTrace)this.getTrace()).samples.elements(); |
|
69 while(samples.hasMoreElements()) |
|
70 { |
|
71 } |
|
72 } |
|
73 |
|
74 public void mouseClicked(MouseEvent me) //add custom tooltip to a pwrtrace tag |
|
75 { |
|
76 if(!selected || me.getClickCount() < 2) return; |
|
77 |
|
78 |
|
79 Enumeration samples = ((GenericSampledTrace)this.getTrace()).samples.elements(); |
|
80 while(samples.hasMoreElements()) |
|
81 { |
|
82 } |
|
83 } |
|
84 |
|
85 public void action(String action) |
|
86 { |
|
87 if(action.equals("pwrsel_selected")) //$NON-NLS-1$ |
|
88 { |
|
89 this.selected = true; |
|
90 this.repaint(); |
|
91 } |
|
92 else if(action.equals("pwrsel_not_selected")) //$NON-NLS-1$ |
|
93 { |
|
94 this.selected = false; |
|
95 this.repaint(); |
|
96 } |
|
97 } |
|
98 |
|
99 public void mouseDragged(MouseEvent arg0) {} |
|
100 |
|
101 public void mouseEntered(MouseEvent arg0) {} |
|
102 |
|
103 public void mouseExited(MouseEvent arg0) {} |
|
104 |
|
105 public void mousePressed(MouseEvent arg0) {} |
|
106 |
|
107 public void mouseReleased(MouseEvent arg0) {} |
|
108 |
|
109 /* (non-Javadoc) |
|
110 * @see com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph#paint(org.eclipse.draw2d.Panel, org.eclipse.draw2d.Graphics) |
|
111 */ |
|
112 @Override |
|
113 public void paint(Panel panel, org.eclipse.draw2d.Graphics graphics) { |
|
114 this.setSize(this.getSize().width, getVisualSize().height); |
|
115 } |
|
116 |
|
117 public void paintLeftLegend(FigureCanvas figureCanvas, GC gc) { |
|
118 } |
|
119 } |