Class TWebControl

Description

Implements interfaces:

TWebControl class

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 getTagName to specify the tag name, addAttributesToRender to specify the attributes to be rendered, and renderContents to customize the body content rendering. TWebControl encapsulates a set of properties related with CSS style fields, such as BackColor, BorderWidth, etc.

Subclasses of TWebControl typically needs to override addAttributesToRender and 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.

  • author: Qiang Xue <qiang.xue@gmail.com>
  • version: $Id: TWebControl.php 2996 2011-06-20 15:24:57Z ctrlaltca@gmail.com $
  • since: 3.0

Located in /Web/UI/WebControls/TWebControl.php (line 42)

TComponent
   |
   --TApplicationComponent
      |
      --TControl
         |
         --TWebControl
Direct descendents
Class Description
TAccordion Class TAccordion.
TAccordionView Class TAccordionView.
TButton TButton class
TCheckBox TCheckBox class
TDataBoundControl TDataBoundControl class.
TDataListItem TDataListItem class
TFileUpload TFileUpload class
THtmlElement THtmlElement class.
THyperLink THyperLink class
TImage TImage class
TInlineFrame TInlineFrame class
TJavascriptLogger TJavascriptLogger class.
TKeyboard Class TKeyboard.
TLabel TLabel class
TLinkButton TLinkButton class
TPager TPager class.
TPanel TPanel class
TReCaptcha TReCaptcha class.
TSlider TSlider class
TTable TTable class
TTableCell TTableCell class.
TTableRow TTableRow class.
TTabPanel Class TTabPanel.
TTabView TTabView class.
TTextBox TTextBox class
TTextProcessor TTextProcessor class.
TValidationSummary TValidationSummary class
TWizard Class TWizard.
Variable Summary
Method Summary
void clearStyle ()
void copyBaseAttributes (TWebControl $control)
string getAccessKey ()
string getBackColor ()
string getBorderColor ()
string getBorderStyle ()
string getBorderWidth ()
string getCssClass ()
TWebControlDecorator getDecorator ([ $create = true])
whether getEnsureId ()
string getForeColor ()
boolean getHasStyle ()
string getHeight ()
integer getTabIndex ()
string getTagName ()
string getToolTip ()
string getWidth ()
void onPreRender (TEventParameter $param)
void render (THtmlWriter $writer)
void renderBeginTag (THtmlWriter $writer)
void renderContents (THtmlWriter $writer)
void renderEndTag (THtmlWriter $writer)
void setAccessKey (string $value)
void setBackColor (string $value)
void setBorderColor (string $value)
void setBorderStyle (string $value)
void setBorderWidth (string $value)
void setCssClass (string $value)
void setDisplay (TDisplayStyle $value)
void setEnsureId (boolean $value)
void setForeColor (string $value)
void setHeight (string $value)
void setStyle (string $value)
void setTabIndex (integer $value)
void setToolTip (string $value)
void setWidth (string $value)
Variables
TWebControlDecorator $_decorator (line 52)
  • var: this render things before and after both the open and close tag
  • access: protected
Methods
addAttributesToRender (line 422)

Adds attribute name-value pairs to renderer.

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.

  • access: protected
void addAttributesToRender (THtmlWriter $writer)
  • THtmlWriter $writer: the writer used for the rendering purpose

Redefined in descendants as:
clearStyle (line 330)

Removes all style data.

  • access: public
void clearStyle ()
copyBaseAttributes (line 90)

Copies basic control attributes from another control.

Properties including AccessKey, ToolTip, TabIndex, Enabled and Attributes are copied.

  • access: public
void copyBaseAttributes (TWebControl $control)
createStyle (line 293)

Creates a style object to be used by the control.

This method may be overriden by controls to provide customized style.

  • return: the default style created for TWebControl
  • access: protected
TStyle createStyle ()

Redefined in descendants as:
getAccessKey (line 104)
  • return: the access key of the control
  • access: public
string getAccessKey ()
getBackColor (line 126)
  • return: the background color of the control
  • access: public
string getBackColor ()
getBorderColor (line 145)
  • return: the border color of the control
  • access: public
string getBorderColor ()
getBorderStyle (line 164)
  • return: the border style of the control
  • access: public
string getBorderStyle ()
getBorderWidth (line 183)
  • return: the border width of the control
  • access: public
string getBorderWidth ()
getCssClass (line 264)
  • return: the css class of the control
  • access: public
string getCssClass ()

Redefined in descendants as:
getDecorator (line 77)
  • access: public
TWebControlDecorator getDecorator ([ $create = true])
  • $create
getDisplay (line 248)
  • return: display style of the control, default is TDisplayStyle::Fixed
  • access: public
TDisplayStyle getDisplay ()

Redefined in descendants as:
getEnsureId (line 69)
  • return: this web control must have an id
  • access: public
whether getEnsureId ()
getFont (line 202)
  • return: the font of the control
  • access: public
TFont getFont ()
getForeColor (line 210)
  • return: the foreground color of the control
  • access: public
string getForeColor ()
getHasStyle (line 283)
  • return: whether the control has defined any style information
  • access: public
boolean getHasStyle ()
getHeight (line 229)
  • return: the height of the control
  • access: public
string getHeight ()
getStyle (line 301)
  • return: the object representing the css style of the control
  • access: public
TStyle getStyle ()
getTabIndex (line 338)
  • return: the tab index of the control
  • access: public
integer getTabIndex ()
getToolTip (line 367)
  • return: the tooltip of the control
  • access: public
string getToolTip ()
getWidth (line 385)
  • return: the width of the control
  • access: public
string getWidth ()
onPreRender (line 408)

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.

  • access: public
void onPreRender (TEventParameter $param)
  • TEventParameter $param: event parameter to be passed to the event handlers

Redefinition of:
TControl::onPreRender()
This method is invoked when the control enters 'OnPreRender' stage.

Redefined in descendants as:
render (line 452)

Renders the control.

This method overrides the parent implementation by replacing it with the following sequence:

  • access: public
void render (THtmlWriter $writer)
  • THtmlWriter $writer: the writer used for the rendering purpose

Redefinition of:
TControl::render()
Renders the control.

Redefined in descendants as:
renderBeginTag (line 463)

Renders the openning tag for the control (including attributes)

  • access: public
void renderBeginTag (THtmlWriter $writer)
  • THtmlWriter $writer: the writer used for the rendering purpose

Redefined in descendants as:
renderContents (line 482)

Renders the body content enclosed between the control tag.

By default, child controls and text strings will be rendered. You can override this method to provide customized content rendering.

  • access: public
void renderContents (THtmlWriter $writer)
  • THtmlWriter $writer: the writer used for the rendering purpose

Redefined in descendants as:
renderEndTag (line 491)

Renders the closing tag for the control

  • access: public
void renderEndTag (THtmlWriter $writer)
  • THtmlWriter $writer: the writer used for the rendering purpose

Redefined in descendants as:
setAccessKey (line 116)

Sets the access key of the control.

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.

  • throws: TInvalidDataValueException if the access key is specified with more than one character
  • access: public
void setAccessKey (string $value)
  • string $value: the access key to be set
setBackColor (line 137)
  • access: public
void setBackColor (string $value)
  • string $value: the background color of the control
setBorderColor (line 156)
  • access: public
void setBorderColor (string $value)
  • string $value: the border color of the control
setBorderStyle (line 175)
  • access: public
void setBorderStyle (string $value)
  • string $value: the border style of the control
setBorderWidth (line 194)
  • access: public
void setBorderWidth (string $value)
  • string $value: the border width of the control
setCssClass (line 256)
  • access: public
void setCssClass (string $value)
  • string $value: the css class of the control
setDisplay (line 240)
  • access: public
void setDisplay (TDisplayStyle $value)
  • TDisplayStyle $value: display style of the control, default is TDisplayStyle::Fixed

Redefined in descendants as:
setEnsureId (line 61)

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.

  • access: public
void setEnsureId (boolean $value)
  • boolean $value: pass true to enable enforcement of the tag attribute id.
setForeColor (line 221)
  • access: public
void setForeColor (string $value)
  • string $value: the foreground color of the control
setHeight (line 275)
  • access: public
void setHeight (string $value)
  • string $value: the height of the control
setStyle (line 319)

Sets the css style string of the control.

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

  • throws: TInvalidDataValueException if the parameter is not a string
  • access: public
void setStyle (string $value)
  • string $value: the css style string
setTabIndex (line 348)

Sets the tab index of the control.

Pass 0 if you want to disable tab index.

  • access: public
void setTabIndex (integer $value)
  • integer $value: the tab index to be set
setToolTip (line 377)

Sets the tooltip of the control.

Pass an empty string if you want to disable tooltip.

  • access: public
void setToolTip (string $value)
  • string $value: the tooltip to be set
setWidth (line 396)
  • access: public
void setWidth (string $value)
  • string $value: the width of the control

Inherited Methods

Inherited From TControl

TControl::__construct()
TControl::addedControl()
TControl::addParsedObject()
TControl::addToPostDataLoader()
TControl::applyStyleSheetSkin()
TControl::autoBindProperty()
TControl::autoDataBindProperties()
TControl::bindProperty()
TControl::broadcastEvent()
TControl::bubbleEvent()
TControl::clearChildState()
TControl::clearControlState()
TControl::clearNamingContainer()
TControl::clearViewState()
TControl::convertUniqueIdToClientId()
TControl::createChildControls()
TControl::createControlCollection()
TControl::dataBind()
TControl::dataBindChildren()
TControl::dataBindProperties()
TControl::ensureChildControls()
TControl::findControl()
TControl::findControlsByID()
TControl::findControlsByType()
TControl::focus()
TControl::getAdapter()
TControl::getAllowChildControls()
TControl::getAttribute()
TControl::getAttributes()
TControl::getChildControlsCreated()
TControl::getClientID()
TControl::getControls()
TControl::getControlStage()
TControl::getControlState()
TControl::getCustomData()
TControl::getEnabled()
TControl::getEnableTheming()
TControl::getEnableViewState()
TControl::getHasAdapter()
TControl::getHasAttributes()
TControl::getHasChildInitialized()
TControl::getHasControls()
TControl::getHasInitialized()
TControl::getHasLoaded()
TControl::getHasLoadedPostData()
TControl::getHasPreRendered()
TControl::getID()
TControl::getIsSkinApplied()
TControl::getNamingContainer()
TControl::getPage()
TControl::getParent()
TControl::getRegisteredObject()
TControl::getSkinID()
TControl::getSourceTemplateControl()
TControl::getTemplateControl()
TControl::getUniqueID()
TControl::getViewState()
TControl::getVisible()
TControl::hasAttribute()
TControl::initRecursive()
TControl::isDescendentOf()
TControl::isObjectRegistered()
TControl::loadRecursive()
TControl::loadState()
TControl::loadStateRecursive()
TControl::onDataBinding()
TControl::onInit()
TControl::onLoad()
TControl::onPreRender()
TControl::onUnload()
TControl::preRenderRecursive()
TControl::raiseBubbleEvent()
TControl::registerObject()
TControl::removeAttribute()
TControl::removedControl()
TControl::render()
TControl::renderChildren()
TControl::renderControl()
TControl::saveState()
TControl::saveStateRecursive()
TControl::setAdapter()
TControl::setAttribute()
TControl::setChildControlsCreated()
TControl::setControlStage()
TControl::setControlState()
TControl::setCustomData()
TControl::setEnabled()
TControl::setEnableTheming()
TControl::setEnableViewState()
TControl::setID()
TControl::setPage()
TControl::setSkinID()
TControl::setTemplateControl()
TControl::setViewState()
TControl::setVisible()
TControl::trackViewState()
TControl::traverseChildControls()
TControl::unbindProperty()
TControl::unloadRecursive()
TControl::unregisterObject()
TControl::__get()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Class Constants

Documentation generated on Mon, 25 Jun 2012 14:39:35 +0200 by phpDocumentor 1.4.3