| 21 | | * Because TDataGridItemRenderer extends from {@link TTemplateControl}, derived child classes |
| 22 | | * can have templates to define their presentational layout. |
| 23 | | * |
| 24 | | * TDataGridItemRenderer implements {@link IItemDataRenderer} interface, |
| 25 | | * which enables the following properties that are related with data-bound controls: |
| 26 | | * - {@link getItemIndex ItemIndex}: zero-based index of the datagrid item containing this control. |
| 27 | | * - {@link getItemType ItemType}: type of the datagrid item containing this control, such as TListItemType::AlternatingItem |
| 28 | | * - {@link getData Data}: the data row associated with the datagrid item that this control resides in |
| 29 | | |
| 37 | | /** |
| 38 | | * index of the data item in the Items collection of datalist |
| 39 | | */ |
| 40 | | private $_itemIndex; |
| 41 | | /** |
| 42 | | * type of the TDataGridItem |
| 43 | | * @var TListItemType |
| 44 | | */ |
| 45 | | private $_itemType; |
| 46 | | /** |
| 47 | | * data associated with this item |
| 48 | | * @var mixed |
| 49 | | */ |
| 50 | | private $_data; |
| 51 | | |
| 52 | | /** |
| 53 | | * @return TListItemType item type |
| 54 | | */ |
| 55 | | public function getItemType() |
| 56 | | { |
| 57 | | return $this->_itemType; |
| 58 | | } |
| 59 | | |
| 60 | | /** |
| 61 | | * @param TListItemType item type. |
| 62 | | */ |
| 63 | | public function setItemType($value) |
| 64 | | { |
| 65 | | $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType'); |
| 66 | | } |
| 67 | | |
| 68 | | /** |
| 69 | | * Returns a value indicating the zero-based index of the item in the corresponding data control's item collection. |
| 70 | | * If the item is not in the collection (e.g. it is a header item), it returns -1. |
| 71 | | * @return integer zero-based index of the item. |
| 72 | | */ |
| 73 | | public function getItemIndex() |
| 74 | | { |
| 75 | | return $this->_itemIndex; |
| 76 | | } |
| 77 | | |
| 78 | | /** |
| 79 | | * Sets the zero-based index for the item. |
| 80 | | * If the item is not in the item collection (e.g. it is a header item), -1 should be used. |
| 81 | | * @param integer zero-based index of the item. |
| 82 | | */ |
| 83 | | public function setItemIndex($value) |
| 84 | | { |
| 85 | | $this->_itemIndex=TPropertyValue::ensureInteger($value); |
| 86 | | } |
| 87 | | |
| 88 | | /** |
| 89 | | * @return mixed the data row associated with the datagrid item |
| 90 | | */ |
| 91 | | public function getData() |
| 92 | | { |
| 93 | | return $this->_data; |
| 94 | | } |
| 95 | | |
| 96 | | /** |
| 97 | | * @param mixed the data row to be associated with the datagrid item |
| 98 | | */ |
| 99 | | public function setData($value) |
| 100 | | { |
| 101 | | $this->_data=$value; |
| 102 | | } |