Merge branch 'master' into lttng_2_0_control_dev
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / histogram / TimeRangeHistogram.java
1 /*******************************************************************************
2 * Copyright (c) 2011, 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 * Francois Chouinard - Initial API and implementation
11 * Bernd Hufmann - Changed to updated histogram data model
12 * Francois Chouinard - Moved from LTTng to TMF
13 *******************************************************************************/
14
15 package org.eclipse.linuxtools.tmf.ui.views.histogram;
16
17 import org.eclipse.swt.widgets.Composite;
18
19 /**
20 * <b><u>TimeRangeHistogram</u></b>
21 * <p>
22 * A basic histogram with the following additional features:
23 * <ul>
24 * <li>zoom in: mouse wheel up (or forward)
25 * <li>zoom out: mouse wheel down (or backward)
26 * </ul>
27 */
28 public class TimeRangeHistogram extends Histogram {
29
30 // ------------------------------------------------------------------------
31 // Attributes
32 // ------------------------------------------------------------------------
33
34 HistogramZoom fZoom = null;
35
36 // ------------------------------------------------------------------------
37 // Constructor
38 // ------------------------------------------------------------------------
39
40 public TimeRangeHistogram(HistogramView view, Composite parent) {
41 super(view, parent);
42 fZoom = new HistogramZoom(this, fCanvas, getStartTime(), getTimeLimit());
43 }
44
45 // ------------------------------------------------------------------------
46 // Operations
47 // ------------------------------------------------------------------------
48
49 @Override
50 public void updateTimeRange(long startTime, long endTime) {
51 ((HistogramView) fParentView).updateTimeRange(startTime, endTime);
52 }
53
54 @Override
55 public synchronized void clear() {
56 if (fZoom != null)
57 fZoom.stop();
58 super.clear();
59 }
60
61 public synchronized void setTimeRange(long startTime, long duration) {
62 fZoom.setNewRange(startTime, duration);
63 }
64
65 @Override
66 public void setFullRange(long startTime, long endTime) {
67 long currentFirstEvent = getStartTime();
68 fZoom.setFullRange((currentFirstEvent == 0) ? startTime : currentFirstEvent, endTime);
69 }
70
71 }
This page took 0.033625 seconds and 6 git commands to generate.