5 * @author Qiang Xue <qiang.xue@gmail.com>
6 * @link http://www.pradosoft.com/
7 * @copyright Copyright © 2005-2014 PradoSoft
8 * @license http://www.pradosoft.com/license/
9 * @package System.Web.UI.WebControls
13 * Using TDataBoundControl and TDataFieldAccessor cass
15 Prado::using('System.Web.UI.WebControls.TDataBoundControl');
16 Prado::using('System.Util.TDataFieldAccessor');
21 * TRepeater displays its content repeatedly based on the data fetched from
22 * {@link setDataSource DataSource}.
23 * The repeated contents in TRepeater are called items, which are controls and
24 * can be accessed through {@link getItems Items}. When {@link dataBind()} is invoked,
25 * TRepeater creates an item for each row of data and binds the data row to the item.
26 * Optionally, a repeater can have a header, a footer and/or separators between items.
28 * The layout of the repeated contents are specified by inline templates.
29 * Repeater items, header, footer, etc. are being instantiated with the corresponding
30 * templates when data is being bound to the repeater.
32 * Since v3.1.0, the layout can also be specified by renderers. A renderer is a control class
33 * that can be instantiated as repeater items, header, etc. A renderer can thus be viewed
34 * as an external template (in fact, it can also be non-templated controls).
36 * A renderer can be any control class.
37 * - If the class implements {@link IDataRenderer}, the <b>Data</b>
38 * property will be set as the data row during databinding. Many PRADO controls
39 * implement this interface, such as {@link TLabel}, {@link TTextBox}, etc.
40 * - If the class implements {@link IItemDataRenderer}, the <b>ItemIndex</b> property will be set
41 * as the zero-based index of the item in the repeater item collection, and
42 * the <b>ItemType</b> property as the item's type (such as TListItemType::Item).
43 * {@link TRepeaterItemRenderer} may be used as the convenient base class which
44 * already implements {@link IDataItemRenderer}.
46 * The following properties are used to specify different types of template and renderer
48 * - {@link setItemTemplate ItemTemplate}, {@link setItemRenderer ItemRenderer}:
49 * for each repeated row of data
50 * - {@link setAlternatingItemTemplate AlternatingItemTemplate}, {@link setAlternatingItemRenderer AlternatingItemRenderer}:
51 * for each alternating row of data. If not set, {@link setItemTemplate ItemTemplate} or {@link setItemRenderer ItemRenderer}
52 * will be used instead.
53 * - {@link setHeaderTemplate HeaderTemplate}, {@link setHeaderRenderer HeaderRenderer}:
54 * for the repeater header.
55 * - {@link setFooterTemplate FooterTemplate}, {@link setFooterRenderer FooterRenderer}:
56 * for the repeater footer.
57 * - {@link setSeparatorTemplate SeparatorTemplate}, {@link setSeparatorRenderer SeparatorRenderer}:
58 * for content to be displayed between items.
59 * - {@link setEmptyTemplate EmptyTemplate}, {@link setEmptyRenderer EmptyRenderer}:
60 * used when data bound to the repeater is empty.
62 * If a content type is defined with both a template and a renderer, the latter takes precedence.
64 * When {@link dataBind()} is being called, TRepeater undergoes the following lifecycles for each row of data:
65 * - create item based on templates or renderers
66 * - set the row of data to the item
67 * - raise {@link onItemCreated OnItemCreated}:
68 * - add the item as a child control
69 * - call dataBind() of the item
70 * - raise {@link onItemDataBound OnItemDataBound}:
72 * TRepeater raises an {@link onItemCommand OnItemCommand} whenever a button control
73 * within some repeater item raises a <b>OnCommand</b> event. Therefore,
74 * you can handle all sorts of <b>OnCommand</b> event in a central place by
75 * writing an event handler for {@link onItemCommand OnItemCommand}.
77 * When a page containing a repeater is post back, the repeater will restore automatically
78 * all its contents, including items, header, footer and separators.
79 * However, the data row associated with each item will not be recovered and become null.
80 * To access the data, use one of the following ways:
81 * - Use {@link getDataKeys DataKeys} to obtain the data key associated with
82 * the specified repeater item and use the key to fetch the corresponding data
83 * from some persistent storage such as DB.
84 * - Save the whole dataset in viewstate, which will restore the dataset automatically upon postback.
85 * Be aware though, if the size of your dataset is big, your page size will become big. Some
86 * complex data may also have serializing problem if saved in viewstate.
88 * @author Qiang Xue <qiang.xue@gmail.com>
89 * @package System.Web.UI.WebControls
92 class TRepeater extends TDataBoundControl implements INamingContainer
96 * @deprecated deprecated since version 3.0.4. Use TListItemType constants instead.
98 const IT_HEADER='Header';
99 const IT_FOOTER='Footer';
100 const IT_ITEM='Item';
101 const IT_SEPARATOR='Separator';
102 const IT_ALTERNATINGITEM='AlternatingItem';
105 * @var ITemplate template for repeater items
107 private $_itemTemplate=null;
109 * @var ITemplate template for each alternating item
111 private $_alternatingItemTemplate=null;
113 * @var ITemplate template for header
115 private $_headerTemplate=null;
117 * @var ITemplate template for footer
119 private $_footerTemplate=null;
121 * @var ITemplate template used for repeater when no data is bound
123 private $_emptyTemplate=null;
125 * @var ITemplate template for separator
127 private $_separatorTemplate=null;
129 * @var TRepeaterItemCollection list of repeater items
131 private $_items=null;
133 * @var TControl header item
135 private $_header=null;
137 * @var TControl footer item
139 private $_footer=null;
143 * @return string the class name for repeater items. Defaults to empty, meaning not set.
146 public function getItemRenderer()
148 return $this->getViewState('ItemRenderer','');
152 * Sets the item renderer class.
154 * If not empty, the class will be used to instantiate as repeater items.
155 * This property takes precedence over {@link getItemTemplate ItemTemplate}.
157 * @param string the renderer class name in namespace format.
158 * @see setItemTemplate
161 public function setItemRenderer($value)
163 $this->setViewState('ItemRenderer',$value,'');
167 * @return string the class name for alternative repeater items. Defaults to empty, meaning not set.
170 public function getAlternatingItemRenderer()
172 return $this->getViewState('AlternatingItemRenderer','');
176 * Sets the alternative item renderer class.
178 * If not empty, the class will be used to instantiate as alternative repeater items.
179 * This property takes precedence over {@link getAlternatingItemTemplate AlternatingItemTemplate}.
181 * @param string the renderer class name in namespace format.
182 * @see setAlternatingItemTemplate
185 public function setAlternatingItemRenderer($value)
187 $this->setViewState('AlternatingItemRenderer',$value,'');
191 * @return string the class name for repeater item separators. Defaults to empty, meaning not set.
194 public function getSeparatorRenderer()
196 return $this->getViewState('SeparatorRenderer','');
200 * Sets the repeater item separator renderer class.
202 * If not empty, the class will be used to instantiate as repeater item separators.
203 * This property takes precedence over {@link getSeparatorTemplate SeparatorTemplate}.
205 * @param string the renderer class name in namespace format.
206 * @see setSeparatorTemplate
209 public function setSeparatorRenderer($value)
211 $this->setViewState('SeparatorRenderer',$value,'');
215 * @return string the class name for repeater header item. Defaults to empty, meaning not set.
218 public function getHeaderRenderer()
220 return $this->getViewState('HeaderRenderer','');
224 * Sets the repeater header renderer class.
226 * If not empty, the class will be used to instantiate as repeater header item.
227 * This property takes precedence over {@link getHeaderTemplate HeaderTemplate}.
229 * @param string the renderer class name in namespace format.
230 * @see setHeaderTemplate
233 public function setHeaderRenderer($value)
235 $this->setViewState('HeaderRenderer',$value,'');
239 * @return string the class name for repeater footer item. Defaults to empty, meaning not set.
242 public function getFooterRenderer()
244 return $this->getViewState('FooterRenderer','');
248 * Sets the repeater footer renderer class.
250 * If not empty, the class will be used to instantiate as repeater footer item.
251 * This property takes precedence over {@link getFooterTemplate FooterTemplate}.
253 * @param string the renderer class name in namespace format.
254 * @see setFooterTemplate
257 public function setFooterRenderer($value)
259 $this->setViewState('FooterRenderer',$value,'');
263 * @return string the class name for empty repeater item. Defaults to empty, meaning not set.
266 public function getEmptyRenderer()
268 return $this->getViewState('EmptyRenderer','');
272 * Sets the repeater empty renderer class.
274 * The empty renderer is created as the child of the repeater
275 * if data bound to the repeater is empty.
276 * This property takes precedence over {@link getEmptyTemplate EmptyTemplate}.
278 * @param string the renderer class name in namespace format.
279 * @see setEmptyTemplate
282 public function setEmptyRenderer($value)
284 $this->setViewState('EmptyRenderer',$value,'');
288 * @return ITemplate the template for repeater items
290 public function getItemTemplate()
292 return $this->_itemTemplate;
296 * @param ITemplate the template for repeater items
297 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
299 public function setItemTemplate($value)
301 if($value instanceof ITemplate || $value===null)
302 $this->_itemTemplate=$value;
304 throw new TInvalidDataTypeException('repeater_template_required','ItemTemplate');
308 * @return ITemplate the alternative template string for the item
310 public function getAlternatingItemTemplate()
312 return $this->_alternatingItemTemplate;
316 * @param ITemplate the alternative item template
317 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
319 public function setAlternatingItemTemplate($value)
321 if($value instanceof ITemplate || $value===null)
322 $this->_alternatingItemTemplate=$value;
324 throw new TInvalidDataTypeException('repeater_template_required','AlternatingItemTemplate');
328 * @return ITemplate the header template
330 public function getHeaderTemplate()
332 return $this->_headerTemplate;
336 * @param ITemplate the header template
337 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
339 public function setHeaderTemplate($value)
341 if($value instanceof ITemplate || $value===null)
342 $this->_headerTemplate=$value;
344 throw new TInvalidDataTypeException('repeater_template_required','HeaderTemplate');
348 * @return ITemplate the footer template
350 public function getFooterTemplate()
352 return $this->_footerTemplate;
356 * @param ITemplate the footer template
357 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
359 public function setFooterTemplate($value)
361 if($value instanceof ITemplate || $value===null)
362 $this->_footerTemplate=$value;
364 throw new TInvalidDataTypeException('repeater_template_required','FooterTemplate');
368 * @return ITemplate the template applied when no data is bound to the repeater
370 public function getEmptyTemplate()
372 return $this->_emptyTemplate;
376 * @param ITemplate the template applied when no data is bound to the repeater
377 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
379 public function setEmptyTemplate($value)
381 if($value instanceof ITemplate || $value===null)
382 $this->_emptyTemplate=$value;
384 throw new TInvalidDataTypeException('repeater_template_required','EmptyTemplate');
388 * @return ITemplate the separator template
390 public function getSeparatorTemplate()
392 return $this->_separatorTemplate;
396 * @param ITemplate the separator template
397 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
399 public function setSeparatorTemplate($value)
401 if($value instanceof ITemplate || $value===null)
402 $this->_separatorTemplate=$value;
404 throw new TInvalidDataTypeException('repeater_template_required','SeparatorTemplate');
408 * @return TControl the header item
410 public function getHeader()
412 return $this->_header;
416 * @return TControl the footer item
418 public function getFooter()
420 return $this->_footer;
424 * @return TRepeaterItemCollection list of repeater item controls
426 public function getItems()
429 $this->_items=new TRepeaterItemCollection;
430 return $this->_items;
434 * @return string the field of the data source that provides the keys of the list items.
436 public function getDataKeyField()
438 return $this->getViewState('DataKeyField','');
442 * @param string the field of the data source that provides the keys of the list items.
444 public function setDataKeyField($value)
446 $this->setViewState('DataKeyField',$value,'');
450 * @return TList the keys used in the data listing control.
452 public function getDataKeys()
454 if(($dataKeys=$this->getViewState('DataKeys',null))===null)
457 $this->setViewState('DataKeys',$dataKeys,null);
463 * Creates a repeater item.
464 * This method invokes {@link createItem} to create a new repeater item.
465 * @param integer zero-based item index.
466 * @param TListItemType item type
467 * @return TControl the created item, null if item is not created
469 private function createItemInternal($itemIndex,$itemType)
471 if(($item=$this->createItem($itemIndex,$itemType))!==null)
473 $param=new TRepeaterItemEventParameter($item);
474 $this->onItemCreated($param);
475 $this->getControls()->add($item);
483 * Creates a repeater item and performs databinding.
484 * This method invokes {@link createItem} to create a new repeater item.
485 * @param integer zero-based item index.
486 * @param TListItemType item type
487 * @param mixed data to be associated with the item
488 * @return TControl the created item, null if item is not created
490 private function createItemWithDataInternal($itemIndex,$itemType,$dataItem)
492 if(($item=$this->createItem($itemIndex,$itemType))!==null)
494 $param=new TRepeaterItemEventParameter($item);
495 if($item instanceof IDataRenderer)
496 $item->setData($dataItem);
497 $this->onItemCreated($param);
498 $this->getControls()->add($item);
500 $this->onItemDataBound($param);
508 * Creates a repeater item instance based on the item type and index.
509 * @param integer zero-based item index
510 * @param TListItemType item type
511 * @return TControl created repeater item
513 protected function createItem($itemIndex,$itemType)
519 case TListItemType::Item :
520 $classPath=$this->getItemRenderer();
521 $template=$this->_itemTemplate;
523 case TListItemType::AlternatingItem :
524 if(($classPath=$this->getAlternatingItemRenderer())==='' && ($template=$this->_alternatingItemTemplate)===null)
526 $classPath=$this->getItemRenderer();
527 $template=$this->_itemTemplate;
530 case TListItemType::Header :
531 $classPath=$this->getHeaderRenderer();
532 $template=$this->_headerTemplate;
534 case TListItemType::Footer :
535 $classPath=$this->getFooterRenderer();
536 $template=$this->_footerTemplate;
538 case TListItemType::Separator :
539 $classPath=$this->getSeparatorRenderer();
540 $template=$this->_separatorTemplate;
543 throw new TInvalidDataValueException('repeater_itemtype_unknown',$itemType);
547 $item=Prado::createComponent($classPath);
548 if($item instanceof IItemDataRenderer)
550 $item->setItemIndex($itemIndex);
551 $item->setItemType($itemType);
554 else if($template!==null)
556 $item=new TRepeaterItem;
557 $item->setItemIndex($itemIndex);
558 $item->setItemType($itemType);
559 $template->instantiateIn($item);
568 * Creates empty repeater content.
570 protected function createEmptyContent()
572 if(($classPath=$this->getEmptyRenderer())!=='')
573 $this->getControls()->add(Prado::createComponent($classPath));
574 else if($this->_emptyTemplate!==null)
575 $this->_emptyTemplate->instantiateIn($this);
579 * Renders the repeater.
580 * This method overrides the parent implementation by rendering the body
581 * content as the whole presentation of the repeater. Outer tag is not rendered.
582 * @param THtmlWriter writer
584 public function render($writer)
586 if($this->_items && $this->_items->getCount() || $this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='')
587 $this->renderContents($writer);
591 * Saves item count in viewstate.
592 * This method is invoked right before control state is to be saved.
594 public function saveState()
598 $this->setViewState('ItemCount',$this->_items->getCount(),0);
600 $this->clearViewState('ItemCount');
604 * Loads item count information from viewstate.
605 * This method is invoked right after control state is loaded.
607 public function loadState()
610 if(!$this->getIsDataBound())
611 $this->restoreItemsFromViewState();
612 $this->clearViewState('ItemCount');
616 * Clears up all items in the repeater.
618 public function reset()
620 $this->getControls()->clear();
621 $this->getItems()->clear();
627 * Creates repeater items based on viewstate information.
629 protected function restoreItemsFromViewState()
632 if(($itemCount=$this->getViewState('ItemCount',0))>0)
634 $items=$this->getItems();
635 $hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
636 $this->_header=$this->createItemInternal(-1,TListItemType::Header);
637 for($i=0;$i<$itemCount;++$i)
639 if($hasSeparator && $i>0)
640 $this->createItemInternal($i-1,TListItemType::Separator);
641 $itemType=$i%2==0?TListItemType::Item : TListItemType::AlternatingItem;
642 $items->add($this->createItemInternal($i,$itemType,false,null));
644 $this->_footer=$this->createItemInternal(-1,TListItemType::Footer);
647 $this->createEmptyContent();
648 $this->clearChildState();
652 * Performs databinding to populate repeater items from data source.
653 * This method is invoked by dataBind().
654 * You may override this function to provide your own way of data population.
655 * @param Traversable the data
657 protected function performDataBinding($data)
661 $keys=$this->getDataKeys();
663 $keyField=$this->getDataKeyField();
665 $items=$this->getItems();
667 $hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
668 foreach($data as $key=>$dataItem)
671 $keys->add($this->getDataFieldValue($dataItem,$keyField));
675 $this->_header=$this->createItemWithDataInternal(-1,TListItemType::Header,null);
676 if($hasSeparator && $itemIndex>0)
677 $this->createItemWithDataInternal($itemIndex-1,TListItemType::Separator,null);
678 $itemType=$itemIndex%2==0?TListItemType::Item : TListItemType::AlternatingItem;
679 $items->add($this->createItemWithDataInternal($itemIndex,$itemType,$dataItem));
683 $this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null);
686 $this->createEmptyContent();
687 $this->dataBindChildren();
689 $this->setViewState('ItemCount',$itemIndex,0);
693 * This method overrides parent's implementation to handle
694 * {@link onItemCommand OnItemCommand} event which is bubbled from
695 * repeater items and their child controls.
696 * This method should only be used by control developers.
697 * @param TControl the sender of the event
698 * @param TEventParameter event parameter
699 * @return boolean whether the event bubbling should stop here.
701 public function bubbleEvent($sender,$param)
703 if($param instanceof TRepeaterCommandEventParameter)
705 $this->onItemCommand($param);
713 * Raises <b>OnItemCreated</b> event.
714 * This method is invoked after a repeater item is created and instantiated with
715 * template, but before added to the page hierarchy.
716 * The repeater item control responsible for the event
717 * can be determined from the event parameter.
718 * If you override this method, be sure to call parent's implementation
719 * so that event handlers have chance to respond to the event.
720 * @param TRepeaterItemEventParameter event parameter
722 public function onItemCreated($param)
724 $this->raiseEvent('OnItemCreated',$this,$param);
728 * Raises <b>OnItemDataBound</b> event.
729 * This method is invoked right after an item is data bound.
730 * The repeater item control responsible for the event
731 * can be determined from the event parameter.
732 * If you override this method, be sure to call parent's implementation
733 * so that event handlers have chance to respond to the event.
734 * @param TRepeaterItemEventParameter event parameter
736 public function onItemDataBound($param)
738 $this->raiseEvent('OnItemDataBound',$this,$param);
742 * Raises <b>OnItemCommand</b> event.
743 * This method is invoked after a button control in
744 * a template raises <b>OnCommand</b> event.
745 * The repeater control responsible for the event
746 * can be determined from the event parameter.
747 * The event parameter also contains the information about
748 * the initial sender of the <b>OnCommand</b> event, command name
749 * and command parameter.
750 * You may override this method to provide customized event handling.
751 * Be sure to call parent's implementation so that
752 * event handlers have chance to respond to the event.
753 * @param TRepeaterCommandEventParameter event parameter
755 public function onItemCommand($param)
757 $this->raiseEvent('OnItemCommand',$this,$param);
761 * Returns the value of the data at the specified field.
762 * If data is an array, TMap or TList, the value will be returned at the index
763 * of the specified field. If the data is a component with a property named
764 * as the field name, the property value will be returned.
765 * Otherwise, an exception will be raised.
766 * @param mixed data item
767 * @param mixed field name
768 * @return mixed data value at the specified field
769 * @throws TInvalidDataValueException if the data is invalid
771 protected function getDataFieldValue($data,$field)
773 return TDataFieldAccessor::getDataFieldValue($data,$field);
778 * TRepeaterItemEventParameter class
780 * TRepeaterItemEventParameter encapsulates the parameter data for
781 * {@link TRepeater::onItemCreated ItemCreated} event of {@link TRepeater} controls.
782 * The {@link getItem Item} property indicates the repeater item related with the event.
784 * @author Qiang Xue <qiang.xue@gmail.com>
785 * @package System.Web.UI.WebControls
788 class TRepeaterItemEventParameter extends TEventParameter
791 * The repeater item control responsible for the event.
798 * @param TControl repeater item related with the corresponding event
800 public function __construct($item)
806 * @return TControl repeater item related with the corresponding event
808 public function getItem()
815 * TRepeaterCommandEventParameter class
817 * TRepeaterCommandEventParameter encapsulates the parameter data for
818 * {@link TRepeater::onItemCommand ItemCommand} event of {@link TRepeater} controls.
820 * The {@link getItem Item} property indicates the repeater item related with the event.
821 * The {@link getCommandSource CommandSource} refers to the control that originally
822 * raises the Command event.
824 * @author Qiang Xue <qiang.xue@gmail.com>
825 * @package System.Web.UI.WebControls
828 class TRepeaterCommandEventParameter extends TCommandEventParameter
831 * @var TControl the repeater item control responsible for the event.
835 * @var TControl the control originally raises the <b>OnCommand</b> event.
837 private $_source=null;
841 * @param TControl repeater item responsible for the event
842 * @param TControl original event sender
843 * @param TCommandEventParameter original event parameter
845 public function __construct($item,$source,TCommandEventParameter $param)
848 $this->_source=$source;
849 parent::__construct($param->getCommandName(),$param->getCommandParameter());
853 * @return TControl the repeater item control responsible for the event.
855 public function getItem()
861 * @return TControl the control originally raises the <b>OnCommand</b> event.
863 public function getCommandSource()
865 return $this->_source;
870 * TRepeaterItem class
872 * A TRepeaterItem control represents an item in the {@link TRepeater} control,
873 * such as heading section, footer section, or a data item.
874 * The index and data value of the item can be accessed via {@link getItemIndex ItemIndex}>
875 * and {@link getDataItem DataItem} properties, respectively. The type of the item
876 * is given by {@link getItemType ItemType} property.
878 * @author Qiang Xue <qiang.xue@gmail.com>
879 * @package System.Web.UI.WebControls
882 class TRepeaterItem extends TControl implements INamingContainer, IItemDataRenderer
885 * index of the data item in the Items collection of repeater
889 * type of the TRepeaterItem
894 * data associated with this item
900 * @return TListItemType item type
902 public function getItemType()
904 return $this->_itemType;
908 * @param TListItemType item type.
910 public function setItemType($value)
912 $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
916 * Returns a value indicating the zero-based index of the item in the corresponding data control's item collection.
917 * If the item is not in the collection (e.g. it is a header item), it returns -1.
918 * @return integer zero-based index of the item.
920 public function getItemIndex()
922 return $this->_itemIndex;
926 * Sets the zero-based index for the item.
927 * If the item is not in the item collection (e.g. it is a header item), -1 should be used.
928 * @param integer zero-based index of the item.
930 public function setItemIndex($value)
932 $this->_itemIndex=TPropertyValue::ensureInteger($value);
936 * @return mixed data associated with the item
939 public function getData()
945 * @param mixed data to be associated with the item
948 public function setData($value)
954 * This property is deprecated since v3.1.0.
955 * @return mixed data associated with the item
956 * @deprecated deprecated since v3.1.0. Use {@link getData} instead.
958 public function getDataItem()
960 return $this->getData();
964 * This property is deprecated since v3.1.0.
965 * @param mixed data to be associated with the item
966 * @deprecated deprecated since version 3.1.0. Use {@link setData} instead.
968 public function setDataItem($value)
970 return $this->setData($value);
974 * This method overrides parent's implementation by wrapping event parameter
975 * for <b>OnCommand</b> event with item information.
976 * @param TControl the sender of the event
977 * @param TEventParameter event parameter
978 * @return boolean whether the event bubbling should stop here.
980 public function bubbleEvent($sender,$param)
982 if($param instanceof TCommandEventParameter)
984 $this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param));
994 * TRepeaterItemCollection class.
996 * TRepeaterItemCollection represents a collection of repeater items.
998 * @author Qiang Xue <qiang.xue@gmail.com>
999 * @package System.Web.UI.WebControls
1002 class TRepeaterItemCollection extends TList
1005 * Inserts an item at the specified position.
1006 * This overrides the parent implementation by inserting only objects that are descendant of {@link TControl}.
1007 * @param integer the speicified position.
1008 * @param TControl new item
1009 * @throws TInvalidDataTypeException if the item to be inserted is not a control.
1011 public function insertAt($index,$item)
1013 if($item instanceof TControl)
1014 parent::insertAt($index,$item);
1016 throw new TInvalidDataTypeException('repeateritemcollection_item_invalid');