tmf: Handle 'null' active pages in views
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / histogram / TimeRangeHistogram.java
index bf8e2030fb6f66815071b6fc5487aefe562f8bef..c747f4e984b1e95fd9b58ef5c0315f5cf05bca20 100644 (file)
@@ -1,14 +1,14 @@
 /*******************************************************************************
  * Copyright (c) 2011, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
- *   Bernd Hufmann - Changed to updated histogram data model   
+ *   Bernd Hufmann - Changed to updated histogram data model
  *   Francois Chouinard - Moved from LTTng to TMF
  *******************************************************************************/
 
@@ -17,13 +17,15 @@ package org.eclipse.linuxtools.tmf.ui.views.histogram;
 import org.eclipse.swt.widgets.Composite;
 
 /**
- * <b><u>TimeRangeHistogram</u></b>
- * <p>
- * A basic histogram with the following additional features:
+ * A basic histogram widget that displays the event distribution of a specific time range of a trace.
+ * It has the following additional features:
  * <ul>
  * <li>zoom in: mouse wheel up (or forward)
  * <li>zoom out: mouse wheel down (or backward)
  * </ul>
+ *
+ * @version 1.1
+ * @author Francois Chouinard
  */
 public class TimeRangeHistogram extends Histogram {
 
@@ -31,12 +33,16 @@ public class TimeRangeHistogram extends Histogram {
     // Attributes
     // ------------------------------------------------------------------------
 
-    HistogramZoom fZoom = null;
+    private HistogramZoom fZoom = null;
 
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
-
+    /**
+     * Constructor
+     * @param view The parent histogram view
+     * @param parent The parent composite
+     */
     public TimeRangeHistogram(HistogramView view, Composite parent) {
         super(view, parent);
         fZoom = new HistogramZoom(this, fCanvas, getStartTime(), getTimeLimit());
@@ -46,22 +52,42 @@ public class TimeRangeHistogram extends Histogram {
     // Operations
     // ------------------------------------------------------------------------
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.histogram.Histogram#updateTimeRange(long, long)
+     */
     @Override
     public void updateTimeRange(long startTime, long endTime) {
         ((HistogramView) fParentView).updateTimeRange(startTime, endTime);
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.histogram.Histogram#clear()
+     */
     @Override
     public synchronized void clear() {
-        if (fZoom != null)
+        if (fZoom != null) {
             fZoom.stop();
+        }
         super.clear();
     }
 
+    /**
+     * Sets the time range of the histogram
+     * @param startTime The start time
+     * @param duration The duration of the time range
+     */
     public synchronized void setTimeRange(long startTime, long duration) {
         fZoom.setNewRange(startTime, duration);
+        getDataModel().setTimeRange(startTime, startTime + duration);
     }
 
+    /**
+     * Sets the full time range of the whole trace.
+     * @param startTime The start time
+     * @param endTime The end time
+     */
     public void setFullRange(long startTime, long endTime) {
         long currentFirstEvent = getStartTime();
         fZoom.setFullRange((currentFirstEvent == 0) ? startTime : currentFirstEvent, endTime);
This page took 0.025671 seconds and 5 git commands to generate.