1 /*******************************************************************************
2 * Copyright (c) 2010, 2011 Ericsson
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
10 * Philippe Sawicki (INF4990.A2010@gmail.com) - Initial API and implementation
11 * Mathieu Denis (mathieu.denis55@gmail.com) - Refactored code
12 * Bernd Hufmann - Adapted to new model-view-controller design
13 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
;
16 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
.listeners
.GraphMouseListener
;
17 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
.listeners
.GraphPaintListener
;
18 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
.listeners
.TimePointerListener
;
19 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
.model
.IGraphDataModel
;
20 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
.model
.IGraphModelListener
;
21 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.views
.latency
.model
.LatencyGraphModel
;
22 import org
.eclipse
.swt
.widgets
.Composite
;
25 * <b><u>GraphViewer</u></b>
29 * @author Philippe Sawicki
31 public class GraphViewer
extends AbstractViewer
implements IGraphModelListener
{
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
40 private LatencyGraphModel fModel
;
42 // ------------------------------------------------------------------------
44 // ------------------------------------------------------------------------
48 * @param parent The parent composite node.
49 * @param style The SWT style to use to render the view.
51 public GraphViewer(Composite parent
, int style
) {
54 // Register the paint listener
55 fPaintListener
= new GraphPaintListener(this);
56 addPaintListener(fPaintListener
);
58 // Register the mouse track listener
59 fMouseTraceListener
= new TimePointerListener(this, (GraphPaintListener
)fPaintListener
);
60 addMouseTrackListener(fMouseTraceListener
);
62 // Register mouse listener
63 fMouseListener
= new GraphMouseListener(this, (GraphPaintListener
)fPaintListener
);
64 addMouseListener(fMouseListener
);
66 fModel
= new LatencyGraphModel();
67 fModel
.addGraphModelListener(this);
70 // ------------------------------------------------------------------------
72 // ------------------------------------------------------------------------
76 * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#dispose()
79 public void dispose() {
80 fModel
.removeGraphModelListener(this);
81 fPaintListener
.dispose();
87 * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clear()
91 fPaintListener
.clear();
96 * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#clearBackground()
99 public void clearBackground() {
100 fPaintListener
.clear();
105 * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#increaseBarWidth()
108 public void increaseBarWidth() {
109 fPaintListener
.increaseBarWitdh();
115 * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#decreaseBarWidth()
118 public void decreaseBarWidth() {
119 fPaintListener
.decreaseBarWitdh();
125 * @see org.eclipse.linuxtools.lttng.ui.views.latency.AbstractViewer#getModel()
128 public IGraphDataModel
getModel() {
134 * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#graphModelUpdated()
137 public void graphModelUpdated() {
138 if (!isDisposed() && getDisplay() != null) {
139 getDisplay().asyncExec(new Runnable() {
152 * @see org.eclipse.linuxtools.lttng.ui.views.latency.model.IGraphModelListener#currentEventUpdated()
155 public void currentEventUpdated(long currentEventTime
) {
This page took 0.050407 seconds and 5 git commands to generate.