## Class TWebControl

Description

Implements interfaces:

- IStyleable

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.

- since: 3.0
- version: $Id: TWebControl.php 2541 2008-10-21 15:05:13Z qiang.xue $
- author: Qiang Xue <qiang.xue@gmail.com>

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

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl

Direct descendents

Class | Description
--- | ---
TButton | TButton class
TCheckBox | TCheckBox class
TClientScriptLoader | The TClientScriptLoader publish a collection of javascript files as assets.
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
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.

Method Summary
void addAttributesToRender (THtmlWriter $writer)
void clearStyle ()
void copyBaseAttributes (TWebControl $control)
TStyle createStyle ()
string getAccessKey ()
string getBackColor ()
string getBorderColor ()
string getBorderStyle ()
string getBorderWidth ()
string getCssClass ()
TDisplayStyle getDisplay ()
TFont getFont ()
string getForeColor ()
boolean getHasStyle ()
string getHeight ()
TStyle getStyle ()
integer getTabIndex ()
string getTagName ()
string getToolTip ()
string getWidth ()
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 setForeColor (string $value)
void setHeight (string $value)
void setStyle (string $value)
void setTabIndex (integer $value)
void setToolTip (string $value)
void setWidth (string $value)
Methods
addAttributesToRender (line 367)

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:

- TButton::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TActiveButton::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TClientScriptLoader::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TListControl::addAttributesToRender() : Adds attributes to renderer.
- TBulletedList::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TDropDownList::addAttributesToRender() : Adds attributes to renderer.
- TActiveDropDownList::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TListBox::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TActiveListBox::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TFileUpload::addAttributesToRender() : Sets name attribute to the unique ID of the control.
- TActiveFileUpload::addAttributesToRender() : Adds ID attribute, and renders the javascript for active component.
- THyperLink::addAttributesToRender() : Adds attributes related to a hyperlink element to renderer.
- TImage::addAttributesToRender() : Adds attributes related to an HTML image element to renderer.
- TImageButton::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TActiveImageButton::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TImageMap::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TInlineFrame::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TKeyboard::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TLabel::addAttributesToRender() : Adds attributes to renderer.
- TActiveLabel::addAttributesToRender() : Adds attribute id to the renderer.
- TBaseValidator::addAttributesToRender() : Adds attributes to renderer. Calls parent implementation and renders the client control scripts.
- TActiveCustomValidator::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TLinkButton::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TActiveLinkButton::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TPanel::addAttributesToRender() : Adds attributes to renderer.
- TDraggable::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TDropContainer::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TSlider::addAttributesToRender() : Add the specified css classes to the track
- TTable::addAttributesToRender() : Adds attributes to renderer.
- TTableCell::addAttributesToRender() : Adds attributes to renderer.
- TTableHeaderCell::addAttributesToRender() : Adds attributes to renderer.
- TTabPanel::addAttributesToRender() : Adds attributes to renderer.
- TTabView::addAttributesToRender() : Adds attributes to renderer.
- TTextBox::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TActiveTextBox::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TInPlaceTextBox::addAttributesToRender() : Ensure that the ID attribute is rendered and registers the javascript code for initializing the active control.
- TDatePicker::addAttributesToRender() : Add the client id to the input textbox, and register the client scripts.
- THtmlArea::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TValidationSummary::addAttributesToRender()

clearStyle (line 289)

Removes all style data.

- access: public

void clearStyle ()
copyBaseAttributes (line 49)

Copies basic control attributes from another control.

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

- access: public

void copyBaseAttributes (TWebControl $control)

- TWebControl $control: source control

createStyle (line 252)

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:

- TBaseDataList::createStyle() : Creates a style object for the control.
- TDataGrid::createStyle() : Creates a style object for the control.
- TCheckBoxList::createStyle() : Creates a style object for the control.
- TDataListItem::createStyle() : Creates a style object for the control.
- TPanel::createStyle() : Creates a style object to be used by the control.
- TTable::createStyle() : Creates a style object for the control.
- TTableCell::createStyle() : Creates a style object for the control.
- TTableRow::createStyle() : Creates a style object for the control.

getAccessKey (line 63)

- return: the access key of the control
- access: public

string getAccessKey ()
getBackColor (line 85)

- return: the background color of the control
- access: public

string getBackColor ()
getBorderColor (line 104)

- return: the border color of the control
- access: public

string getBorderColor ()
getBorderStyle (line 123)

- return: the border style of the control
- access: public

string getBorderStyle ()
getBorderWidth (line 142)

- return: the border width of the control
- access: public

string getBorderWidth ()
getCssClass (line 223)

- return: the css class of the control
- access: public

string getCssClass ()

Redefined in descendants as:

- TTabPanel::getCssClass()

getDisplay (line 207)

- return: display style of the control, default is TDisplayStyle::Fixed
- access: public

TDisplayStyle getDisplay ()

Redefined in descendants as:

- TBaseValidator::getDisplay()
- TValidationSummary::getDisplay()

getFont (line 161)

- return: the font of the control
- access: public

TFont getFont ()
getForeColor (line 169)

- return: the foreground color of the control
- access: public

string getForeColor ()
getHasStyle (line 242)

- return: whether the control has defined any style information
- access: public

boolean getHasStyle ()
getHeight (line 188)

- return: the height of the control
- access: public

string getHeight ()
getStyle (line 260)

- return: the object representing the css style of the control
- access: public

TStyle getStyle ()
getTabIndex (line 297)

- return: the tab index of the control
- access: public

integer getTabIndex ()
getTagName (line 318)

Returns the tag name used for this control.

By default, the tag name is 'span'. You can override this method to provide customized tag names.

- return: tag name of the control to be rendered
- access: protected

string getTagName ()

Redefined in descendants as:

- TButton::getTagName()
- TCheckBox::getTagName()
- TClientScriptLoader::getTagName()
- TDataGrid::getTagName()
- TListControl::getTagName()
- TBulletedList::getTagName()
- TDataListItem::getTagName() : Returns the tag name used for this control.
- TFileUpload::getTagName()
- THtmlElement::getTagName()
- THyperLink::getTagName()
- TImage::getTagName()
- TImageButton::getTagName()
- TInlineFrame::getTagName()
- TJavascriptLogger::getTagName()
- TLabel::getTagName()
- TLinkButton::getTagName()
- TPanel::getTagName()
- TSlider::getTagName()
- TTable::getTagName()
- TTableCell::getTagName()
- TTableHeaderCell::getTagName()
- TTableRow::getTagName()
- TTabPanel::getTagName()
- TTabView::getTagName()
- TTextBox::getTagName()
- TInPlaceTextBox::getTagName()
- TTextHighlighter::getTagName()
- TWizard::getTagName()

getToolTip (line 326)

- return: the tooltip of the control
- access: public

string getToolTip ()
getWidth (line 344)

- return: the width of the control
- access: public

string getWidth ()
render (line 397)

Renders the control.

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

- renderBeginTag
- renderContents
- renderEndTag

- 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:

- TCheckBox::render() : Renders the checkbox control.
- TDataGrid::render() : Renders the datagrid.
- TDataList::render() : Renders the data list control.
- TBulletedList::render() : Renders the control.
- TCheckBoxList::render() : Renders the checkbox list control.
- TRatingList::render() : Add rating style class name to the class attribute when setReadOnly property is true and when the setCssClass property is empty.
- TRepeater::render() : Renders the repeater.
- TImageMap::render() : Renders this imagemap.
- TLabel::render() : Renders the label.
- TPager::render() : Renders the control.
- TActivePager::render()
- TActivePanel::render() : Renders and replaces the panel's content on the client-side.
- TDropContainer::render() : Renders and replaces the panel's content on the client-side.
- TDatePicker::render() : Renders body content.
- TWizard::render() : Renders the wizard.

renderBeginTag (line 408)

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:

- TDataGrid::renderBeginTag() : Renders the openning tag for the datagrid control which will render table caption if present.
- TPanel::renderBeginTag() : Renders the openning tag for the control (including attributes)
- TTable::renderBeginTag() : Renders the openning tag for the table control which will render table caption if present.

renderContents (line 420)

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:

- TButton::renderContents() : Renders the body content enclosed between the control tag.
- TListControl::renderContents() : Renders body content of the list control.
- TBulletedList::renderContents() : Renders the body contents.
- THyperLink::renderContents() : Renders the body content of the hyperlink.
- TImage::renderContents() : Renders the body content of the image.
- TImageButton::renderContents() : Renders the body content enclosed between the control tag.
- TJavascriptLogger::renderContents() : Register the required javascript libraries and display some general usage information.
- TLabel::renderContents() : Renders the body content of the label.
- TBaseValidator::renderContents() : Renders the validator control.
- TLinkButton::renderContents() : Renders the body content enclosed between the control tag.
- TSlider::renderContents() : Render the body content
- TTable::renderContents() : Renders body contents of the table.
- TTableCell::renderContents() : Renders body contents of the table cell.
- TTableRow::renderContents() : Renders body contents of the table row
- TTabPanel::renderContents() : Renders body contents of the tab control.
- TTabView::renderContents() : Renders body contents of the tab view.
- TTextBox::renderContents() : Renders the body content of the textbox when it is in MultiLine text mode.
- TInPlaceTextBox::renderContents() : Renders the body content of the label.
- TTextProcessor::renderContents() : Renders body content.
- TValidationSummary::renderContents() : Overrides parent implementation by rendering TValidationSummary-specific presentation.

renderEndTag (line 429)

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:

- TPanel::renderEndTag() : Renders the closing tag for the control
- TAutoComplete::renderEndTag() : Renders the end tag and registers javascript effects library.
- TColorPicker::renderEndTag() : Renders additional body content.

setAccessKey (line 75)

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.

- access: public
- throws: TInvalidDataValueException if the access key is specified with more than one character

void setAccessKey (string $value)

- string $value: the access key to be set

setBackColor (line 96)

- access: public

void setBackColor (string $value)

- string $value: the background color of the control

setBorderColor (line 115)

- access: public

void setBorderColor (string $value)

- string $value: the border color of the control

setBorderStyle (line 134)

- access: public

void setBorderStyle (string $value)

- string $value: the border style of the control

setBorderWidth (line 153)

- access: public

void setBorderWidth (string $value)

- string $value: the border width of the control

setCssClass (line 215)

- access: public

void setCssClass (string $value)

- string $value: the css class of the control

setDisplay (line 199)

- access: public

void setDisplay (TDisplayStyle $value)

- TDisplayStyle $value: display style of the control, default is TDisplayStyle::Fixed

Redefined in descendants as:

- TBaseValidator::setDisplay()
- TValidationSummary::setDisplay()

setForeColor (line 180)

- access: public

void setForeColor (string $value)

- string $value: the foreground color of the control

setHeight (line 234)

- access: public

void setHeight (string $value)

- string $value: the height of the control

setStyle (line 278)

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).

- access: public
- throws: TInvalidDataValueException if the parameter is not a string

void setStyle (string $value)

- string $value: the css style string

setTabIndex (line 307)

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 336)

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 355)

- 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::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::__get()
> TComponent::__set()

Class Constants

#### Inherited Constants

Inherited from TControl

> TControl::AUTOMATIC_ID_PREFIX
> TControl::CLIENT_ID_SEPARATOR
> TControl::CS_CHILD_INITIALIZED
> TControl::CS_CONSTRUCTED
> TControl::CS_INITIALIZED
> TControl::CS_LOADED
> TControl::CS_PRERENDERED
> TControl::CS_STATE_LOADED
> TControl::ID_FORMAT
> TControl::ID_SEPARATOR
> TControl::IS_CHILD_CREATED
> TControl::IS_CREATING_CHILD
> TControl::IS_DISABLE_THEMING
> TControl::IS_DISABLE_VIEWSTATE
> TControl::IS_ID_SET
> TControl::IS_SKIN_APPLIED
> TControl::IS_STYLESHEET_APPLIED
> TControl::RF_ADAPTER
> TControl::RF_AUTO_BINDINGS
> TControl::RF_CHILD_STATE
> TControl::RF_CONTROLS
> TControl::RF_CONTROLSTATE
> TControl::RF_DATA_BINDINGS
> TControl::RF_EVENTS
> TControl::RF_NAMED_CONTROLS
> TControl::RF_NAMED_CONTROLS_ID
> TControl::RF_NAMED_OBJECTS
> TControl::RF_SKIN_ID

Documentation generated on Sun, 11 Jan 2009 20:24:22 -0500 by phpDocumentor 1.3.0RC4