blob: bce381b773ec77aaf1e05dbda21b952a04f2a64e (
plain)
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
|
<?php
/**
* TTriggeredCallback class file.
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.ActiveControls
*/
Prado::using('System.Web.UI.ActiveControls.TCallback');
/**
* TTriggeredCallback abstract Class
*
* Base class for triggered callback controls. The {@link setControlID ControlID}
* property sets the control ID to observe the trigger.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Id$
* @package System.Web.UI.ActiveControls
* @since 3.1
*/
abstract class TTriggeredCallback extends TCallback
{
/**
* @return string The ID of the server control the trigger is bounded to.
*/
public function getControlID()
{
return $this->getViewState('ControlID', '');
}
/**
* @param string The ID of the server control the trigger is bounded to.
*/
public function setControlID($value)
{
$this->setViewState('ControlID', $value, '');
}
/**
* @return string target control client ID or html element ID if
* control is not found in hierarchy.
*/
protected function getTargetControl()
{
$id = $this->getControlID();
if(($control=$this->findControl($id)) instanceof TControl)
return $control->getClientID();
if($id==='')
{
throw new TConfigurationException(
'ttriggeredcallback_invalid_controlid', get_class($this));
}
return $id;
}
/**
* @return array list of trigger callback options.
*/
protected function getTriggerOptions()
{
$options['ID'] = $this->getClientID();
$options['EventTarget'] = $this->getUniqueID();
$options['ControlID'] = $this->getTargetControl();
return $options;
}
}
|