|
Class TAccordion
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:
- setActiveViewIndex ActiveViewIndex - the zero-based integer index of
the view in the view collection.
- setActiveViewID ActiveViewID - the text ID of the visible view.
- setActiveView ActiveView - the visible view instance.
If both setActiveViewIndex ActiveViewIndex and setActiveViewID
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
setCssUrl CssUrl property. The following properties specify the CSS
classes used for elements in a TAccordion:
- setCssClass CssClass - the CSS class name for the outer-most div
element (defaults to 'accordion');
- setHeaderCssClass HeaderCssClass - the CSS class name for nonactive
accordion div elements (defaults to 'accordion-header');
- setActiveHeaderCssClass ActiveHeaderCssClass - the CSS class name
for the active accordion div element (defaults to
'accordion-header-active');
- setViewCssClass 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 setAnimationDuration 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 setViewHeight ViewHeight property. When a
TAccordion is nested inside another, it's adviced to manually specify a setViewHeight ViewHeight for the internal TAccordion
To use TAccordion, write a template like following:
<com:TAccordion>
<com:TAccordionView Caption="View 1">
content for view 1
</com:TAccordionView>
<com:TAccordionView Caption="View 2">
content for view 2
</com:TAccordionView>
<com:TAccordionView Caption="View 3">
content for view 3
</com:TAccordionView>
</com:TAccordion>
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TAccordion
implements
IPostBackDataHandler
Methods summary
protected
string
|
#
getTagName( )
Returns
string tag name for the control
Overrides
|
public
|
#
addParsedObject( mixed $object )
Adds object parsed from template to the control. This method adds only TAccordionView objects into the getViews Views collection. All other
objects are ignored.
Adds object parsed from template to the control. This method adds only TAccordionView objects into the getViews Views collection. All other
objects are ignored.
Parameters
- $object
mixed object parsed from template
Overrides
|
public
integer
|
#
getActiveViewIndex( )
Returns the index of the active accordion view. Note, this property may not
return the correct index. To ensure the correctness, call TAccordion::getActiveView() first.
Returns the index of the active accordion view. Note, this property may not
return the correct index. To ensure the correctness, call TAccordion::getActiveView() first.
Returns
integer 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).
|
public
|
#
setActiveViewIndex( integer $value )
Parameters
- $value
integer the zero-based index of the current view in the view collection. -1 if no active
view.
Throws
|
public
string
|
#
getActiveViewID( )
Returns the ID of the active accordion view. Note, this property may not
return the correct ID. To ensure the correctness, call TAccordion::getActiveView()
first.
Returns the ID of the active accordion view. Note, this property may not
return the correct ID. To ensure the correctness, call TAccordion::getActiveView()
first.
Returns
string The ID of the active accordion view. Defaults to '', meaning not set.
|
public
|
#
setActiveViewID( string $value )
Parameters
- $value
string The ID of the active accordion view.
|
public
TAccordionView
|
#
getActiveView( )
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.
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.
Returns
Throws
|
public
|
|
public
string
|
#
getCssUrl( )
Returns
string URL for the CSS file including all relevant CSS class definitions. Defaults to
''.
|
public
|
#
setCssUrl( string $value )
Parameters
- $value
string URL for the CSS file including all relevant CSS class definitions.
|
public
string
|
#
getCssClass( )
Returns
string CSS class for the whole accordion control div.
Overrides
|
public
string
|
#
getViewCssClass( )
Returns
string CSS class for the currently displayed view div. Defaults to 'accordion-view'.
|
public
|
#
setViewCssClass( string $value )
Parameters
- $value
string CSS class for the currently displayed view div.
|
public
string
|
#
getAnimationDuration( )
Returns
string CSS class for the currently displayed view div. Defaults to 'accordion-view'.
|
public
|
#
setAnimationDuration( string $value )
Parameters
- $value
string CSS class for the currently displayed view div.
|
public
TStyle
|
#
getViewStyle( )
Returns
TStyle
the style for all the view div
|
public
integer
|
#
getViewHeight( )
Returns
integer 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
|
public
|
#
setViewHeight( integer $value )
Parameters
- $value
integer Maximum height for the accordion views. If any of the accordion's views' content
is larger, those views will be made scrollable when activated
|
protected
|
#
activateView( TAccordionView $view )
Activates the specified view. If there is any other view currently active, it
will be deactivated.
Activates the specified view. If there is any other view currently active, it
will be deactivated.
Parameters
- $view
TAccordionView
the view to be activated. If null, all views will be deactivated.
|
public
boolean
|
#
loadPostData( string $key, array $values )
Loads user input data. This method is primarly used by framework
developers.
Loads user input data. This method is primarly used by framework
developers.
Parameters
- $key
string the key that can be used to retrieve data from the input data collection
- $values
array the input data collection
Returns
boolean whether the data of the control has been changed
Implementation of
|
public
|
#
raisePostDataChangedEvent( )
Raises postdata changed event. This method is required by IPostBackDataHandler interface. It is invoked by the framework when getActiveViewIndex ActiveViewIndex property is changed on postback. This method
is primarly used by framework developers.
Raises postdata changed event. This method is required by IPostBackDataHandler interface. It is invoked by the framework when getActiveViewIndex ActiveViewIndex property is changed on postback. This method
is primarly used by framework developers.
Implementation of
|
public
boolean
|
#
getDataChanged( )
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns
boolean whether postback has caused the control data change. False if the page is not in
postback mode.
Implementation of
|
protected
|
#
addAttributesToRender( THtmlWriter $writer )
Adds attributes to renderer.
Adds attributes to renderer.
Parameters
Overrides
|
public
|
#
onPreRender( mixed $param )
Registers CSS and JS. This method is invoked right before the control
rendering, if the control is visible.
Registers CSS and JS. This method is invoked right before the control
rendering, if the control is visible.
Parameters
- $param
mixed event parameter
Overrides
|
protected
|
#
registerStyleSheet( )
Registers the CSS relevant to the TAccordion. It will register the CSS file
specified by getCssUrl CssUrl. If that is not set, it will use the
default CSS.
Registers the CSS relevant to the TAccordion. It will register the CSS file
specified by getCssUrl CssUrl. If that is not set, it will use the
default CSS.
|
protected
|
#
registerClientScript( )
Registers the relevant JavaScript.
Registers the relevant JavaScript.
|
protected
string
|
#
getClientClassName( )
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Returns
string the javascript class name
|
protected
array
|
#
getClientOptions( )
Returns
array the options for JavaScript
|
protected
TAccordionViewCollection
|
#
createControlCollection( )
Creates a control collection object that is to be used to hold child
controls
Creates a control collection object that is to be used to hold child
controls
Returns
Overrides
|
public
TAccordionViewCollection
|
|
public
|
#
render( THtmlWriter $writer )
Renders the control. This method overrides the parent implementation by
replacing it with the following sequence:
Renders the control. This method overrides the parent implementation by
replacing it with the following sequence:
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
Overrides
|
public
|
#
renderContents( THtmlWriter $writer )
Renders body contents of the accordion control.
Renders body contents of the accordion control.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose.
Overrides
|
Methods inherited from TWebControl
clearStyle(),
copyBaseAttributes(),
createStyle(),
getAccessKey(),
getBackColor(),
getBorderColor(),
getBorderStyle(),
getBorderWidth(),
getDecorator(),
getDisplay(),
getEnsureId(),
getFont(),
getForeColor(),
getHasStyle(),
getHeight(),
getStyle(),
getTabIndex(),
getToolTip(),
getWidth(),
renderBeginTag(),
renderEndTag(),
setAccessKey(),
setBackColor(),
setBorderColor(),
setBorderStyle(),
setBorderWidth(),
setCssClass(),
setDisplay(),
setEnsureId(),
setForeColor(),
setHeight(),
setStyle(),
setTabIndex(),
setToolTip(),
setWidth()
|
Methods inherited from TControl
__construct(),
__get(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createChildControls(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onInit(),
onLoad(),
onUnload(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
Methods inherited from TComponent
__call(),
__destruct(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
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()
|
Constants inherited from TControl
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID
|
|