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