## Class TTextHighlighter

Description

TTextHighlighter class.

TTextHighlighter does syntax highlighting its body content, including static text and rendering results of child controls. You can set Language to specify what kind of syntax the body content is. Currently, TTextHighlighter supports the following languages: ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT, MYSQL, PERL, PHP, PYTHON, RUBY, SQL, XML and PRADO, where PRADO refers to PRADO template syntax. By setting ShowLineNumbers to true, the highlighted result may be shown with line numbers.

Note, TTextHighlighter requires THead to be placed on the page template because it needs to insert some CSS styles.

- since: 3.0
- version: $Id: TTextHighlighter.php 2541 2008-10-21 15:05:13Z qiang.xue $
- author: Wei Zhuo<weizhuo[at]gmail[dot]com>

Located in /Web/UI/WebControls/TTextHighlighter.php (line 38)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TTextProcessor
                   |
                   --TTextHighlighter

Direct descendents

Class | Description
--- | ---
TMarkdown | TMarkdown class

Method Summary
boolean getEnableCopyCode ()
string getHeaderTemplate ()
string getLanguage ()
TTextHighlighterLineNumberStyle getLineNumberStyle ()
boolean getShowLineNumbers ()
integer getTabSize ()
string getTagName ()
void onPreRender (THtmlWriter $writer)
string processText (string $text)
void registerStyleSheet ()
void setEnableCopyCode (boolean $value)
void setLanguage (string $value)
void setLineNumberStyle (TTextHighlighterLineNumberStyle $value)
void setShowLineNumbers (boolean $value)
void setTabSize (integer $value)
Methods
getEnableCopyCode (line 90)

- return: true will show "Copy Code" link. Defaults to false.
- access: public

boolean getEnableCopyCode ()
getHeaderTemplate (line 189)

- return: header template with "Copy code" link.
- access: protected

string getHeaderTemplate ()
getLanguage (line 53)

- return: language whose syntax is to be used for highlighting. Defaults to 'php'.
- access: public

string getLanguage ()
getLineNumberStyle (line 106)

- return: style of row number, Table by default
- access: public

TTextHighlighterLineNumberStyle getLineNumberStyle ()
getShowLineNumbers (line 74)

- return: whether to show line numbers in the highlighted result.
- access: public

boolean getShowLineNumbers ()
getTabSize (line 122)

- return: tab size. Defaults to 4.
- access: public

integer getTabSize ()
getTagName (line 45)

- return: tag name of the panel
- access: protected

string getTagName ()

Redefinition of:

TWebControl::getTagName()
  Returns the tag name used for this control.

onPreRender (line 140)

Registers css style for the highlighted result.

This method overrides parent implementation.

- access: public

void onPreRender (THtmlWriter $writer)

- THtmlWriter $writer: writer

Redefinition of:

TControl::onPreRender()
  This method is invoked when the control enters 'OnPreRender' stage.

processText (line 165)

Processes a text string.

This method is required by the parent class.

- return: the processed text result
- access: public

string processText (string $text)

- string $text: text string to be processed

Redefinition of:

TTextProcessor::processText()
  Processes a text string.

Redefined in descendants as:

- TMarkdown::processText() : Processes a text string.

registerStyleSheet (line 150)

Registers the stylesheet for presentation.

- access: protected

void registerStyleSheet ()
setEnableCopyCode (line 98)

- access: public

void setEnableCopyCode (boolean $value)

- boolean $value: true to show the "Copy Code" link.

setLanguage (line 66)

- access: public

void setLanguage (string $value)

- string $value: language (case-insensitive) whose syntax is to be used for highlighting. Valid values are those file names (without suffix) that are contained in '3rdParty/TextHighlighter/Text/Highlighter'. Currently, the following languages are supported: ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT, MYSQL, PERL, PHP, PRADO, PYTHON, RUBY, SQL, XML If a language is not supported, it will be displayed as plain text.

setLineNumberStyle (line 114)

- access: public

void setLineNumberStyle (TTextHighlighterLineNumberStyle $value)

- TTextHighlighterLineNumberStyle $value: style of row number

setShowLineNumbers (line 82)

- access: public

void setShowLineNumbers (boolean $value)

- boolean $value: whether to show line numbers in the highlighted result.

setTabSize (line 130)

- access: public

void setTabSize (integer $value)

- integer $value: tab size

#### Inherited Methods

Inherited From TTextProcessor

> TTextProcessor::addParsedObject()
> TTextProcessor::getText()
> TTextProcessor::processText()
> TTextProcessor::renderContents()
> TTextProcessor::setText()

Inherited From TWebControl

> TWebControl::addAttributesToRender()
> TWebControl::clearStyle()
> TWebControl::copyBaseAttributes()
> TWebControl::createStyle()
> TWebControl::getAccessKey()
> TWebControl::getBackColor()
> TWebControl::getBorderColor()
> TWebControl::getBorderStyle()
> TWebControl::getBorderWidth()
> TWebControl::getCssClass()
> TWebControl::getDisplay()
> TWebControl::getFont()
> TWebControl::getForeColor()
> TWebControl::getHasStyle()
> TWebControl::getHeight()
> TWebControl::getStyle()
> TWebControl::getTabIndex()
> TWebControl::getTagName()
> TWebControl::getToolTip()
> TWebControl::getWidth()
> TWebControl::render()
> TWebControl::renderBeginTag()
> TWebControl::renderContents()
> TWebControl::renderEndTag()
> TWebControl::setAccessKey()
> TWebControl::setBackColor()
> TWebControl::setBorderColor()
> TWebControl::setBorderStyle()
> TWebControl::setBorderWidth()
> TWebControl::setCssClass()
> TWebControl::setDisplay()
> TWebControl::setForeColor()
> TWebControl::setHeight()
> TWebControl::setStyle()
> TWebControl::setTabIndex()
> TWebControl::setToolTip()
> TWebControl::setWidth()

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 Mon, 22 Feb 2010 12:18:53 +0000 by phpDocumentor 1.3.0RC4