## Class TTabPanel

Description

Implements interfaces:

- IPostBackDataHandler

Class TTabPanel.

TTabPanel displays a tabbed panel. Users can click on the tab bar to switching among different tab views. Each tab view is an independent panel that can contain arbitrary content.

A TTabPanel control consists of one or several TTabView controls representing the possible tab views. At any time, only one tab view is visible (active), which is specified by any of the following properties:

- ActiveViewIndex - the zero-based integer index of the view in the view collection.
- ActiveViewID - the text ID of the visible view.
- ActiveView - the visible view instance.

If both ActiveViewIndex and ActiveViewID are set, the latter takes precedence.

TTabPanel uses CSS to specify the appearance of the tab bar and panel. By default, an embedded CSS file will be published which contains the default CSS for TTabPanel. You may also use your own CSS file by specifying the CssUrl property. The following properties specify the CSS classes used for elements in a TTabPanel:

- CssClass - the CSS class name for the outer-most div element (defaults to 'tab-panel');
- TabCssClass - the CSS class name for nonactive tab div elements (defaults to 'tab-normal');
- ActiveTabCssClass - the CSS class name for the active tab div element (defaults to 'tab-active');
- ViewCssClass - the CSS class for the div element enclosing view content (defaults to 'tab-view');

To use TTabPanel, write a template like following:

     <com:TTabPanel>
       <com:TTabView Caption="View 1">
         content for view 1
       </com:TTabView>
       <com:TTabView Caption="View 2">
         content for view 2
       </com:TTabView>
       <com:TTabView Caption="View 3">
         content for view 3
       </com:TTabView>
     </com:TTabPanel>

- since: 3.1.1
- version: $Id: TTabPanel.php 2773 2010-02-17 13:55:18Z Christophe.Boulain $
- author: Tomasz Wolny <tomasz.wolny@polecam.to.pl> and Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TTabPanel.php (line 58)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TTabPanel

Method Summary
void activateView (TTabView $view)
void addAttributesToRender (THtmlWriter $writer)
void addParsedObject (mixed $object)
TTabViewCollection createControlCollection ()
string getActiveTabCssClass ()
TStyle getActiveTabStyle ()
TTabView getActiveView ()
string getActiveViewID ()
integer getActiveViewIndex ()
string getClientClassName ()
array getClientOptions ()
string getCssClass ()
string getCssUrl ()
boolean getDataChanged ()
string getTabCssClass ()
TStyle getTabStyle ()
string getTagName ()
string getViewCssClass ()
TTabViewCollection getViews ()
TStyle getViewStyle ()
boolean loadPostData (string $key, array $values)
void onPreRender (mixed $param)
void raisePostDataChangedEvent ()
void registerClientScript ()
void registerStyleSheet ()
void renderContents (THtmlWriter $writer)
void setActiveTabCssClass (string $value)
void setActiveView (TTabView $view)
void setActiveViewID (string $value)
void setActiveViewIndex (integer $value)
void setCssUrl (string $value)
void setTabCssClass (string $value)
void setViewCssClass (string $value)
Methods
activateView (line 294)

Activates the specified view.

If there is any other view currently active, it will be deactivated.

- access: protected

void activateView (TTabView $view)

- TTabView $view: the view to be activated. If null, all views will be deactivated.

addAttributesToRender (line 360)

Adds attributes to renderer.

- access: protected

void addAttributesToRender (THtmlWriter $writer)

- THtmlWriter $writer: the renderer

Redefinition of:

TWebControl::addAttributesToRender()
  Adds attribute name-value pairs to renderer.

addParsedObject (line 76)

Adds object parsed from template to the control.

This method adds only TTabView objects into the Views collection. All other objects are ignored.

- access: public

void addParsedObject (mixed $object)

- mixed $object: object parsed from template

Redefinition of:

TControl::addParsedObject()
  Adds the object instantiated on a template to the child control collection.

createControlCollection (line 453)

Creates a control collection object that is to be used to hold child controls

- return: control collection
- access: protected

TTabViewCollection createControlCollection ()

Redefinition of:

TControl::createControlCollection()
  Creates a control collection object that is to be used to hold child controls

getActiveTabCssClass (line 262)

- return: CSS class for the active tab. Defaults to 'tab-active'.
- access: public

string getActiveTabCssClass ()
getActiveTabStyle (line 278)

- return: the style for the active tab div
- access: public

TStyle getActiveTabStyle ()
getActiveView (line 128)

Returns the currently active view.

This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly.

- return: the currently active view, null if no active view
- access: public
- throws: TInvalidDataValueException if the active view ID or index set previously is invalid

TTabView getActiveView ()
getActiveViewID (line 108)

Returns the ID of the active tab view.

Note, this property may not return the correct ID. To ensure the correctness, call getActiveView() first.

- return: The ID of the active tab view. Defaults to '', meaning not set.
- access: public

string getActiveViewID ()
getActiveViewIndex (line 88)

Returns the index of the active tab view.

Note, this property may not return the correct index. To ensure the correctness, call getActiveView() first.

- return: the zero-based index of the active tab view. If -1, it means no active tab view. Default is 0 (the first view is active).
- access: public

integer getActiveViewIndex ()
getClientClassName (line 425)

Gets the name of the javascript class responsible for performing postback for this control.

This method overrides the parent implementation.

- return: the javascript class name
- access: protected

string getClientClassName ()
getClientOptions (line 433)

- return: the options for JavaScript
- access: protected

array getClientOptions ()
getCssClass (line 193)

- return: CSS class for the whole tab control div. Defaults to 'tab-panel'.
- access: public

string getCssClass ()

Redefinition of:

TWebControl::getCssClass()

getCssUrl (line 177)

- return: URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
- access: public

string getCssUrl ()
getDataChanged (line 351)

Returns a value indicating whether postback has caused the control data change.

This method is required by the IPostBackDataHandler interface.

- return: whether postback has caused the control data change. False if the page is not in postback mode.
- access: public

boolean getDataChanged ()
getTabCssClass (line 232)

- return: CSS class for non-active tabs. Defaults to 'tab-normal'.
- access: public

string getTabCssClass ()
getTabStyle (line 248)

- return: the style for all the inactive tab div
- access: public

TStyle getTabStyle ()
getTagName (line 65)

- return: tag name for the control
- access: protected

string getTagName ()

Redefinition of:

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

getViewCssClass (line 202)

- return: CSS class for the currently displayed view div. Defaults to 'tab-view'.
- access: public

string getViewCssClass ()
getViews (line 461)

- return: list of TTabView controls
- access: public

TTabViewCollection getViews ()
getViewStyle (line 218)

- return: the style for all the view div
- access: public

TStyle getViewStyle ()
loadPostData (line 318)

Loads user input data.

This method is primarly used by framework developers.

- return: whether the data of the control has been changed
- access: public

boolean loadPostData (string $key, array $values)

- string $key: the key that can be used to retrieve data from the input data collection
- array $values: the input data collection

onPreRender (line 372)

Registers CSS and JS.

This method is invoked right before the control rendering, if the control is visible.

- access: public

void onPreRender (mixed $param)

- mixed $param: event parameter

Redefinition of:

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

raisePostDataChangedEvent (line 341)

Raises postdata changed event.

This method is required by IPostBackDataHandler interface. It is invoked by the framework when ActiveViewIndex property is changed on postback. This method is primarly used by framework developers.

- access: public

void raisePostDataChangedEvent ()
registerClientScript (line 405)

Registers the relevant JavaScript.

- access: protected

void registerClientScript ()
registerStyleSheet (line 385)

Registers the CSS relevant to the TTabControl.

It will register the CSS file specified by CssUrl. If that is not set, it will use the default CSS.

- access: protected

void registerStyleSheet ()
renderContents (line 470)

Renders body contents of the tab control.

- access: public

void renderContents (THtmlWriter $writer)

- THtmlWriter $writer: the writer used for the rendering purpose.

Redefinition of:

TWebControl::renderContents()
  Renders the body content enclosed between the control tag.

setActiveTabCssClass (line 270)

- access: public

void setActiveTabCssClass (string $value)

- string $value: CSS class for the active tab.

setActiveView (line 166)

- access: public
- throws: TInvalidOperationException if the view is not in the view collection

void setActiveView (TTabView $view)

- TTabView $view: the view to be activated

setActiveViewID (line 116)

- access: public

void setActiveViewID (string $value)

- string $value: The ID of the active tab view.

setActiveViewIndex (line 97)

- access: public
- throws: TInvalidDataValueException if the view index is invalid

void setActiveViewIndex (integer $value)

- integer $value: the zero-based index of the current view in the view collection. -1 if no active view.

setCssUrl (line 185)

- access: public

void setCssUrl (string $value)

- string $value: URL for the CSS file including all relevant CSS class definitions.

setTabCssClass (line 240)

- access: public

void setTabCssClass (string $value)

- string $value: CSS class for non-active tabs.

setViewCssClass (line 210)

- access: public

void setViewCssClass (string $value)

- string $value: CSS class for the currently displayed view div.

#### Inherited Methods

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:50 +0000 by phpDocumentor 1.3.0RC4