PHP Class Prado\Web\UI\WebControls\TSlider

TSlider displays a slider for numeric input purpose. A slider consists of a 'track', which define the range of possible value, and a 'handle' which can slide on the track, to select a value in the range. The track can be either Horizontal or Vertical, depending of the {@link SetDirection Direction} property. By default, it's horizontal. The range boundaries are defined by {@link SetMinValue MinValue} and {@link SetMaxValue MaxValue} properties. The default range is from 0 to 100. The {@link SetStepSize StepSize} property can be used to define the step between 2 values inside the range. Notice that this step will be recomputed if there is more than 200 values between the range boundaries. You can also provide the allowed values by setting the {@link SetValues Values} array. A 'Progress Indicator' can be displayed within the track with the {@link SetProgressIndicator ProgressIndicator} property. The TSlider control can be easily customized using CssClasses. You can provide your own css file, using the {@link SetCssUrl CssUrl} property. The css class for TSlider can be set by the {@link setCssClass CssClass} property. Default value is "Slider HorizontalSlider" for an horizontal slider, and "Slider VerticalSlider" for a vertical one. If {@link SetAutoPostBack AutoPostBack} property is true, postback is sent as soon as the value changed. TSlider raises the {@link onValueChanged} event when the value of the slider has changed during postback. You can also attach ClientSide javascript events handler to the slider : - ClientSide.onSlide is called when the handle is slided on the track. You can get the current value in the value javascript variable. You can use this event to update on client side a label with the current value - ClientSide.onChange is called when the slider value has changed (at the end of a move).
Since: 3.1.1
Author: Christophe Boulain ([email protected])
Inheritance: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\IDataRenderer
Afficher le fichier Open project: pradosoft/prado

Méthodes publiques

Méthode Description
getAutoPostBack ( ) : boolean
getClientSide ( ) : TSliderClientScript Gets the TSliderClientScript to set the TSlider event handlers.
getCssUrl ( ) : string
getData ( ) : string Returns the value of the TSlider control.
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getDirection ( ) : TSliderDirection
getMaxValue ( ) : float
getMinValue ( ) : float
getProgressIndicator ( ) : boolean
getStepSize ( ) : float
getTagName ( ) : string
getValue ( ) : float
getValues ( ) : array
loadPostData ( $key, $values ) : boolean Loads user input data.
onPreRender ( $param ) Registers CSS and JS.
onValueChanged ( $param ) Raises OnValueChanged event.
raisePostDataChangedEvent ( ) Raises postdata changed event.
renderContents ( $writer ) Render the body content
setAutoPostBack ( $value ) Sets the value indicating if postback automatically.
setCssUrl ( $value )
setData ( $value ) Sets the value of the TSlider control.
setDirection ( $value )
setMaxValue ( $value )
setMinValue ( $value )
setProgressIndicator ( $value )
setStepSize ( $value ) Sets the step size used to determine the places where the slider handle can stop at.
setValue ( $value )
setValues ( $value ) Sets the possible values that the slider can take.

Méthodes protégées

Méthode Description
addAttributesToRender ( $writer ) Add the specified css classes to the track
createClientScript ( ) : TSliderClientScript
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getSliderOptions ( ) : array Get javascript sliderr options.
registerSliderClientScript ( ) Registers the javascript code to initialize the slider.
registerStyleSheet ( ) Registers the CSS relevant to the TSlider.

Method Details

addAttributesToRender() protected méthode

Add the specified css classes to the track
protected addAttributesToRender ( $writer )

createClientScript() protected méthode

protected createClientScript ( ) : TSliderClientScript
Résultat TSliderClientScript javascript event options.

getAutoPostBack() public méthode

public getAutoPostBack ( ) : boolean
Résultat boolean a value indicating whether an automatic postback to the server will occur whenever the user modifies the slider value. Defaults to false.

getClientClassName() protected méthode

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Résultat string the javascript class name

getClientSide() public méthode

The slider on the client-side supports the following events. # OnSliderMove -- raised when the slider is moved. # OnSliderChanged -- raised when the slider value is changed You can attach custom javascript code to each of these events
public getClientSide ( ) : TSliderClientScript
Résultat TSliderClientScript javascript validator event options.

getCssUrl() public méthode

public getCssUrl ( ) : string
Résultat string URL for the CSS file including all relevant CSS class definitions. Defaults to '' (a default CSS file will be applied in this case.)

getData() public méthode

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getValue()}.
See also: getValue
public getData ( ) : string
Résultat string the value of the TSlider control.

getDataChanged() public méthode

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
Résultat boolean whether postback has caused the control data change. False if the page is not in postback mode.

getDirection() public méthode

public getDirection ( ) : TSliderDirection
Résultat TSliderDirection Direction of slider (Horizontal or Vertical). Defaults to Horizontal.

getMaxValue() public méthode

public getMaxValue ( ) : float
Résultat float Maximum value for the slider. Defaults to 100.0.

getMinValue() public méthode

public getMinValue ( ) : float
Résultat float Minimum value for slider. Defaults to 0.0.

getProgressIndicator() public méthode

public getProgressIndicator ( ) : boolean
Résultat boolean wether to display a progress indicator or not. Defaults to true.

getSliderOptions() protected méthode

Get javascript sliderr options.
protected getSliderOptions ( ) : array
Résultat array slider client-side options

getStepSize() public méthode

public getStepSize ( ) : float
Résultat float Step size. Defaults to 1.0.

getTagName() public méthode

public getTagName ( ) : string
Résultat string the HTML tag name for slider. Defaults to div.

getValue() public méthode

public getValue ( ) : float
Résultat float current value of slider

getValues() public méthode

public getValues ( ) : array
Résultat array list of allowed values the slider can take. Defaults to an empty array.

loadPostData() public méthode

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
Résultat boolean whether the data of the component has been changed

onPreRender() public méthode

This method is invoked right before the control rendering, if the control is visible.
public onPreRender ( $param )

onValueChanged() public méthode

This method is invoked when the {@link getValue Value} property changes on postback. If you override this method, be sure to call the parent implementation to ensure the invocation of the attached event handlers.
public onValueChanged ( $param )

raisePostDataChangedEvent() public méthode

This method is required by {@link \Prado\Web\UI\IPostBackDataHandler} interface. It is invoked by the framework when {@link getValue Value} property is changed on postback. This method is primarly used by framework developers.

registerSliderClientScript() protected méthode

Registers the javascript code to initialize the slider.

registerStyleSheet() protected méthode

It will register the CSS file specified by {@link getCssUrl CssUrl}. If that is not set, it will use the default CSS.
protected registerStyleSheet ( )

renderContents() public méthode

Render the body content
public renderContents ( $writer )

setAutoPostBack() public méthode

An automatic postback to the server will occur whenever the user modifies the slider value.
public setAutoPostBack ( $value )

setCssUrl() public méthode

public setCssUrl ( $value )

setData() public méthode

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setValue()}.
See also: setValue
public setData ( $value )

setDirection() public méthode

public setDirection ( $value )

setMaxValue() public méthode

public setMaxValue ( $value )

setMinValue() public méthode

public setMinValue ( $value )

setProgressIndicator() public méthode

public setProgressIndicator ( $value )

setStepSize() public méthode

An evenly distributed stop marks will be generated according to {@link getMinValue MinValue}, {@link getMaxValue MaxValue} and StepSize. To use uneven stop marks, set {@link setValues Values}.
public setStepSize ( $value )

setValue() public méthode

public setValue ( $value )

setValues() public méthode

If this is set, {@link setStepSize StepSize} will be ignored. The latter generates a set of evenly distributed candidate values.
public setValues ( $value )