Commit | Line | Data |
---|---|---|
fbd124dd BH |
1 | /******************************************************************************* |
2 | * Copyright (c) 2011 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 | * Bernd Hufmann - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.ui.views.latency.listeners; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.ui.views.latency.GraphViewer; | |
15 | import org.eclipse.linuxtools.lttng.ui.views.latency.model.LatencyGraphModel; | |
16 | ||
17 | /** | |
18 | * <b><u>GraphMouseListener</u></b> | |
19 | * <p> | |
20 | */ | |
21 | public class GraphMouseListener extends AbstractMouseListener { | |
22 | ||
23 | // ------------------------------------------------------------------------ | |
24 | // Attributes | |
25 | // ------------------------------------------------------------------------ | |
26 | ||
27 | /** | |
28 | * A reference to the observed view. | |
29 | */ | |
30 | protected GraphViewer fView; | |
31 | ||
32 | /** | |
33 | * A reference to the HistogramPaintListener. | |
34 | */ | |
35 | protected GraphPaintListener fGraph; | |
36 | ||
37 | // ------------------------------------------------------------------------ | |
38 | // Constructor | |
39 | // ------------------------------------------------------------------------ | |
40 | ||
41 | /** | |
42 | * Constructor. | |
43 | * @param view | |
44 | * A reference to the observed view. | |
45 | * @param histogramPaintListener | |
46 | * A reference to the histogram's paintListener. | |
47 | */ | |
48 | public GraphMouseListener(GraphViewer view, GraphPaintListener graphPaintListener) { | |
49 | fView = view; | |
50 | fGraph = graphPaintListener; | |
51 | } | |
52 | ||
53 | // ------------------------------------------------------------------------ | |
54 | // Accessors | |
55 | // ------------------------------------------------------------------------ | |
56 | ||
57 | // ------------------------------------------------------------------------ | |
58 | // Operations | |
59 | // ------------------------------------------------------------------------ | |
60 | ||
61 | /* | |
62 | * (non-Javadoc) | |
63 | * @see org.eclipse.linuxtools.lttng.ui.views.latency.listeners.AbstractMouseListener#display() | |
64 | */ | |
65 | @Override | |
66 | protected void display() { | |
67 | long currentTime = fGraph.getCurrentTimeFromHorizontalValue(fMouseX); | |
68 | ((LatencyGraphModel)fView.getModel()).setCurrentEventNotifyListeners(currentTime); | |
69 | } | |
70 | } |