## Class TRepeater

Description

Implements interfaces:

- INamingContainer

TRepeater class

TRepeater displays its content defined in templates repeatedly based on the given data specified by the DataSource or DataSourceID property. The templates can contain static text, controls and special tags.

The HeaderTemplate property specifies the content template that will be displayed at the beginning, while FooterTemplate at the end. If present, these two templates will only be rendered when the repeater is given non-empty data. In this case, for each data item the content defined by ItemTemplate will be generated and displayed once. If AlternatingItemTemplate is not empty, then the corresponding content will be displayed alternatively with that in ItemTemplate. The content in SeparatorTemplate, if not empty, will be displayed between items.

You can retrive the repeated contents by the Items property. The header and footer items can be accessed by Header and Footer properties, respectively.

When TRepeater creates an item, it will raise an OnItemCreated so that you may customize the newly created item. When databinding is performed by TRepeater, for each item once it has finished databinding, an OnItemDataBound event will be raised.

TRepeater raises an OnItemCommand whenever a button control within some repeater item raises a Command event. Therefore, you can handle all sorts of Command event in a central place by writing an event handler for OnItemCommand.

- since: 3.0
- version: $Revision: $ $Date: $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TRepeater.php (line 57)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TDataBoundControl
                   |
                   --TRepeater

Class Constant Summary
IT_ALTERNATINGITEM = 'AlternatingItem'
IT_EMPTY = 'Empty'
IT_FOOTER = 'Footer'
IT_HEADER = 'Header'
IT_ITEM = 'Item'
IT_SEPARATOR = 'Separator'
Method Summary
void addParsedObject (mixed $object)
TRepeaterItem createItem (integer $itemIndex, string $itemType)
ITemplate getAlternatingItemTemplate ()
mixed getDataFieldValue (mixed $data, mixed $field)
string getDataKeyField ()
TList getDataKeys ()
ITemplate getEmptyTemplate ()
TRepeaterItem getFooter ()
ITemplate getFooterTemplate ()
TRepeaterItem getHeader ()
ITemplate getHeaderTemplate ()
TRepeaterItemCollection getItems ()
ITemplate getItemTemplate ()
ITemplate getSeparatorTemplate ()
void initializeItem (TRepeaterItem $item)
void loadState ()
boolean onBubbleEvent (TControl $sender, TEventParameter $param)
void onItemCommand (TRepeaterCommandEventParameter $param)
void onItemCreated (TRepeaterItemEventParameter $param)
void onItemDataBound (TRepeaterItemEventParameter $param)
void performDataBinding (Traversable $data)
void render (THtmlWriter $writer)
void reset ()
void restoreItemsFromViewState ()
void saveState ()
void setAlternatingItemTemplate (ITemplate $value)
void setDataKeyField (string $value)
void setEmptyTemplate (ITemplate $value)
void setFooterTemplate (ITemplate $value)
void setHeaderTemplate (ITemplate $value)
void setItemTemplate (ITemplate $value)
void setSeparatorTemplate (ITemplate $value)
Methods
addParsedObject (line 111)

No body content should be added to repeater.

This method is invoked when body content is parsed and added to this control.

- access: public

void addParsedObject (mixed $object)

- mixed $object: body content to be added

Redefinition of:

TControl::addParsedObject()
  Processes an object that is created during parsing template.

createItem (line 296)

Creates a repeater item instance based on the item type and index.

- return: created repeater item
- access: protected

TRepeaterItem createItem (integer $itemIndex, string $itemType)

- integer $itemIndex: zero-based item index
- string $itemType: item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'.

getAlternatingItemTemplate (line 138)

- return: the alternative template string for the item
- access: public

ITemplate getAlternatingItemTemplate ()
getDataFieldValue (line 544)

Returns the value of the data at the specified field.

If data is an array, TMap or TList, the value will be returned at the index of the specified field. If the data is a component with a property named as the field name, the property value will be returned. Otherwise, an exception will be raised.

- return: data value at the specified field
- access: protected
- throws: TInvalidDataValueException if the data is invalid

mixed getDataFieldValue (mixed $data, mixed $field)

- mixed $data: data item
- mixed $field: field name

getDataKeyField (line 264)

- return: the field of the data source that provides the keys of the list items.
- access: public

string getDataKeyField ()
getDataKeys (line 280)

- return: the keys used in the data listing control.
- access: public

TList getDataKeys ()
getEmptyTemplate (line 198)

- return: the template applied when no data is bound to the repeater
- access: public

ITemplate getEmptyTemplate ()
getFooter (line 246)

- return: the footer item
- access: public

TRepeaterItem getFooter ()
getFooterTemplate (line 178)

- return: the footer template
- access: public

ITemplate getFooterTemplate ()
getHeader (line 238)

- return: the header item
- access: public

TRepeaterItem getHeader ()
getHeaderTemplate (line 158)

- return: the header template
- access: public

ITemplate getHeaderTemplate ()
getItems (line 254)

- return: list of TRepeaterItem controls
- access: public

TRepeaterItemCollection getItems ()
getItemTemplate (line 118)

- return: the template for repeater items
- access: public

ITemplate getItemTemplate ()
getSeparatorTemplate (line 218)

- return: the separator template
- access: public

ITemplate getSeparatorTemplate ()
initializeItem (line 338)

Initializes a repeater item.

The item is added as a child of the repeater and the corresponding template is instantiated within the item.

- access: protected

void initializeItem (TRepeaterItem $item)

- TRepeaterItem $item: item to be initialized

loadState (line 382)

Loads item count information from viewstate.

This method is invoked right after control state is loaded.

- access: public

void loadState ()

Redefinition of:

TControl::loadState()
  This method is invoked right after the control has loaded its state.

onBubbleEvent (line 474)

Handles BubbleEvent.

This method overrides parent's implementation to handle OnItemCommand event which is bubbled from TRepeaterItem child controls. This method should only be used by control developers.

- return: whether the event bubbling should stop here.
- access: public

boolean onBubbleEvent (TControl $sender, TEventParameter $param)

- TControl $sender: the sender of the event
- TEventParameter $param: event parameter

Redefinition of:

TControl::onBubbleEvent()
  This method responds to a bubbled event.

onItemCommand (line 528)

Raises OnItemCommand event.

This method is invoked after a button control in a template raises Command event. The TRepeaterItem control responsible for the event can be determined from the event parameter. The event parameter also contains the information about the initial sender of the Command event, command name and command parameter. You may override this method to provide customized event handling. Be sure to call parent's implementation so that event handlers have chance to respond to the event.

- access: public

void onItemCommand (TRepeaterCommandEventParameter $param)

- TRepeaterCommandEventParameter $param: event parameter

onItemCreated (line 495)

Raises OnItemCreated event.

This method is invoked after a repeater item is created and instantiated with template, but before added to the page hierarchy. The TRepeaterItem control responsible for the event can be determined from the event parameter. If you override this method, be sure to call parent's implementation so that event handlers have chance to respond to the event.

- access: public

void onItemCreated (TRepeaterItemEventParameter $param)

- TRepeaterItemEventParameter $param: event parameter

onItemDataBound (line 509)

Raises OnItemDataBound event.

This method is invoked right after an item is data bound. The TRepeaterItem control responsible for the event can be determined from the event parameter. If you override this method, be sure to call parent's implementation so that event handlers have chance to respond to the event.

- access: public

void onItemDataBound (TRepeaterItemEventParameter $param)

- TRepeaterItemEventParameter $param: event parameter

performDataBinding (line 434)

Performs databinding to populate repeater items from data source.

This method is invoked by dataBind(). You may override this function to provide your own way of data population.

- access: protected

void performDataBinding (Traversable $data)

- Traversable $data: the data

Redefinition of:

TDataBoundControl::performDataBinding()

render (line 360)

Renders the repeater.

This method overrides the parent implementation by rendering the body content as the whole presentation of the repeater. Outer tag is not rendered.

- access: public

void render (THtmlWriter $writer)

- THtmlWriter $writer: writer

Redefinition of:

TWebControl::render()
  Renders the control.

reset (line 393)

Clears up all items in the repeater.

- access: public

void reset ()
restoreItemsFromViewState (line 404)

Creates repeater items based on viewstate information.

- access: protected

void restoreItemsFromViewState ()
saveState (line 369)

Saves item count in viewstate.

This method is invoked right before control state is to be saved.

- access: public

void saveState ()

Redefinition of:

TControl::saveState()
  This method is invoked when control state is to be saved.

setAlternatingItemTemplate (line 147)

- access: public
- throws: TInvalidDataTypeException if the input is not an ITemplate or not null.

void setAlternatingItemTemplate (ITemplate $value)

- ITemplate $value: the alternative item template

setDataKeyField (line 272)

- access: public

void setDataKeyField (string $value)

- string $value: the field of the data source that provides the keys of the list items.

setEmptyTemplate (line 207)

- access: public
- throws: TInvalidDataTypeException if the input is not an ITemplate or not null.

void setEmptyTemplate (ITemplate $value)

- ITemplate $value: the template applied when no data is bound to the repeater

setFooterTemplate (line 187)

- access: public
- throws: TInvalidDataTypeException if the input is not an ITemplate or not null.

void setFooterTemplate (ITemplate $value)

- ITemplate $value: the footer template

setHeaderTemplate (line 167)

- access: public
- throws: TInvalidDataTypeException if the input is not an ITemplate or not null.

void setHeaderTemplate (ITemplate $value)

- ITemplate $value: the header template

setItemTemplate (line 127)

- access: public
- throws: TInvalidDataTypeException if the input is not an ITemplate or not null.

void setItemTemplate (ITemplate $value)

- ITemplate $value: the template for repeater items

setSeparatorTemplate (line 227)

- access: public
- throws: TInvalidDataTypeException if the input is not an ITemplate or not null.

void setSeparatorTemplate (ITemplate $value)

- ITemplate $value: the separator template

#### Inherited Methods

Inherited From TDataBoundControl

> TDataBoundControl::dataBind()
> TDataBoundControl::dataSourceViewChanged()
> TDataBoundControl::determineDataSource()
> TDataBoundControl::ensureDataBound()
> TDataBoundControl::getData()
> TDataBoundControl::getDataMember()
> TDataBoundControl::getDataSource()
> TDataBoundControl::getDataSourceID()
> TDataBoundControl::getDataSourceView()
> TDataBoundControl::getInitialized()
> TDataBoundControl::getIsDataBound()
> TDataBoundControl::getRequiresDataBinding()
> TDataBoundControl::getSelectParameters()
> TDataBoundControl::getUsingDataSourceID()
> TDataBoundControl::onDataBound()
> TDataBoundControl::onDataSourceChanged()
> TDataBoundControl::onInit()
> TDataBoundControl::onPagePreLoad()
> TDataBoundControl::onPreRender()
> TDataBoundControl::performDataBinding()
> TDataBoundControl::setDataMember()
> TDataBoundControl::setDataSource()
> TDataBoundControl::setDataSourceID()
> TDataBoundControl::setInitialized()
> TDataBoundControl::setIsDataBound()
> TDataBoundControl::setRequiresDataBinding()
> TDataBoundControl::validateDataSource()

Inherited From TWebControl

> TWebControl::addAttributesToRender()
> TWebControl::copyBaseAttributes()
> TWebControl::createStyle()
> TWebControl::getAccessKey()
> TWebControl::getBackColor()
> TWebControl::getBorderColor()
> TWebControl::getBorderStyle()
> TWebControl::getBorderWidth()
> TWebControl::getCssClass()
> 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::setForeColor()
> TWebControl::setHeight()
> TWebControl::setStyle()
> TWebControl::setTabIndex()
> TWebControl::setToolTip()
> TWebControl::setWidth()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::broadcastEventInternal()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::createdOnTemplate()
> 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::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasControls()
> 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::onBubbleEvent()
> 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::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> 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::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> 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
IT_ALTERNATINGITEM = 'AlternatingItem' (line 67)
IT_EMPTY = 'Empty' (line 64)
IT_FOOTER = 'Footer' (line 63)
IT_HEADER = 'Header' (line 62)

Repeater item types

IT_ITEM = 'Item' (line 65)
IT_SEPARATOR = 'Separator' (line 66)

#### Inherited Constants

Inherited from TControl

Documentation generated on Mon, 01 May 2006 23:04:30 -0400 by phpDocumentor 1.3.0RC4