PHP Class Prado\Web\UI\WebControls\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. If the {@link setAutoSwitch AutoSwitch} property is enabled, the user will be able to switch the active view to another one just hovering its corresponding tab caption. A TTabPanel control consists of one or several {@link 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: - {@link setActiveViewIndex ActiveViewIndex} - the zero-based integer index of the view in the view collection. - {@link setActiveViewID ActiveViewID} - the text ID of the visible view. - {@link setActiveView ActiveView} - the visible view instance. If both {@link setActiveViewIndex ActiveViewIndex} and {@link setActiveViewID 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 {@link setCssUrl CssUrl} property. The following properties specify the CSS classes used for elements in a TTabPanel: - {@link setCssClass CssClass} - the CSS class name for the outer-most div element (defaults to 'tab-panel'); - {@link setTabCssClass TabCssClass} - the CSS class name for nonactive tab div elements (defaults to 'tab-normal'); - {@link setActiveTabCssClass ActiveTabCssClass} - the CSS class name for the active tab div element (defaults to 'tab-active'); - {@link setViewCssClass ViewCssClass} - the CSS class for the div element enclosing view content (defaults to 'tab-view'); To use TTabPanel, write a template like following: content for view 1 content for view 2 content for view 3
Since: 3.1.1
Inheritance: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler
显示文件 Open project: pradosoft/prado

Public Methods

Method Description
addParsedObject ( $object ) Adds object parsed from template to the control.
getActiveTabCssClass ( ) : string
getActiveTabStyle ( ) : TStyle
getActiveView ( ) : TTabView Returns the currently active view.
getActiveViewID ( ) : string Returns the ID of the active tab view.
getActiveViewIndex ( ) : integer Returns the index of the active tab view.
getAutoSwitch ( ) : boolean
getCssClass ( ) : string
getCssUrl ( ) : string
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getTabCssClass ( ) : string
getTabStyle ( ) : TStyle
getViewCssClass ( ) : string
getViewStyle ( ) : TStyle
getViews ( ) : TTabViewCollection
loadPostData ( $key, $values ) : boolean Loads user input data.
onPreRender ( $param ) Registers CSS and JS.
raisePostDataChangedEvent ( ) Raises postdata changed event.
render ( $writer )
renderContents ( $writer ) Renders body contents of the tab control.
setActiveTabCssClass ( $value )
setActiveView ( $view )
setActiveViewID ( $value )
setActiveViewIndex ( $value )
setAutoSwitch ( $value )
setCssUrl ( $value )
setTabCssClass ( $value )
setViewCssClass ( $value )

Protected Methods

Method Description
activateView ( $view ) Activates the specified view.
addAttributesToRender ( $writer ) Adds attributes to renderer.
createControlCollection ( ) : TTabViewCollection Creates a control collection object that is to be used to hold child controls
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getClientOptions ( ) : array
getTagName ( ) : string
registerClientScript ( ) Registers the relevant JavaScript.
registerStyleSheet ( ) Registers the CSS relevant to the TTabControl.

Method Details

activateView() protected method

If there is any other view currently active, it will be deactivated.
protected activateView ( $view )

addAttributesToRender() protected method

Adds attributes to renderer.
protected addAttributesToRender ( $writer )

addParsedObject() public method

This method adds only {@link TTabView} objects into the {@link getViews Views} collection. All other objects are ignored.
public addParsedObject ( $object )

createControlCollection() protected method

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

getActiveTabCssClass() public method

public getActiveTabCssClass ( ) : string
return string CSS class for the active tab. Defaults to 'tab-active'.

getActiveTabStyle() public method

public getActiveTabStyle ( ) : TStyle
return TStyle the style for the active tab div

getActiveView() public method

This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly.
public getActiveView ( ) : TTabView
return TTabView the currently active view, null if no active view

getActiveViewID() public method

Note, this property may not return the correct ID. To ensure the correctness, call {@link getActiveView()} first.
public getActiveViewID ( ) : string
return string The ID of the active tab view. Defaults to '', meaning not set.

getActiveViewIndex() public method

Note, this property may not return the correct index. To ensure the correctness, call {@link getActiveView()} first.
public getActiveViewIndex ( ) : integer
return integer 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).

getAutoSwitch() public method

public getAutoSwitch ( ) : boolean
return boolean status of automatic tab switch on hover

getClientClassName() protected method

This method overrides the parent implementation.
protected getClientClassName ( ) : string
return string the javascript class name

getClientOptions() protected method

protected getClientOptions ( ) : array
return array the options for JavaScript

getCssClass() public method

public getCssClass ( ) : string
return string CSS class for the whole tab control div. Defaults to 'tab-panel'.

getCssUrl() public method

public getCssUrl ( ) : string
return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.

getDataChanged() public method

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
return boolean whether postback has caused the control data change. False if the page is not in postback mode.

getTabCssClass() public method

public getTabCssClass ( ) : string
return string CSS class for non-active tabs. Defaults to 'tab-normal'.

getTabStyle() public method

public getTabStyle ( ) : TStyle
return TStyle the style for all the inactive tab div

getTagName() protected method

protected getTagName ( ) : string
return string tag name for the control

getViewCssClass() public method

public getViewCssClass ( ) : string
return string CSS class for the currently displayed view div. Defaults to 'tab-view'.

getViewStyle() public method

public getViewStyle ( ) : TStyle
return TStyle the style for all the view div

getViews() public method

public getViews ( ) : TTabViewCollection
return TTabViewCollection list of {@link TTabView} controls

loadPostData() public method

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
return boolean whether the data of the control has been changed

onPreRender() public method

This method is invoked right before the control rendering, if the control is visible.
public onPreRender ( $param )

raisePostDataChangedEvent() public method

This method is required by {@link \Prado\Web\UI\IPostBackDataHandler} interface. It is invoked by the framework when {@link getActiveViewIndex ActiveViewIndex} property is changed on postback. This method is primarly used by framework developers.

registerClientScript() protected method

Registers the relevant JavaScript.
protected registerClientScript ( )

registerStyleSheet() protected method

It will register the CSS file specified by {@link getCssUrl CssUrl}. If that is not set, it will use the default CSS.
protected registerStyleSheet ( )

render() public method

public render ( $writer )

renderContents() public method

Renders body contents of the tab control.
public renderContents ( $writer )

setActiveTabCssClass() public method

public setActiveTabCssClass ( $value )

setActiveView() public method

public setActiveView ( $view )

setActiveViewID() public method

public setActiveViewID ( $value )

setActiveViewIndex() public method

public setActiveViewIndex ( $value )

setAutoSwitch() public method

public setAutoSwitch ( $value )

setCssUrl() public method

public setCssUrl ( $value )

setTabCssClass() public method

public setTabCssClass ( $value )

setViewCssClass() public method

public setViewCssClass ( $value )