PHP Класс Prado\Web\UI\WebControls\TWebControl

TWebControl is the base class for controls that share a common set of UI-related properties and methods. TWebControl-derived controls are usually associated with HTML tags. They thus have tag name, attributes and body contents. You can override {@link getTagName} to specify the tag name, {@link addAttributesToRender} to specify the attributes to be rendered, and {@link renderContents} to customize the body content rendering. TWebControl encapsulates a set of properties related with CSS style fields, such as {@link getBackColor BackColor}, {@link getBorderWidth BorderWidth}, etc. Subclasses of TWebControl typically needs to override {@link addAttributesToRender} and {@link renderContents}. The former is used to render the attributes of the HTML tag associated with the control, while the latter is to render the body contents enclosed within the HTML tag.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends Prado\Web\UI\TControl, implements Prado\Web\UI\WebControls\IStyleable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_decorator this render things before and after both the open and close tag

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

Метод Описание
clearStyle ( ) Removes all style data.
copyBaseAttributes ( TWebControl $control ) Copies basic control attributes from another control.
getAccessKey ( ) : string
getBackColor ( ) : string
getBorderColor ( ) : string
getBorderStyle ( ) : string
getBorderWidth ( ) : string
getCssClass ( ) : string
getDecorator ( $create = true ) : TWebControlDecorator
getDisplay ( ) : TDisplayStyle
getEnsureId ( ) : whether
getFont ( ) : TFont
getForeColor ( ) : string
getHasStyle ( ) : boolean
getHeight ( ) : string
getStyle ( ) : TStyle
getTabIndex ( ) : integer
getToolTip ( ) : string
getWidth ( ) : string
onPreRender ( $param ) If your subclass overrides the onPreRender method be sure to call this method through parent::onPreRender($param); so your sub-class can be decorated, among other things.
render ( $writer ) Renders the control.
renderBeginTag ( $writer ) Renders the openning tag for the control (including attributes)
renderContents ( $writer ) Renders the body content enclosed between the control tag.
renderEndTag ( $writer ) Renders the closing tag for the control
setAccessKey ( $value ) Sets the access key of the control.
setBackColor ( $value )
setBorderColor ( $value )
setBorderStyle ( $value )
setBorderWidth ( $value )
setCssClass ( $value )
setDisplay ( $value )
setEnsureId ( $value ) Subclasses can override getEnsureId or just set this property. eg. If your subclass control does work with javascript and your class wants to flag that it requires an id to operate properly. Once set to true, it stays that way.
setForeColor ( $value )
setHeight ( $value )
setStyle ( $value ) Sets the css style string of the control.
setTabIndex ( $value ) Sets the tab index of the control.
setToolTip ( $value ) Sets the tooltip of the control.
setWidth ( $value )

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

Метод Описание
addAttributesToRender ( $writer ) Adds attribute name-value pairs to renderer.
createStyle ( ) : TStyle Creates a style object to be used by the control.
getTagName ( ) : string Returns the tag name used for this control.

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

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

By default, the method will render 'id', 'accesskey', 'disabled', 'tabindex', 'title' and all custom attributes. The method can be overriden to provide customized attribute rendering.
protected addAttributesToRender ( $writer )

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

Removes all style data.
public clearStyle ( )

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

Properties including AccessKey, ToolTip, TabIndex, Enabled and Attributes are copied.
public copyBaseAttributes ( TWebControl $control )
$control TWebControl

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

This method may be overriden by controls to provide customized style.
protected createStyle ( ) : TStyle
Результат TStyle the default style created for TWebControl

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

public getAccessKey ( ) : string
Результат string the access key of the control

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

public getBackColor ( ) : string
Результат string the background color of the control

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

public getBorderColor ( ) : string
Результат string the border color of the control

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

public getBorderStyle ( ) : string
Результат string the border style of the control

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

public getBorderWidth ( ) : string
Результат string the border width of the control

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

public getCssClass ( ) : string
Результат string the css class of the control

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

public getDecorator ( $create = true ) : TWebControlDecorator
Результат TWebControlDecorator

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

public getDisplay ( ) : TDisplayStyle
Результат TDisplayStyle display style of the control, default is TDisplayStyle::Fixed

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

public getEnsureId ( ) : whether
Результат whether this web control must have an id

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

public getFont ( ) : TFont
Результат TFont the font of the control

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

public getForeColor ( ) : string
Результат string the foreground color of the control

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

public getHasStyle ( ) : boolean
Результат boolean whether the control has defined any style information

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

public getHeight ( ) : string
Результат string the height of the control

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

public getStyle ( ) : TStyle
Результат TStyle the object representing the css style of the control

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

public getTabIndex ( ) : integer
Результат integer the tab index of the control

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

By default, the tag name is 'span'. You can override this method to provide customized tag names.
protected getTagName ( ) : string
Результат string tag name of the control to be rendered

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

public getToolTip ( ) : string
Результат string the tooltip of the control

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

public getWidth ( ) : string
Результат string the width of the control

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

If your subclass overrides the onPreRender method be sure to call this method through parent::onPreRender($param); so your sub-class can be decorated, among other things.
public onPreRender ( $param )

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

This method overrides the parent implementation by replacing it with the following sequence: - {@link renderBeginTag} - {@link renderContents} - {@link renderEndTag}
public render ( $writer )

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

Renders the openning tag for the control (including attributes)
public renderBeginTag ( $writer )

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

By default, child controls and text strings will be rendered. You can override this method to provide customized content rendering.
public renderContents ( $writer )

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

Renders the closing tag for the control
public renderEndTag ( $writer )

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

Only one-character string can be set, or an exception will be raised. Pass in an empty string if you want to disable access key.
public setAccessKey ( $value )

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

public setBackColor ( $value )

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

public setBorderColor ( $value )

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

public setBorderStyle ( $value )

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

public setBorderWidth ( $value )

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

public setCssClass ( $value )

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

public setDisplay ( $value )

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

Subclasses can override getEnsureId or just set this property. eg. If your subclass control does work with javascript and your class wants to flag that it requires an id to operate properly. Once set to true, it stays that way.
public setEnsureId ( $value )

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

public setForeColor ( $value )

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

public setHeight ( $value )

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

The style string will be prefixed to the styles set via other control properties (e.g. Height, Width).
public setStyle ( $value )

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

Pass 0 if you want to disable tab index.
public setTabIndex ( $value )

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

Pass an empty string if you want to disable tooltip.
public setToolTip ( $value )

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

public setWidth ( $value )

Описание свойств

$_decorator защищенное свойство

this render things before and after both the open and close tag
protected $_decorator