## Class TWebControl

Description

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: $Revision: $ $Date: $
- 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
TDataBoundControl | TDataBoundControl class.
TDataListItem | TDataListItem class
TFileUpload | TFileUpload class
THyperLink | THyperLink class
TImage | TImage class
TInlineFrame | TInlineFrame class
TJavascriptLogger | TJavascriptLogger class.
TLabel | TLabel class
TLinkButton | TLinkButton class
TPanel | TPanel class
TTable | TTable class
TTableCell | TTableCell class.
TTableRow | TTableRow class.
TTextBox | TTextBox class
TTextProcessor | TTextProcessor class.
TValidationSummary | TValidationSummary class
TWizard | Class TWizard.

Method Summary
void addAttributesToRender (THtmlWriter $writer)
void copyBaseAttributes (TWebControl $control)
void createStyle ()
string getAccessKey ()
string getBackColor ()
string getBorderColor ()
string getBorderStyle ()
string getBorderWidth ()
string getCssClass ()
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 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 342)

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.
- TListControl::addAttributesToRender() : Adds attributes to renderer.
- TBulletedList::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TDropDownList::addAttributesToRender() : Adds attributes to renderer.
- TListBox::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TFileUpload::addAttributesToRender() : Sets name attribute to the unique ID of the control.
- 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.
- TImageMap::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TInlineFrame::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TLabel::addAttributesToRender() : Adds attributes to renderer.
- TBaseValidator::addAttributesToRender() : Adds attributes to renderer.
- TLinkButton::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TPanel::addAttributesToRender() : Adds attributes to renderer.
- TTable::addAttributesToRender() : Adds attributes to renderer.
- TTableCell::addAttributesToRender() : Adds attributes to renderer.
- TTableHeaderCell::addAttributesToRender() : Adds attributes to renderer.
- TTextBox::addAttributesToRender() : Adds attribute name-value pairs to renderer.
- TColorPicker::addAttributesToRender() : Registers the javascript code to initialize the color picker.
- 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()

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

Creates a style object to be used by the control.

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

- access: protected

void 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 207)

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

string getCssClass ()
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 226)

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

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

TStyle getStyle ()
getTabIndex (line 272)

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

integer getTabIndex ()
getTagName (line 293)

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()
- TDataGrid::getTagName()
- TListControl::getTagName()
- TBulletedList::getTagName()
- TFileUpload::getTagName()
- THyperLink::getTagName()
- TImage::getTagName()
- TImageButton::getTagName()
- TInlineFrame::getTagName()
- TJavascriptLogger::getTagName()
- TLabel::getTagName()
- TLinkButton::getTagName()
- TPanel::getTagName()
- TTable::getTagName()
- TTableCell::getTagName()
- TTableHeaderCell::getTagName()
- TTableRow::getTagName()
- TTextBox::getTagName()
- TTextHighlighter::getTagName()
- TWizard::getTagName()

getToolTip (line 301)

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

string getToolTip ()
getWidth (line 319)

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

string getWidth ()
render (line 372)

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.
- TRepeater::render() : Renders the repeater.
- TImageMap::render() : Renders this imagemap.
- TColorPicker::render() : Renders body content.
- TDatePicker::render() : Renders body content.
- TWizard::render() : Renders the wizard.

renderBeginTag (line 383)

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

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.
- 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
- TTextBox::renderContents() : Renders the body content of the textbox when it is in MultiLine text mode.
- TTextProcessor::renderContents() : Renders body content.
- TValidationSummary::renderContents() : Overrides parent implementation by rendering TValidationSummary-specific presentation.

renderEndTag (line 404)

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

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

- access: public

void setCssClass (string $value)

- string $value: the css class of the control

setForeColor (line 180)

- access: public

void setForeColor (string $value)

- string $value: the foreground color of the control

setHeight (line 218)

- access: public

void setHeight (string $value)

- string $value: the height of the control

setStyle (line 261)

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

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

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

- 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::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::broadcastEventInternal()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::createdOnTemplate()
> 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::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasControls()
> 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::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> 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::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> 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

Documentation generated on Sun, 04 Jun 2006 19:00:39 -0400 by phpDocumentor 1.3.0RC4