summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-10-06 21:05:39 +0000
committerxue <>2007-10-06 21:05:39 +0000
commit5892bb8bb76f7e4addd14da5dd9c5a68b6c59db9 (patch)
tree36d9230dedb1365862faca8718ad6e0d86582b6f
parentb9b876ae5968ca65c4b3cd66f3e92ae4e69cab69 (diff)
Added TDataRenderer and TItemDataRenderer
-rw-r--r--.gitattributes2
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/WebControls/TDataListItemRenderer.php83
-rw-r--r--framework/Web/UI/WebControls/TDataRenderer.php53
-rw-r--r--framework/Web/UI/WebControls/TItemDataRenderer.php83
-rw-r--r--framework/Web/UI/WebControls/TRepeaterItemRenderer.php82
6 files changed, 151 insertions, 153 deletions
diff --git a/.gitattributes b/.gitattributes
index 42234cde..298a0308 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2542,6 +2542,7 @@ framework/Web/UI/WebControls/TDataGridItemRenderer.php -text
framework/Web/UI/WebControls/TDataGridPagerStyle.php -text
framework/Web/UI/WebControls/TDataList.php -text
framework/Web/UI/WebControls/TDataListItemRenderer.php -text
+framework/Web/UI/WebControls/TDataRenderer.php -text
framework/Web/UI/WebControls/TDataSourceControl.php -text
framework/Web/UI/WebControls/TDataSourceView.php -text
framework/Web/UI/WebControls/TDataTypeValidator.php -text
@@ -2562,6 +2563,7 @@ framework/Web/UI/WebControls/TImage.php -text
framework/Web/UI/WebControls/TImageButton.php -text
framework/Web/UI/WebControls/TImageMap.php -text
framework/Web/UI/WebControls/TInlineFrame.php -text
+framework/Web/UI/WebControls/TItemDataRenderer.php -text
framework/Web/UI/WebControls/TJavascriptLogger.php -text
framework/Web/UI/WebControls/TKeyboard.php -text
framework/Web/UI/WebControls/TLabel.php -text
diff --git a/HISTORY b/HISTORY
index e0c10228..fd1462ff 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,7 @@ Version 3.1.2 To be released
============================
CHG: Changed TConditional so that the controls in its template behave like they are in its parent (Qiang)
NEW: Added TDbLogRoute (Qiang)
+NEW: Added TDataRenderer and TItemDataRenderer (Qiang)
Version 3.1.1 October 1, 2007
=============================
diff --git a/framework/Web/UI/WebControls/TDataListItemRenderer.php b/framework/Web/UI/WebControls/TDataListItemRenderer.php
index 82f466e9..40eea582 100644
--- a/framework/Web/UI/WebControls/TDataListItemRenderer.php
+++ b/framework/Web/UI/WebControls/TDataListItemRenderer.php
@@ -16,41 +16,22 @@ Prado::using('System.Web.UI.WebControls.TDataList');
* TDataListItemRenderer class
*
* TDataListItemRenderer can be used as a convenient base class to
- * define an item renderer class for {@link TDataList}.
+ * define an item renderer class specific for {@link TDataList}.
*
- * Because TDataListItemRenderer extends from {@link TTemplateControl}, derived child classes
- * can have templates to define their presentational layout.
+ * TDataListItemRenderer extends {@link TItemDataRenderer} and implements
+ * the bubbling scheme for the OnCommand event of data list items.
+ *
+ * TDataListItemRenderer also implements the {@link IStyleable} interface,
+ * which allows TDataList to apply CSS styles to the renders.
*
- * TDataListItemRenderer implements {@link IItemDataRenderer} interface,
- * which enables the following properties that are related with data-bound controls:
- * - {@link getItemIndex ItemIndex}: zero-based index of this control in the datalist item collection.
- * - {@link getItemType ItemType}: item type of this control, such as TListItemType::AlternatingItem
- * - {@link getData Data}: data associated with this control
-
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package System.Web.UI.WebControls
* @since 3.1.0
*/
-class TDataListItemRenderer extends TTemplateControl implements IItemDataRenderer, IStyleable
+class TDataListItemRenderer extends TItemDataRenderer implements IStyleable
{
/**
- * index of the data item in the Items collection of TDataList
- * @var integer
- */
- private $_itemIndex;
- /**
- * type of the TDataListItem
- * @var TListItemType
- */
- private $_itemType;
- /**
- * value of the data associated with this item
- * @var mixed
- */
- private $_data;
-
- /**
* Creates a style object to be used by the control.
* This method may be overriden by controls to provide customized style.
* @return TStyle
@@ -92,56 +73,6 @@ class TDataListItemRenderer extends TTemplateControl implements IItemDataRendere
}
/**
- * @return TListItemType item type
- */
- public function getItemType()
- {
- return $this->_itemType;
- }
-
- /**
- * @param TListItemType item type.
- */
- public function setItemType($value)
- {
- $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
- }
-
- /**
- * @return integer zero-based index of the item in the item collection of datalist
- */
- public function getItemIndex()
- {
- return $this->_itemIndex;
- }
-
- /**
- * Sets the zero-based index for the item.
- * If the item is not in the item collection (e.g. it is a header item), -1 should be used.
- * @param integer zero-based index of the item.
- */
- public function setItemIndex($value)
- {
- $this->_itemIndex=TPropertyValue::ensureInteger($value);
- }
-
- /**
- * @return mixed data associated with the item
- */
- public function getData()
- {
- return $this->_data;
- }
-
- /**
- * @param mixed data to be associated with the item
- */
- public function setData($value)
- {
- $this->_data=$value;
- }
-
- /**
* This method overrides parent's implementation by wrapping event parameter
* for <b>OnCommand</b> event with item information.
* @param TControl the sender of the event
diff --git a/framework/Web/UI/WebControls/TDataRenderer.php b/framework/Web/UI/WebControls/TDataRenderer.php
new file mode 100644
index 00000000..c1efc482
--- /dev/null
+++ b/framework/Web/UI/WebControls/TDataRenderer.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * TDataRenderer class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.1.2
+ */
+
+/**
+ * TDataRenderer class
+ *
+ * TDataRenderer is the convenient base class for template-based renderer controls.
+ * It extends {@link TTemplateControl} and implements the methods required
+ * by the {@link IDataRenderer} interface.
+ *
+ * The following property is provided by TDataRenderer:
+ * - {@link getData Data}: data associated with this renderer.
+
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.1.2
+ */
+abstract class TDataRenderer extends TTemplateControl implements IDataRenderer
+{
+ /**
+ * @var mixed data associated with this renderer
+ */
+ private $_data;
+
+ /**
+ * @return mixed data associated with the item
+ */
+ public function getData()
+ {
+ return $this->_data;
+ }
+
+ /**
+ * @param mixed data to be associated with the item
+ */
+ public function setData($value)
+ {
+ $this->_data=$value;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TItemDataRenderer.php b/framework/Web/UI/WebControls/TItemDataRenderer.php
new file mode 100644
index 00000000..1115b862
--- /dev/null
+++ b/framework/Web/UI/WebControls/TItemDataRenderer.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ * TItemDataRenderer class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.1.2
+ */
+
+Prado::using('System.Web.UI.WebControls.TDataBoundControl');
+
+/**
+ * TItemDataRenderer class
+ *
+ * TItemDataRenderer is the convient base class for template-based item data renderers.
+ * It implements the {@link IItemDataRenderer} interface, and because
+ * TItemDataRenderer extends from {@link TTemplateControl}, derived child
+ * classes can have templates to define their presentational layout.
+ *
+ * The following properties are provided by TItemDataRenderer:
+ * - {@link getItemIndex ItemIndex}: zero-based index of this renderer in the item list collection.
+ * - {@link getItemType ItemType}: item type of this renderer, such as TListItemType::AlternatingItem
+ * - {@link getData Data}: data associated with this renderer
+
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.1.2
+ */
+abstract class TItemDataRenderer extends TDataRenderer implements IItemDataRenderer
+{
+ /**
+ * index of the data item in the Items collection of repeater
+ */
+ private $_itemIndex;
+ /**
+ * type of the TRepeaterItem
+ * @var TListItemType
+ */
+ private $_itemType;
+
+ /**
+ * @return TListItemType item type
+ */
+ public function getItemType()
+ {
+ return $this->_itemType;
+ }
+
+ /**
+ * @param TListItemType item type.
+ */
+ public function setItemType($value)
+ {
+ $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
+ }
+
+ /**
+ * Returns a value indicating the zero-based index of the item in the corresponding data control's item collection.
+ * If the item is not in the collection (e.g. it is a header item), it returns -1.
+ * @return integer zero-based index of the item.
+ */
+ public function getItemIndex()
+ {
+ return $this->_itemIndex;
+ }
+
+ /**
+ * Sets the zero-based index for the item.
+ * If the item is not in the item collection (e.g. it is a header item), -1 should be used.
+ * @param integer zero-based index of the item.
+ */
+ public function setItemIndex($value)
+ {
+ $this->_itemIndex=TPropertyValue::ensureInteger($value);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TRepeaterItemRenderer.php b/framework/Web/UI/WebControls/TRepeaterItemRenderer.php
index fa0b2aca..b37f685a 100644
--- a/framework/Web/UI/WebControls/TRepeaterItemRenderer.php
+++ b/framework/Web/UI/WebControls/TRepeaterItemRenderer.php
@@ -11,97 +11,25 @@
*/
Prado::using('System.Web.UI.WebControls.TRepeater');
+Prado::using('System.Web.UI.WebControls.TItemDataRenderer');
/**
* TRepeaterItemRenderer class
*
* TRepeaterItemRenderer can be used as a convenient base class to
- * define an item renderer class for {@link TRepeater}.
+ * define an item renderer class specific for {@link TRepeater}.
*
- * Because TRepeaterItemRenderer extends from {@link TTemplateControl}, derived child classes
- * can have templates to define their presentational layout.
+ * TRepeaterItemRenderer extends {@link TItemDataRenderer} and implements
+ * the bubbling scheme for the OnCommand event of repeater items.
*
- * TRepeaterItemRenderer implements {@link IItemDataRenderer} interface,
- * which enables the following properties that are related with data-bound controls:
- * - {@link getItemIndex ItemIndex}: zero-based index of this control in the repeater item collection.
- * - {@link getItemType ItemType}: item type of this control, such as TListItemType::AlternatingItem
- * - {@link getData Data}: data associated with this control
-
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package System.Web.UI.WebControls
* @since 3.1.0
*/
-class TRepeaterItemRenderer extends TTemplateControl implements IItemDataRenderer
+class TRepeaterItemRenderer extends TItemDataRenderer
{
/**
- * index of the data item in the Items collection of repeater
- */
- private $_itemIndex;
- /**
- * type of the TRepeaterItem
- * @var TListItemType
- */
- private $_itemType;
- /**
- * data associated with this item
- * @var mixed
- */
- private $_data;
-
- /**
- * @return TListItemType item type
- */
- public function getItemType()
- {
- return $this->_itemType;
- }
-
- /**
- * @param TListItemType item type.
- */
- public function setItemType($value)
- {
- $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
- }
-
- /**
- * Returns a value indicating the zero-based index of the item in the corresponding data control's item collection.
- * If the item is not in the collection (e.g. it is a header item), it returns -1.
- * @return integer zero-based index of the item.
- */
- public function getItemIndex()
- {
- return $this->_itemIndex;
- }
-
- /**
- * Sets the zero-based index for the item.
- * If the item is not in the item collection (e.g. it is a header item), -1 should be used.
- * @param integer zero-based index of the item.
- */
- public function setItemIndex($value)
- {
- $this->_itemIndex=TPropertyValue::ensureInteger($value);
- }
-
- /**
- * @return mixed data associated with the item
- */
- public function getData()
- {
- return $this->_data;
- }
-
- /**
- * @param mixed data to be associated with the item
- */
- public function setData($value)
- {
- $this->_data=$value;
- }
-
- /**
* This method overrides parent's implementation by wrapping event parameter
* for <b>OnCommand</b> event with item information.
* @param TControl the sender of the event