Class TWebControlDecorator

Description

TWebControlDecorator class

A TWebControlDecorator can be applied to a TWebControl to customize its rendering. TWebControlDecorator can add custom html code before and after both the open and close tag of a TWebControl. The html code can be an user-defined text or an external template file that will be instantiated and rendered in place.

This is an easy way to have your look and feel depend upon the theme instead of writing specific html in your templates to achieve your website desires. Here is an example of how to code your theme skin:

  1.  <com:THeader3>
  2.     <prop:Decorator.PreTagText>
  3.              <!-- Surround the control with a div and apply a css class to it -->
  4.         <div class="imported-theme-h3-container">
  5.     </prop:Decorator.PreTagText>
  6.     <prop:Decorator.PostTagText>
  7.              <!-- Properly close the tag -->
  8.         </div>
  9.     </prop:Decorator.PostTagText>
  10.  </com:THeader3>

The order of the inclusion of the decoration into the page goes like this: * PreTagTemplate * PreTagText * TWebControl Open Tag Rendered * PreContentsText * PreContentsTemplate * TWebControl Children Rendered * PostContentsTemplate * PostContentsText * TWebControl CloseTag Rendered * PostTagText * PostTagTemplate

  • author: Brad Anderson <javalizard@gmail.com>
  • version: $Id: TWebControlDecorator.php 2541 2008-10-21 15:05:13Z qiang.xue $
  • since: 3.2

Located in /Web/UI/WebControls/TWebControlDecorator.php (line 59)

TComponent
   |
   --TWebControlDecorator
Method Summary
TWebControlDecorator __construct (TWebControl $control, [boolean $onlyinternal = false])
boolean ensureTemplateDecoration ([TComponent $sender = null], [ $param = null])
string getPostTagText ()
string getPreContentsText ()
string getPreTagText ()
boolean getUseState ()
void instantiate ([ $outercontrol = null])
void renderPostContentsText ({@link $writer)
void renderPostTagText ({@link $writer)
void renderPreContentsText ({@link $writer)
void renderPreTagText ({@link $writer)
void setPostContentsText (string $value)
void setPostTagTemplate (TTemplate $value)
void setPostTagText (string $value)
void setPreContentsText (string $value)
void setPreTagTemplate (TTemplate $value)
void setPreTagText (string $value)
void setUseState (boolean $value)
Methods
Constructor __construct (line 130)

Constructor.

Initializes the control .

  • access: public
TWebControlDecorator __construct (TWebControl $control, [boolean $onlyinternal = false])
  • TWebControl $control: The control that is to be decorated.
  • boolean $onlyinternal: whether decoration is just around the inner content
ensureTemplateDecoration (line 306)

This method places the templates around the open and close tag. This takes a parameter which is

to specify the control to get the outer template decoration. If no outer control is specified

  • return: returns true if the template decorations have been added
  • access: public
boolean ensureTemplateDecoration ([TComponent $sender = null], [ $param = null])
  • TComponent $sender: this indicates the component or control to get the outer tag elements, just in case it's different than attached TWebControl. If none is provided, the outer templates default to the attached control
  • $param
getPostContentsTemplate (line 251)
  • return: the template before the close tag in the TWebControl. Defaults to null.
  • access: public
TTemplate|null getPostContentsTemplate ()
getPostContentsText (line 187)
  • return: the text before the close tag in the TWebControl
  • access: public
string getPostContentsText ()
getPostTagTemplate (line 267)
  • return: the template after the close tag in the TWebControl. Defaults to null.
  • access: public
TTemplate|null getPostTagTemplate ()
getPostTagText (line 203)
  • return: the text before the close tag in the TWebControl
  • access: public
string getPostTagText ()
getPreContentsTemplate (line 235)
  • return: the template after the open tag in the TWebControl. Defaults to null.
  • access: public
TTemplate|null getPreContentsTemplate ()
getPreContentsText (line 171)
  • return: the text after the open tag in the TWebControl
  • access: public
string getPreContentsText ()
getPreTagTemplate (line 219)
  • return: the template before the open tag in the TWebControl. Defaults to null.
  • access: public
TTemplate|null getPreTagTemplate ()
getPreTagText (line 155)
  • return: gets the text before the open tag in the TWebControl
  • access: public
string getPreTagText ()
getUseState (line 138)
  • return: if the templates in this decoration need state. This defaults to false
  • access: public
boolean getUseState ()
instantiate (line 285)

this is a framework call. The Text decoration can't influence the object hierarchy because they are rendered into into the writer directly.

This call attaches the ensureTemplateDecoration to the TPage onSaveStateComplete so these controls don't have page states. This is as close to not influencing the page as possible.

  • access: public
void instantiate ([ $outercontrol = null])
  • $outercontrol
renderPostContentsText (line 373)

This method places the post contents text into the TTextWriter

  • access: public
void renderPostContentsText ({@link $writer)
  • {@link $writer: TTextWriter} the writer to which the text is written
renderPostTagText (line 381)

This method places the post tag text into the TTextWriter

  • access: public
void renderPostTagText ({@link $writer)
  • {@link $writer: TTextWriter} the writer to which the text is written
renderPreContentsText (line 365)

This method places the pre contents text into the TTextWriter

  • access: public
void renderPreContentsText ({@link $writer)
  • {@link $writer: TTextWriter} the writer to which the text is written
renderPreTagText (line 357)

This method places the pre tag text into the TTextWriter

  • access: public
void renderPreTagText ({@link $writer)
  • {@link $writer: TTextWriter} the writer to which the text is written
setPostContentsTemplate (line 258)
  • access: public
void setPostContentsTemplate (TTemplate $value)
  • TTemplate $value: sets the template before the close tag in the TWebControl
setPostContentsText (line 194)
  • access: public
void setPostContentsText (string $value)
  • string $value: sets the text before the close tag in the TWebControl
setPostTagTemplate (line 274)
  • access: public
void setPostTagTemplate (TTemplate $value)
  • TTemplate $value: sets the template before the close tag in the TWebControl
setPostTagText (line 210)
  • access: public
void setPostTagText (string $value)
  • string $value: sets the text after the close tag in the TWebControl
setPreContentsTemplate (line 242)
  • access: public
void setPreContentsTemplate (TTemplate $value)
  • TTemplate $value: sets the template after the open tag in the TWebControl
setPreContentsText (line 178)
  • access: public
void setPreContentsText (string $value)
  • string $value: sets the text after the open tag in the TWebControl
setPreTagTemplate (line 226)
  • access: public
void setPreTagTemplate (TTemplate $value)
  • TTemplate $value: sets the template before the open tag in the TWebControl
setPreTagText (line 162)
  • access: public
void setPreTagText (string $value)
  • string $value: sets the text before the open tag in the TWebControl
setUseState (line 147)
  • access: public
void setUseState (boolean $value)
  • boolean $value: true to tell the decoration that the templates need state and should be placed in a control step before the state is saved.

Inherited 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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

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