OverviewSingleDeprecated

jsx3.gui

class Slider

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Painted
      ->jsx3.gui.Block
        ->jsx3.gui.Slider

All Implemented Interfaces:

jsx3.gui.Form, jsx3.gui.Interactive, jsx3.util.EventDispatcher

class Slider
extends jsx3.gui.Block
A GUI control that implements a draggable slider. The slider is draggable along a fixed-length line representing a linear range of values. Events are provided for incremental drag events as well as the end drag (change) event.

The range of values of a slider is always [0,100]. 0 is at the far left side of a horizontal slider and bottom edge of a vertical slider. The value is available as a floating point number with the getValue() method as well as the event handlers.

Since:

3.1

Field Summary
static int
HORIZONTAL
Orientation value for a horizontal slider.
static int
VERTICAL
Orientation value for a vertical slider.
Constructor Summary
void
init(strName : String, vntLeft : int | String, vntTop : int | String, vntLength : int | String)
The instance initializer.
Method Summary
Number
constrainValue(fpValue : Number)
Constrains a possible slider value to a legal value.
int
Sets the validation state for this slider and returns the validation state.
String
Returns the URL of the image to use for the handle.
int | String
Returns the value of the length field, the size of the dimension along this slider axis.
int
Returns the orientation of this slider.
int
Returns whether the track is painted.
int
Returns whether clicking the track moves the handle to that point.
Number
Returns the value of this slider.
static String
Deprecated.
String
Paints this slider.
jsx3.gui.Slider
Sets the URL of the image to use for the handle.
jsx3.gui.Slider
setLength(vntLength : int | String, bRepaint : boolean)
Sets the length of this slider.
jsx3.gui.Slider
setOrientation(intValue : int)
Sets the orientation of this slider.
jsx3.gui.Slider
setPaintTrack(bValue : int)
Sets whether the track is painted.
jsx3.gui.Slider
Sets whether clicking the track moves the handle to that point.
jsx3.gui.Slider
setValue(fpValue : Number)
Sets the value of this slider and repositions the handle.
Methods Inherited From jsx3.gui.Form
doKeyBinding, doReset, getDisabledBackgroundColor, getDisabledColor, getEnabled, getKeyBinding, getRequired, getValidationState, setDisabledBackgroundColor, setDisabledColor, setEnabled, setKeyBinding, setRequired, setValidationState
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCSSOverride, getClassName, getColor, getCursor, getDimensions, getDisplay, getFontName, getFontSize, getFontWeight, getHeight, getIndex, getLeft, getMargin, getOverflow, getPadding, getRelativePosition, getTagName, getText, getTextAlign, getTip, getTop, getVisibility, getWidth, getZIndex, hideMask, setBackground, setBackgroundColor, setBorder, setCSSOverride, setClassName, setColor, setCursor, setDimensions, setDisplay, setFontName, setFontSize, setFontWeight, setHeight, setIndex, setLeft, setMargin, setOverflow, setPadding, setRelativePosition, setTagName, setText, setTextAlign, setTip, setTop, setVisibility, setWidth, setZIndex, showMask
Methods Inherited From jsx3.gui.Interactive
doEvent, getCanDrag, getCanDrop, getCanMove, getCanSpy, getEvent, getEvents, getMenu, hasEvent, registerHotKey, removeEvent, removeEvents, setCanDrag, setCanDrop, setCanMove, setCanSpy, setEvent, setMenu, setSpyStyles, showSpy
Methods Inherited From jsx3.gui.Painted
focus, getAbsolutePosition, getAttribute, getAttributes, getDynamicProperty, getRendered, insertHTML, onAfterPaint, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute, setDynamicProperty
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

HORIZONTAL

static final int HORIZONTAL
Orientation value for a horizontal slider.

VERTICAL

static final int VERTICAL
Orientation value for a vertical slider.
Constructor Detail

init

void init(strName : String, vntLeft : int | String, vntTop : int | String, vntLength : int | String)
The instance initializer.

Parameters:

strNameunique name distinguishing this object from all other JSX GUI objects in the JSX application
vntLefteither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntTopeither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntLengththe length of the control along the draggable axis
Method Detail

constrainValue

Number constrainValue(fpValue : Number)
Constrains a possible slider value to a legal value. This implementation ensures that the resulting value is within the legal range of [0,100].

Override this method on an instance of jsx3.gui.Slider to create a "notched" slider. The following code creates a slider that allows its handle to be in a location corresponding to a value that is a multiple of 10:
objSlider.constrainValue = function(fpValue) {
  return Math.max(0, Math.min(100, jsx3.util.numRound(fpValue, 10)));
}

Parameters:

fpValuethe value to validate, usually corresponds to a value along that slider that the handle is being dragged.

Returns:

the validated value, usually the nearest value to fpValue that is legal for this slider.  

doValidate

int doValidate()
Sets the validation state for this slider and returns the validation state.

Returns:

jsx3.gui.Form.STATEVALID.  

Overrides:

doValidate in jsx3.gui.Form

getHandleImage

String getHandleImage()
Returns the URL of the image to use for the handle.

Returns:

 

getLength

int | String getLength()
Returns the value of the length field, the size of the dimension along this slider axis.

Returns:

the length field  

getOrientation

int getOrientation()
Returns the orientation of this slider.

Returns:

HORIZONTAL or VERTICAL

See Also:

HORIZONTAL, VERTICAL

getPaintTrack

int getPaintTrack()
Returns whether the track is painted.

Returns:

jsx3.Boolean.TRUE or jsx3.Boolean.FALSE  

getTrackClickable

int getTrackClickable()
Returns whether clicking the track moves the handle to that point.

Returns:

jsx3.Boolean.TRUE or jsx3.Boolean.FALSE.  

getValue

Number getValue()
Returns the value of this slider.

Returns:

between 0 and 100.  

Overrides:

getValue in jsx3.gui.Form

getVersion

static String getVersion()
Deprecated.
Returns the release/build for the class (i.e., "3.0.00")

Returns:

 

paint

String paint()
Paints this slider.

Returns:

the serialized HTML.  

Overrides:

paint in jsx3.gui.Block

setHandleImage

jsx3.gui.Slider setHandleImage(strUrl : String)
Sets the URL of the image to use for the handle. If no URL is set, a default image is used.

Parameters:

strUrl

Returns:

this object.  

setLength

jsx3.gui.Slider setLength(vntLength : int | String, bRepaint : boolean)
Sets the length of this slider.

Parameters:

vntLengthe.g. 100[px] or "100%".
bRepaintwhether to repaint this slider immediately to reflect the change.

Returns:

this object.  

setOrientation

jsx3.gui.Slider setOrientation(intValue : int)
Sets the orientation of this slider.

Parameters:

intValueHORIZONTAL or VERTICAL.

Returns:

this object.  

setPaintTrack

jsx3.gui.Slider setPaintTrack(bValue : int)
Sets whether the track is painted.

Parameters:

bValuejsx3.Boolean.TRUE or jsx3.Boolean.FALSE.

Returns:

this object.  

setTrackClickable

jsx3.gui.Slider setTrackClickable(bValue : int)
Sets whether clicking the track moves the handle to that point.

Parameters:

bValuejsx3.Boolean.TRUE or jsx3.Boolean.FALSE.

Returns:

this object.  

setValue

jsx3.gui.Slider setValue(fpValue : Number)
Sets the value of this slider and repositions the handle.

Parameters:

fpValuethe new value, between 0 and 100.

Returns:

this object.  

Overrides:

setValue in jsx3.gui.Form