summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TListBox.php
diff options
context:
space:
mode:
authorxue <>2005-12-14 18:52:04 +0000
committerxue <>2005-12-14 18:52:04 +0000
commit3751bed4e3b40adb98949b85b47daf2cfaac29db (patch)
treeae4de29ad414df7d40a92c5d4b525a4a6b431e4b /framework/Web/UI/WebControls/TListBox.php
parent3071d459eee19f9b01ec0a6241615562548d5fef (diff)
Added TDataBoundControl, TDropDownList and TListBox. Note, they're not done yet.
Diffstat (limited to 'framework/Web/UI/WebControls/TListBox.php')
-rw-r--r--framework/Web/UI/WebControls/TListBox.php86
1 files changed, 86 insertions, 0 deletions
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php
new file mode 100644
index 00000000..79afc133
--- /dev/null
+++ b/framework/Web/UI/WebControls/TListBox.php
@@ -0,0 +1,86 @@
+<?php
+
+class TListBox extends TListControl implements IPostBackDataHandler
+{
+ protected function addAttributesToRender($writer)
+ {
+ $rows=$this->getRows();
+ $writer->addAttribute('size',"$rows");
+ $writer->addAttribute('name',$this->getUniqueID());
+ parent::addAttributesToRender($writer);
+ }
+
+ protected function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ if($this->getSelectionMode()==='Multiple' && $this->getEnabled(true))
+ $this->getPage()->registerRequiresPostData($this);
+ }
+
+ public function loadPostData($key,$values)
+ {
+ if(!$this->getEnabled(true))
+ return false;
+ // ensure DataBound???
+ }
+
+ public function raisePostDataChangedEvent()
+ {
+ $page=$this->getPage();
+ if($this->getAutoPostBack() && !$page->getPostBackEventTarget())
+ {
+ $page->setPostBackEventTarget($this);
+ if($this->getCausesValidation())
+ $page->validate($this->getValidationGroup());
+ }
+ $this->onSelectedIndexChanged(null);
+ }
+
+ protected function getIsMultiSelect()
+ {
+ return $this->getSelectionMode()==='Multiple';
+ }
+
+ public function getSelectedIndices()
+ {
+ return parent::getSelectedIndices();
+ }
+
+ /**
+ * @return integer the number of rows to be displayed in the component
+ */
+ public function getRows()
+ {
+ return $this->getViewState('Rows', 4);
+ }
+
+ /**
+ * Sets the number of rows to be displayed in the component
+ * @param integer the number of rows
+ */
+ public function setRows($value)
+ {
+ $value=TPropertyValue::ensureInteger($value);
+ if($value<=0)
+ $value=4;
+ $this->setViewState('Rows', $value, 4);
+ }
+
+ /**
+ * @return string the selection mode (Single, Multiple )
+ */
+ public function getSelectionMode()
+ {
+ return $this->getViewState('SelectionMode', 'Single');
+ }
+
+ /**
+ * Sets the selection mode of the component (Single, Multiple)
+ * @param string the selection mode
+ */
+ function setSelectionMode($value)
+ {
+ $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,array('Single','Multiple')),'Single');
+ }
+}
+?> \ No newline at end of file