|
Class TWebControlDecorator
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:
<com:THeader3>
<prop:Decorator.PreTagText>
<!-- Surround the control with a div and apply a css class to it -->
<div class="imported-theme-h3-container">
</prop:Decorator.PreTagText>
<prop:Decorator.PostTagText>
<!-- Properly close the tag -->
</div>
</prop:Decorator.PostTagText>
</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
-
TComponent
-
TWebControlDecorator
Methods summary
public
|
#
__construct( TWebControl $control, boolean $onlyinternal = false )
Constructor. Initializes the control .
Constructor. Initializes the control .
Parameters
- $control
TWebControl
The control that is to be decorated.
- $onlyinternal
boolean whether decoration is just around the inner content
Overrides
|
public
boolean
|
#
getUseState( )
Returns
boolean if the templates in this decoration need state. This defaults to false
|
public
|
#
setUseState( boolean $value )
Parameters
- $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.
|
public
string
|
#
getPreTagText( )
Returns
string gets the text before the open tag in the TWebControl
|
public
|
#
setPreTagText( string $value )
Parameters
- $value
string sets the text before the open tag in the TWebControl
|
public
string
|
#
getPreContentsText( )
Returns
string the text after the open tag in the TWebControl
|
public
|
#
setPreContentsText( string $value )
Parameters
- $value
string sets the text after the open tag in the TWebControl
|
public
string
|
#
getPostContentsText( )
Returns
string the text before the close tag in the TWebControl
|
public
|
#
setPostContentsText( string $value )
Parameters
- $value
string sets the text before the close tag in the TWebControl
|
public
string
|
#
getPostTagText( )
Returns
string the text before the close tag in the TWebControl
|
public
|
#
setPostTagText( string $value )
Parameters
- $value
string sets the text after the close tag in the TWebControl
|
public
TTemplate |null
|
#
getPreTagTemplate( )
Returns
TTemplate |null
the template before the open tag in the TWebControl. Defaults to null.
|
public
|
#
setPreTagTemplate( TTemplate $value )
Parameters
- $value
TTemplate
sets the template before the open tag in the TWebControl
|
public
TTemplate |null
|
#
getPreContentsTemplate( )
Returns
TTemplate |null
the template after the open tag in the TWebControl. Defaults to null.
|
public
|
#
setPreContentsTemplate( TTemplate $value )
Parameters
- $value
TTemplate
sets the template after the open tag in the TWebControl
|
public
TTemplate |null
|
#
getPostContentsTemplate( )
Returns
TTemplate |null
the template before the close tag in the TWebControl. Defaults to null.
|
public
|
#
setPostContentsTemplate( TTemplate $value )
Parameters
- $value
TTemplate
sets the template before the close tag in the TWebControl
|
public
TTemplate |null
|
#
getPostTagTemplate( )
Returns
TTemplate |null
the template after the close tag in the TWebControl. Defaults to null.
|
public
|
#
setPostTagTemplate( TTemplate $value )
Parameters
- $value
TTemplate
sets the template before the close tag in the TWebControl
|
public
|
#
instantiate( mixed $outercontrol = null )
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.
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.
|
public
boolean
|
#
ensureTemplateDecoration( TComponent $sender = null, mixed $param = null )
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
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
Parameters
- $sender
TComponent
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
Returns
boolean returns true if the template decorations have been added
|
public
|
#
renderPreTagText( {@link $writer )
This method places the pre tag text into the TTextWriter
This method places the pre tag text into the TTextWriter
Parameters
- $writer
{@link TTextWriter} the writer to which the text is written
|
public
|
#
renderPreContentsText( {@link $writer )
This method places the pre contents text into the TTextWriter
This method places the pre contents text into the TTextWriter
Parameters
- $writer
{@link TTextWriter} the writer to which the text is written
|
public
|
#
renderPostContentsText( {@link $writer )
This method places the post contents text into the TTextWriter
This method places the post contents text into the TTextWriter
Parameters
- $writer
{@link TTextWriter} the writer to which the text is written
|
public
|
#
renderPostTagText( {@link $writer )
This method places the post tag text into the TTextWriter
This method places the post tag text into the TTextWriter
Parameters
- $writer
{@link TTextWriter} the writer to which the text is written
|
Methods inherited from TComponent
__call(),
__destruct(),
__get(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
addParsedObject(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
|