org.csstudio.ui.util.widgets
Class RangeWidget

java.lang.Object
  extended by Canvas
      extended by org.csstudio.ui.util.widgets.RangeWidget

public class RangeWidget
extends Canvas

Widget that display a range (currently only time, and only vertical) which can be modified using a mouse drag.

Author:
carcassi

Constructor Summary
RangeWidget(Composite parent, int style)
          A new range widget.
 
Method Summary
 void addRangeListener(RangeListener listener)
          Adds a listener, notified if the range resolution changes.
 double getDistancePerPx()
          Distance represented by each pixel (e.g.
 int getStartPosition()
          Whether the range starts at the top or at the bottom.
 boolean isEditable()
          Whether the use can use the mouse to change the resolution.
 void removeRangeListener(RangeListener listener)
          Removes a listener.
 void setDistancePerPx(double distancePerPx)
          Changes how much distance is represented by each pixel.
 void setEditable(boolean editable)
          Changes whether the use can use the mouse to change the resolution.
 void setStartPosition(int startPosition)
          Determines whether the range start at the top (and goes down) or at the bottom (and goes up).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeWidget

public RangeWidget(Composite parent,
                   int style)
A new range widget.

Parameters:
parent - parent component
style - SWT style
Method Detail

addRangeListener

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

Parameters:
listener - a new listener

removeRangeListener

public void removeRangeListener(RangeListener listener)
Removes a listener.

Parameters:
listener - listener to be removed

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