Class TAccordion

Description

Implements interfaces:

Class TAccordion.

TAccordion displays an accordion control. Users can click on the view headers to switch among different accordion views. Each accordion view is an independent panel that can contain arbitrary content.

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

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

TAccordion uses CSS to specify the appearance of the accordion headers 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 TAccordion:

  • CssClass - the CSS class name for the outer-most div element (defaults to 'accordion');
  • HeaderCssClass - the CSS class name for nonactive accordion div elements (defaults to 'accordion-header');
  • ActiveHeaderCssClass - the CSS class name for the active accordion div element (defaults to 'accordion-header-active');
  • ViewCssClass - the CSS class for the div element enclosing view content (defaults to 'accordion-view');
When the user clicks on a view header, the switch between the old visible view and the clicked one is animated. You can use the AnimationDuration property to set the animation length in seconds; it defaults to 1 second, and when set to 0 it will produce an immediate switch with no animation.

The TAccordion auto-sizes itself to the largest of all views, so it can encompass all of them without scrolling. If you want to specify a fixed height (in pixels), use the ViewHeight property. When a TAccordion is nested inside another, it's adviced to manually specify a ViewHeight for the internal TAccordion

To use TAccordion, write a template like following:

  1.  <com:TAccordion>
  2.    <com:TAccordionView Caption="View 1">
  3.      content for view 1
  4.    </com:TAccordionView>
  5.    <com:TAccordionView Caption="View 2">
  6.      content for view 2
  7.    </com:TAccordionView>
  8.    <com:TAccordionView Caption="View 3">
  9.      content for view 3
  10.    </com:TAccordionView>
  11.  </com:TAccordion>

  • author: Gabor Berczi, DevWorx Hungary <gabor.berczi@devworx.hu>
  • version: $Id: TAccordion.php 2915 2011-05-15 16:26:11Z ctrlaltca@gmail.com $
  • since: 3.2

Located in /Web/UI/WebControls/TAccordion.php (line 67)

TComponent
   |
   --TApplicationComponent
      |
      --TControl
         |
         --TWebControl
            |
            --TAccordion
Method Summary
void addParsedObject (mixed $object)
string getActiveViewID ()
integer getActiveViewIndex ()
string getClientClassName ()
array getClientOptions ()
string getCssClass ()
string getCssUrl ()
boolean getDataChanged ()
string getHeaderCssClass ()
string getTagName ()
string getViewCssClass ()
integer getViewHeight ()
boolean loadPostData (string $key, array $values)
void onPreRender (mixed $param)
void render ( $writer)
void renderContents (THtmlWriter $writer)
void setActiveHeaderCssClass (string $value)
void setActiveViewID (string $value)
void setActiveViewIndex (integer $value)
void setAnimationDuration (string $value)
void setCssUrl (string $value)
void setHeaderCssClass (string $value)
void setViewCssClass (string $value)
void setViewHeight (integer $value)
Variables

Inherited Variables

Inherited from TWebControl

TWebControl::$_decorator
Methods
activateView (line 335)

Activates the specified view.

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

  • access: protected
void activateView (TAccordionView $view)
  • TAccordionView $view: the view to be activated. If null, all views will be deactivated.
addAttributesToRender (line 401)

Adds attributes to renderer.

  • access: protected
void addAttributesToRender (THtmlWriter $writer)

Redefinition of:
TWebControl::addAttributesToRender()
Adds attribute name-value pairs to renderer.
addParsedObject (line 85)

Adds object parsed from template to the control.

This method adds only TAccordionView 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 498)

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

  • return: control collection
  • access: protected
TAccordionViewCollection createControlCollection ()

Redefinition of:
TControl::createControlCollection()
Creates a control collection object that is to be used to hold child controls
getActiveHeaderCssClass (line 287)
  • return: Extra CSS class for the active header. Defaults to 'accordion-header-active'.
  • access: public
string getActiveHeaderCssClass ()
getActiveHeaderStyle (line 303)
  • return: the style for the active header div
  • access: public
TStyle getActiveHeaderStyle ()
getActiveView (line 137)

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
  • throws: TInvalidDataValueException if the active view ID or index set previously is invalid
  • access: public
TAccordionView getActiveView ()
getActiveViewID (line 117)

Returns the ID of the active accordion view.

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

  • return: The ID of the active accordion view. Defaults to '', meaning not set.
  • access: public
string getActiveViewID ()
getActiveViewIndex (line 97)

Returns the index of the active accordion 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 accordion view. If -1, it means no active accordion view. Default is 0 (the first view is active).
  • access: public
integer getActiveViewIndex ()
getAnimationDuration (line 227)
  • return: CSS class for the currently displayed view div. Defaults to 'accordion-view'.
  • access: public
string getAnimationDuration ()
getClientClassName (line 469)

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 477)
  • return: the options for JavaScript
  • access: protected
array getClientOptions ()
getCssClass (line 202)
  • return: CSS class for the whole accordion control div.
  • access: public
string getCssClass ()

Redefinition of:
TWebControl::getCssClass()
getCssUrl (line 186)
  • return: URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
  • access: public
string getCssUrl ()
getDataChanged (line 392)

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 ()
getHeaderCssClass (line 257)
  • return: CSS class for view headers. Defaults to 'accordion-header'.
  • access: public
string getHeaderCssClass ()
getHeaderStyle (line 273)
  • return: the style for all the inactive header div
  • access: public
TStyle getHeaderStyle ()
getTagName (line 74)
  • return: tag name for the control
  • access: protected
string getTagName ()

Redefinition of:
TWebControl::getTagName()
Returns the tag name used for this control.
getViewCssClass (line 211)
  • return: CSS class for the currently displayed view div. Defaults to 'accordion-view'.
  • access: public
string getViewCssClass ()
getViewHeight (line 317)
  • return: Maximum height for the accordion views. If non specified, the accordion will auto-sized to the largest of all views, so it can encompass all of them without scrolling
  • access: public
integer getViewHeight ()
getViews (line 506)
getViewStyle (line 243)
  • return: the style for all the view div
  • access: public
TStyle getViewStyle ()
loadPostData (line 359)

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 413)

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:
TWebControl::onPreRender()
If your subclass overrides the onPreRender method be sure to call this method through parent::onPreRender($param); so your sub-class can be decorated, among other things.
raisePostDataChangedEvent (line 382)

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 445)

Registers the relevant JavaScript.

  • access: protected
void registerClientScript ()
registerStyleSheet (line 425)

Registers the CSS relevant to the TAccordion.

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

  • access: protected
void registerStyleSheet ()
render (line 511)
  • access: public
void render ( $writer)
  • $writer

Redefinition of:
TWebControl::render()
Renders the control.
renderContents (line 521)

Renders body contents of the accordion 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.
setActiveHeaderCssClass (line 295)
  • access: public
void setActiveHeaderCssClass (string $value)
  • string $value: Extra CSS class for the active header. Will be added to the normal header specified by HeaderCssClass.
setActiveView (line 175)
  • throws: TInvalidOperationException if the view is not in the view collection
  • access: public
void setActiveView (TAccordionView $view)
setActiveViewID (line 125)
  • access: public
void setActiveViewID (string $value)
  • string $value: The ID of the active accordion view.
setActiveViewIndex (line 106)
  • throws: TInvalidDataValueException if the view index is invalid
  • access: public
void setActiveViewIndex (integer $value)
  • integer $value: the zero-based index of the current view in the view collection. -1 if no active view.
setAnimationDuration (line 235)
  • access: public
void setAnimationDuration (string $value)
  • string $value: CSS class for the currently displayed view div.
setCssUrl (line 194)
  • access: public
void setCssUrl (string $value)
  • string $value: URL for the CSS file including all relevant CSS class definitions.
setHeaderCssClass (line 265)
  • access: public
void setHeaderCssClass (string $value)
  • string $value: CSS class for view headers.
setViewCssClass (line 219)
  • access: public
void setViewCssClass (string $value)
  • string $value: CSS class for the currently displayed view div.
setViewHeight (line 325)
  • access: public
void setViewHeight (integer $value)
  • integer $value: Maximum height for the accordion views. If any of the accordion's views' content is larger, those views will be made scrollable when activated

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::getDecorator()
TWebControl::getDisplay()
TWebControl::getEnsureId()
TWebControl::getFont()
TWebControl::getForeColor()
TWebControl::getHasStyle()
TWebControl::getHeight()
TWebControl::getStyle()
TWebControl::getTabIndex()
TWebControl::getTagName()
TWebControl::getToolTip()
TWebControl::getWidth()
TWebControl::onPreRender()
TWebControl::render()
TWebControl::renderBeginTag()
TWebControl::renderContents()
TWebControl::renderEndTag()
TWebControl::setAccessKey()
TWebControl::setBackColor()
TWebControl::setBorderColor()
TWebControl::setBorderStyle()
TWebControl::setBorderWidth()
TWebControl::setCssClass()
TWebControl::setDisplay()
TWebControl::setEnsureId()
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::getIsSkinApplied()
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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Class Constants

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