[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/UI/WebControls/ -> TRepeater.php (sommaire)

TRepeater class file

Author: Qiang Xue <qiang.xue@gmail.com>
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TRepeater.php 1481 2006-10-29 12:29:16Z xue $
Poids: 783 lignes (24 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 5 classes

TRepeater:: (32 méthodes):
  getItemTemplate()
  setItemTemplate()
  getAlternatingItemTemplate()
  setAlternatingItemTemplate()
  getHeaderTemplate()
  setHeaderTemplate()
  getFooterTemplate()
  setFooterTemplate()
  getEmptyTemplate()
  setEmptyTemplate()
  getSeparatorTemplate()
  setSeparatorTemplate()
  getHeader()
  getFooter()
  getItems()
  getDataKeyField()
  setDataKeyField()
  getDataKeys()
  createItem()
  createItemInternal()
  initializeItem()
  render()
  saveState()
  loadState()
  reset()
  restoreItemsFromViewState()
  performDataBinding()
  bubbleEvent()
  onItemCreated()
  onItemDataBound()
  onItemCommand()
  getDataFieldValue()

TRepeaterItemEventParameter:: (2 méthodes):
  __construct()
  getItem()

TRepeaterCommandEventParameter:: (3 méthodes):
  __construct()
  getItem()
  getCommandSource()

TRepeaterItem:: (7 méthodes):
  __construct()
  getItemType()
  setItemType()
  getItemIndex()
  getDataItem()
  setDataItem()
  bubbleEvent()

TRepeaterItemCollection:: (1 méthode):
  insertAt()


Classe: TRepeater  - X-Ref

TRepeater class

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

The {@link setHeaderTemplate HeaderTemplate} property specifies the content
template that will be displayed at the beginning, while
{@link setFooterTemplate 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 {@link setItemTemplate ItemTemplate} will be generated and displayed once.
If {@link setAlternatingItemTemplate AlternatingItemTemplate} is not empty,
then the corresponding content will be displayed alternatively with that
in {@link setItemTemplate ItemTemplate}. The content in
{@link setSeparatorTemplate SeparatorTemplate}, if not empty, will be
displayed between items.

Each repeater item has a {@link TRepeaterItem::getItemType type}
which tells the position of the item in the repeater. An item in the header
of the repeater is of type TListItemType::Header. A body item may be of either
TListItemType::Item or TListItemType::AlternatingItem, depending whether the item
index is odd or even.

You can retrive the repeated contents by the {@link getItems Items} property.
The header and footer items can be accessed by {@link getHeader Header}
and {@link getFooter Footer} properties, respectively.

When TRepeater creates an item, it will raise an {@link onItemCreated 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 {@link onItemDataBound OnItemDataBound} event will be raised.

TRepeater raises an {@link onItemCommand OnItemCommand} whenever a button control
within some repeater item raises a <b>OnCommand</b> event. Therefore,
you can handle all sorts of <b>OnCommand</b> event in a central place by
writing an event handler for {@link onItemCommand OnItemCommand}.

Note, the data bound to the repeater are reset to null after databinding.
There are several ways to access the data associated with a repeater item:
- Access the data in {@link onItemDataBound OnItemDataBound} event
- Use {@link getDataKeys DataKeys} to obtain the data key associated with
the specified repeater item and use the key to fetch the corresponding data
from some persistent storage such as DB.
- Save the data in viewstate and get it back during postbacks.

getItemTemplate()   X-Ref

return: ITemplate the template for repeater items

setItemTemplate($value)   X-Ref

param: ITemplate the template for repeater items

getAlternatingItemTemplate()   X-Ref

return: ITemplate the alternative template string for the item

setAlternatingItemTemplate($value)   X-Ref

param: ITemplate the alternative item template

getHeaderTemplate()   X-Ref

return: ITemplate the header template

setHeaderTemplate($value)   X-Ref

param: ITemplate the header template

getFooterTemplate()   X-Ref

return: ITemplate the footer template

setFooterTemplate($value)   X-Ref

param: ITemplate the footer template

getEmptyTemplate()   X-Ref

return: ITemplate the template applied when no data is bound to the repeater

setEmptyTemplate($value)   X-Ref

param: ITemplate the template applied when no data is bound to the repeater

getSeparatorTemplate()   X-Ref

return: ITemplate the separator template

setSeparatorTemplate($value)   X-Ref

param: ITemplate the separator template

getHeader()   X-Ref

return: TRepeaterItem the header item

getFooter()   X-Ref

return: TRepeaterItem the footer item

getItems()   X-Ref

return: TRepeaterItemCollection list of {@link TRepeaterItem} controls

getDataKeyField()   X-Ref

return: string the field of the data source that provides the keys of the list items.

setDataKeyField($value)   X-Ref

param: string the field of the data source that provides the keys of the list items.

getDataKeys()   X-Ref

return: TList the keys used in the data listing control.

createItem($itemIndex,$itemType)   X-Ref
Creates a repeater item instance based on the item type and index.

param: integer zero-based item index
param: string item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'.
return: TRepeaterItem created repeater item

createItemInternal($itemIndex,$itemType,$dataBind,$dataItem)   X-Ref
Creates a repeater item and does databinding if needed.
This method invokes {@link createItem} to create a new repeater item.

param: integer zero-based item index.
param: string item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'.
param: boolean whether to do databinding for the item
param: mixed data to be associated with the item
return: TRepeaterItem the created item

initializeItem($item)   X-Ref
Initializes a repeater item.
The item is added as a child of the repeater and the corresponding
template is instantiated within the item.

param: TRepeaterItem item to be initialized

render($writer)   X-Ref
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.

param: THtmlWriter writer

saveState()   X-Ref
Saves item count in viewstate.
This method is invoked right before control state is to be saved.


loadState()   X-Ref
Loads item count information from viewstate.
This method is invoked right after control state is loaded.


reset()   X-Ref
Clears up all items in the repeater.


restoreItemsFromViewState()   X-Ref
Creates repeater items based on viewstate information.


performDataBinding($data)   X-Ref
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.

param: Traversable the data

bubbleEvent($sender,$param)   X-Ref
This method overrides parent's implementation to handle
{@link onItemCommand OnItemCommand} event which is bubbled from
{@link TRepeaterItem} child controls.
This method should only be used by control developers.

param: TControl the sender of the event
param: TEventParameter event parameter
return: boolean whether the event bubbling should stop here.

onItemCreated($param)   X-Ref
Raises <b>OnItemCreated</b> event.
This method is invoked after a repeater item is created and instantiated with
template, but before added to the page hierarchy.
The {@link 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.

param: TRepeaterItemEventParameter event parameter

onItemDataBound($param)   X-Ref
Raises <b>OnItemDataBound</b> event.
This method is invoked right after an item is data bound.
The {@link 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.

param: TRepeaterItemEventParameter event parameter

onItemCommand($param)   X-Ref
Raises <b>OnItemCommand</b> event.
This method is invoked after a button control in
a template raises <b>Command</b> event.
The {@link 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 <b>Command</b> 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.

param: TRepeaterCommandEventParameter event parameter

getDataFieldValue($data,$field)   X-Ref
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.

param: mixed data item
param: mixed field name
return: mixed data value at the specified field

Classe: TRepeaterItemEventParameter  - X-Ref

TRepeaterItemEventParameter class

TRepeaterItemEventParameter encapsulates the parameter data for
{@link TRepeater::onItemCreated ItemCreated} event of {@link TRepeater} controls.
The {@link getItem Item} property indicates the repeater item related with the event.

__construct(TRepeaterItem $item)   X-Ref
Constructor.

param: TRepeaterItem repeater item related with the corresponding event

getItem()   X-Ref

return: TRepeaterItem repeater item related with the corresponding event

Classe: TRepeaterCommandEventParameter  - X-Ref

TRepeaterCommandEventParameter class

TRepeaterCommandEventParameter encapsulates the parameter data for
{@link TRepeater::onItemCommand ItemCommand} event of {@link TRepeater} controls.

The {@link getItem Item} property indicates the repeater item related with the event.
The {@link getCommandSource CommandSource} refers to the control that originally
raises the Command event.

__construct($item,$source,TCommandEventParameter $param)   X-Ref
Constructor.

param: TRepeaterItem repeater item responsible for the event
param: TControl original event sender
param: TCommandEventParameter original event parameter

getItem()   X-Ref

return: TRepeaterItem the TRepeaterItem control responsible for the event.

getCommandSource()   X-Ref

return: TControl the control originally raises the <b>Command</b> event.

Classe: TRepeaterItem  - X-Ref

TRepeaterItem class

A TRepeaterItem control represents an item in the {@link TRepeater} control,
such as heading section, footer section, or a data item.
The index and data value of the item can be accessed via {@link getItemIndex ItemIndex}>
and {@link getDataItem DataItem} properties, respectively. The type of the item
is given by {@link getItemType ItemType} property.

__construct($itemIndex,$itemType)   X-Ref
Constructor.

param: integer zero-based index of the item in the item collection of repeater
param: TListItemType item type

getItemType()   X-Ref

return: TListItemType item type

setItemType($value)   X-Ref

param: TListItemType item type.

getItemIndex()   X-Ref

return: integer zero-based index of the item in the item collection of repeater

getDataItem()   X-Ref

return: mixed data associated with the item

setDataItem($value)   X-Ref

param: mixed data to be associated with the item

bubbleEvent($sender,$param)   X-Ref
This method overrides parent's implementation by wrapping event parameter
for <b>Command</b> event with item information.

param: TControl the sender of the event
param: TEventParameter event parameter
return: boolean whether the event bubbling should stop here.

Classe: TRepeaterItemCollection  - X-Ref

TRepeaterItemCollection class.

TRepeaterItemCollection represents a collection of repeater items.

insertAt($index,$item)   X-Ref
Inserts an item at the specified position.
This overrides the parent implementation by inserting only TRepeaterItem.

param: integer the speicified position.
param: mixed new item



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7