Class YAHOO.widget.Slider

Object
   |
   +--YAHOO.util.DragDrop
         |
         +--YAHOO.widget.Slider

class YAHOO.widget.Slider
extends YAHOO.util.DragDrop

Field Summary [top]

boolean animate
Flag that determines if the thumb will animate when moved 
int[] baselinePos
The basline position of the background element, used to determine if the background has moved since the last operation. 
YAHOO.widget.Slider thumb
a YAHOO.widget.SliderThumb instance that we will use to reposition the thumb when the background is clicked 
Coordinate thumbCenterPoint
the center of the slider element is stored so we can position place it in the correct position when the background is clicked 
int tickPause
Adjustment factor for tick animation, the more ticks, the faster the animation (by default) 
Object ANIM_AVAIL
 

Constructor Summary [top]

YAHOO.widget.Slider
A DragDrop implementation that can be used as a background for a slider. 

Method Summary [top]

Object _getNextY (curCoord, finalCoord)
Get the next Y tick value based upon the current coord and the target coord. 
int getValue ()
Returns the slider's thumb offset from the start position 
Object getXValue ()
 
Object getYValue ()
 
void lock ()
Lock the slider, overrides YAHOO.util.DragDrop 
void onChange (firstOffset, secondOffset)
Event that fires when the value of the slider has changed 
void onSlideEnd ()
Event that fires at the end of a slider thumb move 
void onSlideStart ()
Event that fires when the at the beginning of the slider thumb move 
void onThumbChange ()
 
boolean setRegionValue (<int> newOffset, <int> newOffset2, skipAnim)
Provides a way to set the value of the region slider in code. 
boolean setValue (<int> newOffset, skipAnim)
Provides a way to set the value of the slider in code. 
void unlock ()
Unlock the slider, overrides YAHOO.util.DragDrop 
boolean verifyOffset ()
Checks the background position element position. 
Slider getHorizSlider (<String> sBGElId, <String> sHandleElId, <int> iLeft, <int> iRight, <int> iTickSize)
Factory method for creating a horizontal slider 
Slider getSliderRegion (<String> sBGElId, <String> sHandleElId, <int> iLeft, <int> iRight, <int> iUp, <int> iDown, <int> iTickSize)
Factory method for creating a slider region like the one in the color picker example 
Slider getVertSlider (<String> sBGElId, <String> sHandleElId, <int> iUp, <int> iDown, <int> iTickSize)
Factory method for creating a vertical slider 

Field Detail [top]

animate

boolean   animate
Flag that determines if the thumb will animate when moved

baselinePos

int[]   baselinePos
The basline position of the background element, used to determine if the background has moved since the last operation.

thumb

YAHOO.widget.Slider   thumb
a YAHOO.widget.SliderThumb instance that we will use to reposition the thumb when the background is clicked

thumbCenterPoint

Coordinate   thumbCenterPoint
the center of the slider element is stored so we can position place it in the correct position when the background is clicked

tickPause

int   tickPause
Adjustment factor for tick animation, the more ticks, the faster the animation (by default)

ANIM_AVAIL

Object   ANIM_AVAIL

Constructor Detail [top]

YAHOO.widget.Slider

YAHOO.widget.Slider ()
A DragDrop implementation that can be used as a background for a slider. It takes a reference to the thumb instance so it can delegate some of the events to it. The goal is to make the thumb jump to the location on the background when the background is clicked.
Parameters:
id - the id of the element linked to this instance
sGroup - the group of related DragDrop items

Method Detail [top]

_getNextY

Object _getNextY (curCoord, finalCoord)
Get the next Y tick value based upon the current coord and the target coord.

getValue

int getValue ()
Returns the slider's thumb offset from the start position
Returns:
the current value

getXValue

Object getXValue ()

getYValue

Object getYValue ()

lock

void lock ()
Lock the slider, overrides YAHOO.util.DragDrop

onChange

void onChange (firstOffset, secondOffset)
Event that fires when the value of the slider has changed
Parameters:
offsetFromStart - the number of pixels the thumb has moved from its start position

onSlideEnd

void onSlideEnd ()
Event that fires at the end of a slider thumb move

onSlideStart

void onSlideStart ()
Event that fires when the at the beginning of the slider thumb move

onThumbChange

void onThumbChange ()

setRegionValue

boolean setRegionValue (<int> newOffset, <int> newOffset2, skipAnim)
Provides a way to set the value of the region slider in code.
Parameters:
newOffset - the number of pixels the thumb should be positioned away from the initial start point
newOffset2 - the number of pixels the thumb should be positioned away from the initial start point (y axis for region)
skip - animation set to true to disable the animation for this move action (but not others).
Returns:
true if the move was performed, false if it failed

setValue

boolean setValue (<int> newOffset, skipAnim)
Provides a way to set the value of the slider in code.
Parameters:
newOffset - the number of pixels the thumb should be positioned away from the initial start point
skip - animation set to true to disable the animation for this move action (but not others).
Returns:
true if the move was performed, false if it failed

unlock

void unlock ()
Unlock the slider, overrides YAHOO.util.DragDrop

verifyOffset

boolean verifyOffset ()
Checks the background position element position. If it has moved from the baseline position, the constraints for the thumb are reset
Returns:
True if the offset is the same as the baseline.

getHorizSlider

Slider getHorizSlider (<String> sBGElId, <String> sHandleElId, <int> iLeft, <int> iRight, <int> iTickSize)
Factory method for creating a horizontal slider
Parameters:
sBGElId - the id of the slider's background element
sHandleElId - the id of the thumb element
iLeft - the number of pixels the element can move left
iRight - the number of pixels the element can move right
iTickSize - optional parameter for specifying that the element should move a certain number pixels at a time.
Returns:
a horizontal slider control

getSliderRegion

Slider getSliderRegion (<String> sBGElId, <String> sHandleElId, <int> iLeft, <int> iRight, <int> iUp, <int> iDown, <int> iTickSize)
Factory method for creating a slider region like the one in the color picker example
Parameters:
sBGElId - the id of the slider's background element
sHandleElId - the id of the thumb element
iLeft - the number of pixels the element can move left
iRight - the number of pixels the element can move right
iUp - the number of pixels the element can move up
iDown - the number of pixels the element can move down
iTickSize - optional parameter for specifying that the element should move a certain number pixels at a time.
Returns:
a slider region control

getVertSlider

Slider getVertSlider (<String> sBGElId, <String> sHandleElId, <int> iUp, <int> iDown, <int> iTickSize)
Factory method for creating a vertical slider
Parameters:
sBGElId - the id of the slider's background element
sHandleElId - the id of the thumb element
iUp - the number of pixels the element can move up
iDown - the number of pixels the element can move down
iTickSize - optional parameter for specifying that the element should move a certain number pixels at a time.
Returns:
a vertical slider control