1 /*******************************************************************************
2 * Copyright (c) 2011, 2012 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 * Francois Chouinard - Initial API and implementation
11 * Bernd Hufmann - Changed to updated histogram data model
12 * Francois Chouinard - Moved from LTTng to TMF
13 *******************************************************************************/
15 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.histogram
;
17 import org
.eclipse
.swt
.widgets
.Composite
;
20 * A basic histogram widget that displays the event distribution of a specific time range of a trace.
21 * It has the following additional features:
23 * <li>zoom in: mouse wheel up (or forward)
24 * <li>zoom out: mouse wheel down (or backward)
28 * @author Francois Chouinard
30 public class TimeRangeHistogram
extends Histogram
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 private HistogramZoom fZoom
= null;
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
43 * @param view The parent histogram view
44 * @param parent The parent composite
46 public TimeRangeHistogram(HistogramView view
, Composite parent
) {
48 fZoom
= new HistogramZoom(this, fCanvas
, getStartTime(), getTimeLimit());
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
57 * @see org.eclipse.linuxtools.tmf.ui.views.histogram.Histogram#updateTimeRange(long, long)
60 public void updateTimeRange(long startTime
, long endTime
) {
61 ((HistogramView
) fParentView
).updateTimeRange(startTime
, endTime
);
66 * @see org.eclipse.linuxtools.tmf.ui.views.histogram.Histogram#clear()
69 public synchronized void clear() {
71 fZoom
.setFullRange(0L, 0L);
72 fZoom
.setNewRange(0L, 0L);
78 * Sets the time range of the histogram
79 * @param startTime The start time
80 * @param duration The duration of the time range
82 public synchronized void setTimeRange(long startTime
, long duration
) {
83 fZoom
.setNewRange(startTime
, duration
);
84 if (getDataModel().getNbEvents() == 0) {
85 getDataModel().setTimeRange(startTime
, startTime
+ duration
);
90 * Sets the full time range of the whole trace.
91 * @param startTime The start time
92 * @param endTime The end time
94 public void setFullRange(long startTime
, long endTime
) {
95 long currentFirstEvent
= getStartTime();
96 fZoom
.setFullRange((currentFirstEvent
== 0) ? startTime
: currentFirstEvent
, endTime
);
This page took 0.032018 seconds and 5 git commands to generate.