summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDropDownList.php
diff options
context:
space:
mode:
authorxue <>2006-01-04 04:59:01 +0000
committerxue <>2006-01-04 04:59:01 +0000
commitd1384deb9b3ac872defd08fd01fbf8cf11442b45 (patch)
tree1a013dd4fdbf1f15f21d33aefa001c3ad9337096 /framework/Web/UI/WebControls/TDropDownList.php
parent1c9aa17d682ae92e2e8687ab40916075470830f7 (diff)
Added documentation.
Diffstat (limited to 'framework/Web/UI/WebControls/TDropDownList.php')
-rw-r--r--framework/Web/UI/WebControls/TDropDownList.php46
1 files changed, 45 insertions, 1 deletions
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php
index 9b9b1b92..d56e3e7e 100644
--- a/framework/Web/UI/WebControls/TDropDownList.php
+++ b/framework/Web/UI/WebControls/TDropDownList.php
@@ -1,13 +1,45 @@
<?php
+/**
+ * TDropDownList class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ */
+/**
+ * TDropDownList class
+ *
+ * TDropDownList displays a dropdown list on a Web page.
+ * It inherits all properties and events from {@link TListControl}.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0
+ */
class TDropDownList extends TListControl implements IPostBackDataHandler
{
+ /**
+ * Adds attributes to renderer.
+ * @param THtmlWriter the renderer
+ */
protected function addAttributesToRender($writer)
{
$writer->addAttribute('name',$this->getUniqueID());
parent::addAttributesToRender($writer);
}
+ /**
+ * Loads user input data.
+ * This method is primarly used by framework developers.
+ * @param string the key that can be used to retrieve data from the input data collection
+ * @param array the input data collection
+ * @return boolean whether the data of the component has been changed
+ */
public function loadPostData($key,$values)
{
if(!$this->getEnabled(true))
@@ -26,6 +58,13 @@ class TDropDownList extends TListControl implements IPostBackDataHandler
return false;
}
+ /**
+ * Raises postdata changed event.
+ * This method is required by {@link IPostBackDataHandler} interface.
+ * It is invoked by the framework when {@link getSelectedIndex SelectedIndex} property
+ * is changed on postback.
+ * This method is primarly used by framework developers.
+ */
public function raisePostDataChangedEvent()
{
$page=$this->getPage();
@@ -38,10 +77,15 @@ class TDropDownList extends TListControl implements IPostBackDataHandler
$this->onSelectedIndexChanged(null);
}
+ /**
+ * @return integer the index (zero-based) of the item being selected.
+ * If none is selected, the return value is 0 meaning the first item is selected.
+ * If there is no items, it returns -1.
+ */
public function getSelectedIndex()
{
$index=parent::getSelectedIndex();
- if($index<0 && $this->getItems()->getCount()>0)
+ if($index<0 && $this->getHasItems())
{
$this->setSelectedIndex(0);
return 0;