TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.hyades.ui.widgets.zoomslider
Class ZoomSlider

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by org.eclipse.hyades.ui.widgets.zoomslider.ZoomSlider
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
TimeZoomSlider

public class ZoomSlider
extends org.eclipse.swt.widgets.Canvas

A ruler-like widget representing a data range. The data range that the widget operates over is defined by the maxLimit and minLimit configuration settings. The widget will show data that is outside this range. The visible range, that is the data that is currently shown on the widget, is set by the minVisible and maxVisible configuration settings.

Mouse interactions allow the widget to be zoomed or transposed. Zooming narrows the currently visible data range, and transposing transposes the current visible range within the maximum and minimum configuration limits.

Zoomsliders also support controls on the zoomslider (ZoomControlBar) and current indicator lines (ZoomIndicator). The Zoomslider holds all controls and indicators in collections. Both are optional.


Field Summary
static int BOTTOM
          The constant representing the bottom of the slider
static int DECREASING
          The increasing slider direction constant
static int HORIZONTAL
          The horizontal slider orientation constant
static int INCREASING
          The increasing slider direction constant
static int MAX
          The maximum end constant for this slider
static int MAX_TICKWIDTH
          The maximum tick width constant
static int MIN
          The minimum end constant for this slider
static int MIN_TICKWIDTH
          The minimum tick width constant
static int TOP
          The constant representing the top of the slider
static int VERTICAL
          The vertical slider orientation constant
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
ZoomSlider(org.eclipse.swt.widgets.Composite parent)
          ZoomSlider constructor with no preset limit configuration
ZoomSlider(org.eclipse.swt.widgets.Composite parent, double minLimit, double maxLimit, double minVisible, double maxVisible, double resolution)
          Construct a ZoomSlider with an initial limits configuration
 
Method Summary
 void addZoomControlBar(double value)
          Instantiate and add a ZoomControlBar to this ZoomSlider with a preset initial value
 void addZoomControlBar(ZoomControlBar bar)
          Add a provided ZoomControlBar to this ZoomSlider
 void addZoomIndicator(ZoomIndicator indicator)
          Add a Zoom Indicator to this slider's indicators collection
 void addZoomSliderListener(ZoomSliderListener listener)
          Add a ZoomSliderListener to the list of listeners for this slider
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
           
 void configure(double minLimit, double maxLimit, double minVisible, double maxVisible, double resolution)
          Configure a slider limits and resolution.
 void externalRepaint()
          Force a repaint of this component
 org.eclipse.swt.graphics.Color getBackground()
           
 int getDecimalPointPosition()
          Get the pixel position of the decimal point
 int getDirection()
          Get the direction constant, either increasing or decreasing
 ZoomSliderTick getFirstTick()
          Return the first ZoomSliderTick instance in the list of ticks
 int getFontHeight()
          Get the current font height that is used to render text on the slider
 org.eclipse.swt.graphics.Color getForeground()
           
 double getIncrement()
          Get the value spacing between ticks on the slider
 int getIncrementOOM()
          Get the order of magnitude of the value spacing between ticks
 int getIndent()
          Get the current slider indent
 ZoomSliderTick getLastTick()
          Return the last ZoomSliderTick instance in the list of ticks
 ZoomSliderTick getLastVisible()
          Get the last visible slider tick that is present on the slider
 double getMaxLimit()
          Get the maximum limit for this slider.
 double getMaxVisible()
          Get the maximum visible for this slider.
 double getMinLimit()
          Get the minimum limit for this slider.
 double getMinRange()
          Get the minimum pixel range relative to the resolution and current pixel range of this slider
 double getMinVisible()
          Get the minimum visible for this slider.
 int getOrientation()
          Get the current slider orientation.
 double getResolution()
          Get the current graph resolution
 java.util.Vector getTickVector()
          Get this ZoomSliders vector of ZoomSliderTicks
 java.lang.String getTitle()
          Get this slider's title
 org.eclipse.swt.graphics.Color getTitleColor()
          Get the color used for the slider title text
 org.eclipse.swt.graphics.Font getTitleFont()
          Get the current Font used to pain the slider title on the slider
 double getUnitIncrement()
          Get the value spacing between consecutive selectable positions on the scale
 ZoomControlBarsCollection getZoomControlBarsCollection()
          Get the ZoomControlBarsCollection for this slider
 ZoomIndicatorsCollection getZoomIndicatorsCollection()
          Get this ZoomSliders indicators collection
 boolean hasBars()
          Query whether this slider has any control bars
 boolean isChanging()
          Tells some visiting thread whether or not the scale is currently changing
 boolean isLocked(int end)
          Return whether the minimum or maximum of a slider is locked
 boolean isMinimized()
           
 boolean isTransposable()
          Return wheter this zoom slider is transposable
 boolean isZoomable()
          Return wheter this zoom slider is zoomable
 void layout()
           
 void lock(int end, boolean lock)
          Set the locked status of an end of the slider
 void paint(org.eclipse.swt.events.PaintEvent e)
          Paint this ZoomSlider control
 double pixel2Value(double pixelPos)
          Convert a given pixel position to its corresponding slider value
 void recreateScale()
          Recreate the scale on this zoom slider.
 void removeIndicator(ZoomIndicator indicator)
          Remove a Zoom Indicator from this slider's indicators collection
 void removeZoomControlBar(ZoomControlBar bar)
          Remove a provided ZoomControlBar to this ZoomSlider
 void removeZoomSliderListener(ZoomSliderListener listener)
          Remove a ZoomSliderListener from the list of listeners for this slider
 void resizeScale()
          Resize the slider ticks and indicators of this slider
 void setBackground(org.eclipse.swt.graphics.Color color)
           
 void setDirection(int direction)
          Set the direction of this slider
 void setFont(org.eclipse.swt.graphics.Font font)
           
 void setForeground(org.eclipse.swt.graphics.Color color)
           
 void setLastVisible(ZoomSliderTick tick)
          Set the last visible slider tick that is present on the slider
 void setMaxLimit(double d)
          Set the maximum limit for this slider.
 void setMaxVisible(double d)
          Set the maximum visible limit for this slider.
 void setMinimized(boolean minimized)
           
 void setMinLimit(double d)
          Set the maximum limit for this slider.
 void setMinVisible(double d)
          Set the minimum visible limit for this slider.
 void setOrientation(int orientation)
          Set the orientation of this slider
 void setResolution(double d)
          Set the resolution of this Zoom slider.
 void setTitle(java.lang.String title)
          Set this slider's title
 void setTitleColor(org.eclipse.swt.graphics.Color color)
          Set the color used for the slider title text
 void setTitleFont(org.eclipse.swt.graphics.Font font)
          Set the Font to be used to paint the slider title on the slider
 void setTransposable(boolean b)
          Set whether this slider is transposable or not
 void setZoomable(boolean b)
          Set whether this slider is zoomable or not
 void updateIndicators()
          Update the indicators on this slider
 void updateScale()
          Force a redraw of this ZoomSlider and update the scale of this slider
 double value2Pixel(double value)
          Convert a given slider value to its corresponding pixel value
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIME
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN

public static final int MIN
The minimum end constant for this slider

See Also:
Constant Field Values

MAX

public static final int MAX
The maximum end constant for this slider

See Also:
Constant Field Values

TOP

public static final int TOP
The constant representing the top of the slider

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
The constant representing the bottom of the slider

See Also:
Constant Field Values

MIN_TICKWIDTH

public static final int MIN_TICKWIDTH
The minimum tick width constant

See Also:
Constant Field Values

MAX_TICKWIDTH

public static final int MAX_TICKWIDTH
The maximum tick width constant

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
The vertical slider orientation constant

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
The horizontal slider orientation constant

See Also:
Constant Field Values

INCREASING

public static final int INCREASING
The increasing slider direction constant

See Also:
Constant Field Values

DECREASING

public static final int DECREASING
The increasing slider direction constant

See Also:
Constant Field Values
Constructor Detail

ZoomSlider

public ZoomSlider(org.eclipse.swt.widgets.Composite parent)
ZoomSlider constructor with no preset limit configuration

Parameters:
parent - the parent composite to place this ZoomSlider on

ZoomSlider

public ZoomSlider(org.eclipse.swt.widgets.Composite parent,
                  double minLimit,
                  double maxLimit,
                  double minVisible,
                  double maxVisible,
                  double resolution)
           throws ZoomSliderConfigurationException
Construct a ZoomSlider with an initial limits configuration

Parameters:
parent - the parent composite
minLimit - the minimum value limit of this slider
maxLimit - the maximum value limit of this slider
minVisible - the minimum visible limit of this slider
maxVisible - the maximum visible limit of this slider
resolution - the slider resolution
Throws:
ZoomSliderConfigurationException - if the configuration limits presented are not valid for this zoomslider
Method Detail

addZoomControlBar

public void addZoomControlBar(double value)
Instantiate and add a ZoomControlBar to this ZoomSlider with a preset initial value

Parameters:
value - the initial value of the control bar

addZoomControlBar

public void addZoomControlBar(ZoomControlBar bar)
Add a provided ZoomControlBar to this ZoomSlider

Parameters:
bar - the ZoomControlBar to add to this slider's control collection

removeZoomControlBar

public void removeZoomControlBar(ZoomControlBar bar)
Remove a provided ZoomControlBar to this ZoomSlider

Parameters:
bar - the ZoomControlBar to remove from this slider's control collection

hasBars

public boolean hasBars()
Query whether this slider has any control bars

Returns:
true if this slider has at least one control bar, false otherwise

getZoomControlBarsCollection

public ZoomControlBarsCollection getZoomControlBarsCollection()
Get the ZoomControlBarsCollection for this slider

Returns:
an instance of ZoomControlBarsCollection referencing all the ZoomControlBars for this slider

addZoomIndicator

public void addZoomIndicator(ZoomIndicator indicator)
Add a Zoom Indicator to this slider's indicators collection

Parameters:
indicator - ZoomIndicator to add to the collection

removeIndicator

public void removeIndicator(ZoomIndicator indicator)
Remove a Zoom Indicator from this slider's indicators collection

Parameters:
indicator - ZoomIndicator to remove

getZoomIndicatorsCollection

public ZoomIndicatorsCollection getZoomIndicatorsCollection()
Get this ZoomSliders indicators collection

Returns:
this slider's ZoomIndicatorsCollection instance

getTickVector

public java.util.Vector getTickVector()
Get this ZoomSliders vector of ZoomSliderTicks

Returns:
a vector of ZoomSliderTick instances

getFirstTick

public ZoomSliderTick getFirstTick()
Return the first ZoomSliderTick instance in the list of ticks

Returns:
the first ZoomSliderTick, or null if the list is empty

getLastTick

public ZoomSliderTick getLastTick()
Return the last ZoomSliderTick instance in the list of ticks

Returns:
the last ZoomSliderTick or null if the list is empty

paint

public void paint(org.eclipse.swt.events.PaintEvent e)
Paint this ZoomSlider control

Parameters:
e - the associated repaint event

updateScale

public void updateScale()
Force a redraw of this ZoomSlider and update the scale of this slider


recreateScale

public void recreateScale()
Recreate the scale on this zoom slider. Reinitialize all ticks on the slider and force a redraw


updateIndicators

public void updateIndicators()
Update the indicators on this slider


externalRepaint

public void externalRepaint()
Force a repaint of this component


resizeScale

public void resizeScale()
Resize the slider ticks and indicators of this slider


layout

public void layout()
Overrides:
layout in class org.eclipse.swt.widgets.Composite

setFont

public void setFont(org.eclipse.swt.graphics.Font font)
Overrides:
setFont in class org.eclipse.swt.widgets.Canvas

pixel2Value

public double pixel2Value(double pixelPos)
Convert a given pixel position to its corresponding slider value

Parameters:
pixelPos - the pixel position on this slider
Returns:
the corresponding value at this pixel position

value2Pixel

public double value2Pixel(double value)
Convert a given slider value to its corresponding pixel value

Parameters:
value - the slider position on this slider
Returns:
the corresponding pixel position

getIncrement

public double getIncrement()
Get the value spacing between ticks on the slider

Returns:
the space between ticks

getIncrementOOM

public int getIncrementOOM()
Get the order of magnitude of the value spacing between ticks

Returns:
an int representing the order of magnitude

getUnitIncrement

public double getUnitIncrement()
Get the value spacing between consecutive selectable positions on the scale

Returns:
the value spacing

getDecimalPointPosition

public int getDecimalPointPosition()
Get the pixel position of the decimal point

Returns:
the pixel position of the decimal point

getIndent

public int getIndent()
Get the current slider indent

Returns:
the slider indent in pixels

getFontHeight

public int getFontHeight()
Get the current font height that is used to render text on the slider

Returns:
the fontHeight in pixels

isChanging

public boolean isChanging()
Tells some visiting thread whether or not the scale is currently changing

Returns:
a boolean of true if the slider is currently changing

computeSize

public org.eclipse.swt.graphics.Point computeSize(int wHint,
                                                  int hHint,
                                                  boolean changed)
Overrides:
computeSize in class org.eclipse.swt.widgets.Composite

configure

public void configure(double minLimit,
                      double maxLimit,
                      double minVisible,
                      double maxVisible,
                      double resolution)
               throws ZoomSliderConfigurationException
Configure a slider limits and resolution. This method superseeds the getMaxLimit, getMinLimit, getMaxVisible, getMinVisible as it allows you to configure multiple limits at a single time. Only once all the limits have been set will the configuration be checked.

Parameters:
minLimit - the minimum limit for this slider
maxLimit - the maximum limit for this slider
minVisible - the minimum visible limit for this slider
maxVisible - the maximum visible limit for this slider
resolution - the resolution for this slider
Throws:
ZoomSliderConfigurationException - if the new configuration is invalid

setTitle

public void setTitle(java.lang.String title)
Set this slider's title

Parameters:
title - a new string to be used as the title of this slider

getTitle

public java.lang.String getTitle()
Get this slider's title

Returns:
a string representation of this sliders title

setTitleColor

public void setTitleColor(org.eclipse.swt.graphics.Color color)
Set the color used for the slider title text

Parameters:
color - the new title color

getTitleColor

public org.eclipse.swt.graphics.Color getTitleColor()
Get the color used for the slider title text

Returns:
the title color

setTitleFont

public void setTitleFont(org.eclipse.swt.graphics.Font font)
Set the Font to be used to paint the slider title on the slider

Parameters:
font - the new Font to be used to pain the slider title on the slider

getTitleFont

public org.eclipse.swt.graphics.Font getTitleFont()
Get the current Font used to pain the slider title on the slider

Returns:
the Font used to paint the slider title

setForeground

public void setForeground(org.eclipse.swt.graphics.Color color)
Overrides:
setForeground in class org.eclipse.swt.widgets.Control

getForeground

public org.eclipse.swt.graphics.Color getForeground()
Overrides:
getForeground in class org.eclipse.swt.widgets.Control

setBackground

public void setBackground(org.eclipse.swt.graphics.Color color)
Overrides:
setBackground in class org.eclipse.swt.widgets.Control

getBackground

public org.eclipse.swt.graphics.Color getBackground()
Overrides:
getBackground in class org.eclipse.swt.widgets.Control

setMaxVisible

public void setMaxVisible(double d)
                   throws ZoomSliderConfigurationException
Set the maximum visible limit for this slider. The slider will data between the minimum and maximum visible limits

Parameters:
d - the maximum visible limit of this slider
Throws:
ZoomSliderConfigurationException - if the new visible maximum results in an invalid slider configuration

getMaxVisible

public double getMaxVisible()
Get the maximum visible for this slider. The slider will data between the minimum and maximum visible limits

Returns:
the maximum limit of this slider

setMinVisible

public void setMinVisible(double d)
                   throws ZoomSliderConfigurationException
Set the minimum visible limit for this slider. The slider will data between the minimum and maximum visible limits

Parameters:
d - the minimum visible limit of this slider
Throws:
ZoomSliderConfigurationException - if the new visible minimum results in an invalid slider configuration

getMinVisible

public double getMinVisible()
Get the minimum visible for this slider. The slider will data between the minimum and maximum visible limits

Returns:
the minimum limit of this slider

setMaxLimit

public void setMaxLimit(double d)
                 throws ZoomSliderConfigurationException
Set the maximum limit for this slider. The slider will display no values beyond this limit

Parameters:
d - the maximum limit of this slider
Throws:
ZoomSliderConfigurationException - if the new maximum results in an invalid slider configuration

getMaxLimit

public double getMaxLimit()
Get the maximum limit for this slider. The slider will display no values below this limit

Returns:
the maximum limit of this slider

setMinLimit

public void setMinLimit(double d)
                 throws ZoomSliderConfigurationException
Set the maximum limit for this slider. The slider will display no values below this limit

Parameters:
d - the minimum limit of this slider
Throws:
ZoomSliderConfigurationException - if the new minimum results in an invalid slider configuration

getMinLimit

public double getMinLimit()
Get the minimum limit for this slider. The slider will display no values below this limit

Returns:
the minimum limit of this slider

setResolution

public void setResolution(double d)
                   throws ZoomSliderConfigurationException
Set the resolution of this Zoom slider.

Parameters:
d - the resolution value you wish to set for this slider
Throws:
ZoomSliderConfigurationException - if this resolution results in an invalid Zoom Slider configuration

getResolution

public double getResolution()
Get the current graph resolution

Returns:
the resolution double

setDirection

public void setDirection(int direction)
                  throws ZoomSliderConfigurationException
Set the direction of this slider

Parameters:
direction - the direction constant, either INCREASING or DESCREASING
Throws:
ZoomSliderConfigurationException - if altering the direction of the slider results in an invalid slider configuration
See Also:
INCREASING, DECREASING

getDirection

public int getDirection()
Get the direction constant, either increasing or decreasing

Returns:
the slider direction constant
See Also:
INCREASING, DECREASING

setOrientation

public void setOrientation(int orientation)
                    throws ZoomSliderConfigurationException
Set the orientation of this slider

Parameters:
orientation - the orientation constant for this slider, either VERTICAL or HORIZONTAL
Throws:
ZoomSliderConfigurationException - if this orientation causes the current slider configuration to be invalid
See Also:
HORIZONTAL, VERTICAL

getOrientation

public int getOrientation()
Get the current slider orientation. The orientation is either horizontal or vertical, stipulated by the HORIZONTAL or VERTICAL constants

Returns:
an integer constant, either VERTICAL or HORIZONTAL
See Also:
HORIZONTAL, VERTICAL

lock

public void lock(int end,
                 boolean lock)
Set the locked status of an end of the slider

Parameters:
end - a constant defining which end is queried for lock status
lock - a boolean of true if the end should be locked, and false otherwise
See Also:
MIN, MAX

isLocked

public boolean isLocked(int end)
Return whether the minimum or maximum of a slider is locked

Parameters:
end - a constant defining which end is queried for lock status
Returns:
a boolean of true if the slider end is locked, or false otherwise
See Also:
MIN, MAX

setZoomable

public void setZoomable(boolean b)
Set whether this slider is zoomable or not

Parameters:
b - a boolean indicating whether this slider is zoomable or not

isZoomable

public boolean isZoomable()
Return wheter this zoom slider is zoomable

Returns:
true if the slider is zoomable or false if not

setTransposable

public void setTransposable(boolean b)
Set whether this slider is transposable or not

Parameters:
b - a boolean indicating whether this slider is transposable

isTransposable

public boolean isTransposable()
Return wheter this zoom slider is transposable

Returns:
true if the slider is transposable or false if not

setLastVisible

public void setLastVisible(ZoomSliderTick tick)
Set the last visible slider tick that is present on the slider

Parameters:
tick - to set to the last ZoomSliderTick

getLastVisible

public ZoomSliderTick getLastVisible()
Get the last visible slider tick that is present on the slider

Returns:
the last ZoomSliderTick

getMinRange

public double getMinRange()
Get the minimum pixel range relative to the resolution and current pixel range of this slider

Returns:
the current minimum slider range

addZoomSliderListener

public void addZoomSliderListener(ZoomSliderListener listener)
Add a ZoomSliderListener to the list of listeners for this slider

Parameters:
listener - the ZoomSliderListener to get added to the list of ZoomSliderListeners

removeZoomSliderListener

public void removeZoomSliderListener(ZoomSliderListener listener)
Remove a ZoomSliderListener from the list of listeners for this slider

Parameters:
listener - the ZoomSliderListener to remove from the list of ZoomSliderListeners

isMinimized

public boolean isMinimized()

setMinimized

public void setMinimized(boolean minimized)

TPTP 4.5.0 Platform Project
Public API Specification