Class TWebControl
Direct Known Sub-classes:
TTableRow
, TLabel
, TPager
, TPanel
, TJavascriptLogger
, TDataBoundControl
, TTextProcessor
, TValidationSummary
, TDataListItem
, TImage
, THtmlElement
, TSlider
, TButton
, TClientScriptLoader
, TTabPanel
, TTabView
, TTextBox
, TInlineFrame
, TCheckBox
, TTableCell
, TWizard
, TTable
, TLinkButton
, TKeyboard
, TFileUpload
, THyperLink
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.
Constants Inherited From TControl |
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID,
|
Method Summary |
protected
void
|
Adds attribute name-value pairs to renderer.
|
void
|
Removes all style data.
|
void
|
Copies basic control attributes from another control.
|
protected
TStyle
|
Creates a style object to be used by the control.
|
string
|
|
string
|
|
string
|
|
string
|
|
string
|
|
string
|
|
TDisplayStyle
|
|
TFont
|
|
string
|
|
boolean
|
|
string
|
|
TStyle
|
|
integer
|
|
protected
string
|
Returns the tag name used for this control.
|
string
|
|
string
|
|
void
|
Renders the control.
|
void
|
Renders the openning tag for the control (including attributes)
|
void
|
Renders the body content enclosed between the control tag.
|
void
|
Renders the closing tag for the control
|
void
|
Sets the access key of the control.
|
void
|
|
void
|
|
void
|
|
void
|
|
void
|
|
void
|
|
void
|
|
void
|
|
void
|
Sets the css style string of the control.
|
void
|
Sets the tab index of the control.
|
void
|
Sets the tooltip of the control.
|
void
|
|
Methods Inherited From TControl |
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()
|
Methods 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()
|
Method Details |
addAttributesToRender
protected void addAttributesToRender |
(THtmlWriter $writer ) |
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.
Input |
THtmlWriter | $writer | the writer used for the rendering purpose |
Output |
Exception |
|
clearStyle
public void clearStyle |
() |
Removes all style data.
|
copyBaseAttributes
public void copyBaseAttributes |
(TWebControl $control ) |
Copies basic control attributes from another control.
Properties including AccessKey, ToolTip, TabIndex, Enabled and Attributes are copied.
Input |
TWebControl | $control | source control |
Output |
Exception |
|
createStyle
protected TStyle createStyle |
() |
Creates a style object to be used by the control.
This method may be overriden by controls to provide customized style.
Output |
TStyle
| the default style created for TWebControl |
Exception |
|
getAccessKey
public string getAccessKey |
() |
Output |
string
| the access key of the control |
Exception |
|
getBackColor
public string getBackColor |
() |
Output |
string
| the background color of the control |
Exception |
|
getBorderColor
public string getBorderColor |
() |
Output |
string
| the border color of the control |
Exception |
|
getBorderStyle
public string getBorderStyle |
() |
Output |
string
| the border style of the control |
Exception |
|
getBorderWidth
public string getBorderWidth |
() |
Output |
string
| the border width of the control |
Exception |
|
getCssClass
public string getCssClass |
() |
Output |
string
| the css class of the control |
Exception |
|
getDisplay
Output |
TDisplayStyle
| display style of the control, default is TDisplayStyle::Fixed |
Exception |
|
getFont
Output |
TFont
| the font of the control |
Exception |
|
getForeColor
public string getForeColor |
() |
Output |
string
| the foreground color of the control |
Exception |
|
getHasStyle
public boolean getHasStyle |
() |
Output |
boolean
| whether the control has defined any style information |
Exception |
|
getHeight
public string getHeight |
() |
Output |
string
| the height of the control |
Exception |
|
getStyle
Output |
TStyle
| the object representing the css style of the control |
Exception |
|
getTabIndex
public integer getTabIndex |
() |
Output |
integer
| the tab index of the control |
Exception |
|
getTagName
protected string getTagName |
() |
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.
Output |
string
| tag name of the control to be rendered |
Exception |
|
getToolTip
public string getToolTip |
() |
Output |
string
| the tooltip of the control |
Exception |
|
getWidth
public string getWidth |
() |
Output |
string
| the width of the control |
Exception |
|
render
Renders the control.
This method overrides the parent implementation by replacing it with the following sequence:
Input |
THtmlWriter | $writer | the writer used for the rendering purpose |
Output |
Exception |
|
renderBeginTag
Renders the openning tag for the control (including attributes)
Input |
THtmlWriter | $writer | the writer used for the rendering purpose |
Output |
Exception |
|
renderContents
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.
Input |
THtmlWriter | $writer | the writer used for the rendering purpose |
Output |
Exception |
|
renderEndTag
Renders the closing tag for the control
Input |
THtmlWriter | $writer | the writer used for the rendering purpose |
Output |
Exception |
|
setAccessKey
public void setAccessKey |
(string $value ) |
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.
Input |
string | $value | the access key to be set |
Output |
Exception |
throws | TInvalidDataValueException if the access key is specified with more than one character |
|
setBackColor
public void setBackColor |
(string $value ) |
Input |
string | $value | the background color of the control |
Output |
Exception |
|
setBorderColor
public void setBorderColor |
(string $value ) |
Input |
string | $value | the border color of the control |
Output |
Exception |
|
setBorderStyle
public void setBorderStyle |
(string $value ) |
Input |
string | $value | the border style of the control |
Output |
Exception |
|
setBorderWidth
public void setBorderWidth |
(string $value ) |
Input |
string | $value | the border width of the control |
Output |
Exception |
|
setCssClass
public void setCssClass |
(string $value ) |
Input |
string | $value | the css class of the control |
Output |
Exception |
|
setDisplay
Input |
TDisplayStyle | $value | display style of the control, default is TDisplayStyle::Fixed |
Output |
Exception |
|
setForeColor
public void setForeColor |
(string $value ) |
Input |
string | $value | the foreground color of the control |
Output |
Exception |
|
setHeight
public void setHeight |
(string $value ) |
Input |
string | $value | the height of the control |
Output |
Exception |
|
setStyle
public void setStyle |
(string $value ) |
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).
Input |
string | $value | the css style string |
Output |
Exception |
throws | TInvalidDataValueException if the parameter is not a string |
|
setTabIndex
public void setTabIndex |
(integer $value ) |
Sets the tab index of the control.
Pass 0 if you want to disable tab index.
Input |
integer | $value | the tab index to be set |
Output |
Exception |
|
setToolTip
public void setToolTip |
(string $value ) |
Sets the tooltip of the control.
Pass an empty string if you want to disable tooltip.
Input |
string | $value | the tooltip to be set |
Output |
Exception |
|
setWidth
public void setWidth |
(string $value ) |
Input |
string | $value | the width of the control |
Output |
Exception |
|
|