Class RangeWidget

All Implemented Interfaces:
Drawable

public class RangeWidget extends Canvas
Widget that display a range (currently only time, and only vertical) which can be modified using a mouse drag.
  • Constructor Details

    • RangeWidget

      public RangeWidget(Composite parent, int style)
      A new range widget.
      Parameters:
      parent - parent component
      style - SWT style
  • Method Details

    • addRangeListener

      public void addRangeListener(RangeListener listener)
      Adds a listener, notified if the range resolution changes.
    • removeRangeListener

      public void removeRangeListener(RangeListener listener)
    • setStartPosition

      public void setStartPosition(int startPosition)
      Determines whether the range start at the top (and goes down) or at the bottom (and goes up).
      Parameters:
      startPosition - SWT.TOP or SWT.BOTTOM
    • getStartPosition

      public int getStartPosition()
      Whether the range starts at the top or at the bottom.
      Returns:
      SWT.TOP or SWT.BOTTOM
    • isEditable

      public boolean isEditable()
      Whether the use can use the mouse to change the resolution.
      Returns:
      true if user changes are allowed
    • setEditable

      public void setEditable(boolean editable)
      Changes whether the use can use the mouse to change the resolution.
      Parameters:
      editable - true if user changes are allowed
    • setDistancePerPx

      public void setDistancePerPx(double distancePerPx)
      Changes how much distance is represented by each pixel. For example, 1 ms per pixel or 20 seconds per pixel. The distance is expressed in seconds.
      Parameters:
      distancePerPx - seconds (or fraction) represented by each pixel
    • getDistancePerPx

      public double getDistancePerPx()
      Distance represented by each pixel (e.g. 10 ms per pixel).
      Returns:
      seconds (or fraction) represented by each pixel