summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorxue <>2007-04-09 02:44:50 +0000
committerxue <>2007-04-09 02:44:50 +0000
commitd43420201b1ed45574886e4a94f3f904bd4ea517 (patch)
treeb2f86958f6f5257a36e071b5ae7ea6cb73f1c0ba /framework/Web
parentff32eed01f783ee33caeacb0f7315612f0994f8f (diff)
Implemented IDataRenderer for TListControl.
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TDataBoundControl.php15
-rw-r--r--framework/Web/UI/WebControls/TListControl.php28
2 files changed, 33 insertions, 10 deletions
diff --git a/framework/Web/UI/WebControls/TDataBoundControl.php b/framework/Web/UI/WebControls/TDataBoundControl.php
index b043060d..653a4e44 100644
--- a/framework/Web/UI/WebControls/TDataBoundControl.php
+++ b/framework/Web/UI/WebControls/TDataBoundControl.php
@@ -328,7 +328,12 @@ abstract class TDataBoundControl extends TWebControl
$this->setRequiresDataBinding(false);
$this->dataBindProperties();
$this->onDataBinding(null);
- $data=$this->getData();
+
+ if(($view=$this->getDataSourceView())!==null)
+ $data=$view->select($this->getSelectParameters());
+ else
+ $data=null;
+
if($data instanceof Traversable)
{
if($this->getAllowPaging())
@@ -359,14 +364,6 @@ abstract class TDataBoundControl extends TWebControl
$this->setRequiresDataBinding(true);
}
- protected function getData()
- {
- if(($view=$this->getDataSourceView())!==null)
- return $view->select($this->getSelectParameters());
- else
- return null;
- }
-
protected function getDataSourceView()
{
if(!$this->_currentViewValid)
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php
index d726d1a2..bb51934c 100644
--- a/framework/Web/UI/WebControls/TListControl.php
+++ b/framework/Web/UI/WebControls/TListControl.php
@@ -78,7 +78,7 @@ Prado::using('System.Util.TDataFieldAccessor');
* @package System.Web.UI.WebControls
* @since 3.0
*/
-abstract class TListControl extends TDataBoundControl
+abstract class TListControl extends TDataBoundControl implements IDataRenderer
{
/**
* @var TListItemCollection item list
@@ -549,6 +549,32 @@ abstract class TListControl extends TDataBoundControl
}
/**
+ * Returns the value of the selected item with the lowest cardinal index.
+ * This method is required by {@link IDataRenderer}.
+ * It is the same as {@link getSelectedValue()}.
+ * @return string the value of the selected item with the lowest cardinal index, empty if no selection.
+ * @see getSelectedValue
+ * @since 3.1.0
+ */
+ public function getData()
+ {
+ return $this->getSelectedValue();
+ }
+
+ /**
+ * Selects an item by the specified value.
+ * This method is required by {@link IDataRenderer}.
+ * It is the same as {@link setSelectedValue()}.
+ * @param string the value of the item to be selected.
+ * @see setSelectedValue
+ * @since 3.1.0
+ */
+ public function setData($value)
+ {
+ $this->setSelectedValue($value);
+ }
+
+ /**
* @return string the value of the selected item with the lowest cardinal index, empty if no selection
*/
public function getSelectedValue()