1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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');
}
}
?>
|