PHP Класс 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).
С версии: 3.1.1
Автор: Christophe Boulain ([email protected])
Наследование: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\IDataRenderer
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Описание методов

addAttributesToRender() защищенный Метод

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

createClientScript() защищенный Метод

protected createClientScript ( ) : TSliderClientScript
Результат TSliderClientScript javascript event options.

getAutoPostBack() публичный Метод

public getAutoPostBack ( ) : boolean
Результат boolean a value indicating whether an automatic postback to the server will occur whenever the user modifies the slider value. Defaults to false.

getClientClassName() защищенный Метод

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Результат string the javascript class name

getClientSide() публичный Метод

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
Результат TSliderClientScript javascript validator event options.

getCssUrl() публичный Метод

public getCssUrl ( ) : string
Результат 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() публичный Метод

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getValue()}.
См. также: getValue
public getData ( ) : string
Результат string the value of the TSlider control.

getDataChanged() публичный Метод

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
Результат boolean whether postback has caused the control data change. False if the page is not in postback mode.

getDirection() публичный Метод

public getDirection ( ) : TSliderDirection
Результат TSliderDirection Direction of slider (Horizontal or Vertical). Defaults to Horizontal.

getMaxValue() публичный Метод

public getMaxValue ( ) : float
Результат float Maximum value for the slider. Defaults to 100.0.

getMinValue() публичный Метод

public getMinValue ( ) : float
Результат float Minimum value for slider. Defaults to 0.0.

getProgressIndicator() публичный Метод

public getProgressIndicator ( ) : boolean
Результат boolean wether to display a progress indicator or not. Defaults to true.

getSliderOptions() защищенный Метод

Get javascript sliderr options.
protected getSliderOptions ( ) : array
Результат array slider client-side options

getStepSize() публичный Метод

public getStepSize ( ) : float
Результат float Step size. Defaults to 1.0.

getTagName() публичный Метод

public getTagName ( ) : string
Результат string the HTML tag name for slider. Defaults to div.

getValue() публичный Метод

public getValue ( ) : float
Результат float current value of slider

getValues() публичный Метод

public getValues ( ) : array
Результат array list of allowed values the slider can take. Defaults to an empty array.

loadPostData() публичный Метод

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
Результат boolean whether the data of the component has been changed

onPreRender() публичный Метод

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

onValueChanged() публичный Метод

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() публичный Метод

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() защищенный Метод

Registers the javascript code to initialize the slider.

registerStyleSheet() защищенный Метод

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() публичный Метод

Render the body content
public renderContents ( $writer )

setAutoPostBack() публичный Метод

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

setCssUrl() публичный Метод

public setCssUrl ( $value )

setData() публичный Метод

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setValue()}.
См. также: setValue
public setData ( $value )

setDirection() публичный Метод

public setDirection ( $value )

setMaxValue() публичный Метод

public setMaxValue ( $value )

setMinValue() публичный Метод

public setMinValue ( $value )

setProgressIndicator() публичный Метод

public setProgressIndicator ( $value )

setStepSize() публичный Метод

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 setValue ( $value )

setValues() публичный Метод

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