| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TControlAdapter class file.
|
|
|
4 |
*
|
|
|
5 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
6 |
* @link http://www.pradosoft.com/
|
|
|
7 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
8 |
* @license http://www.pradosoft.com/license/
|
|
|
9 |
* @version $Id: TControlAdapter.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
10 |
* @package System.Web.UI
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
* TControlAdapter class
|
|
|
15 |
*
|
|
|
16 |
* TControlAdapter is the base class for adapters that customize
|
|
|
17 |
* various behaviors for the control to which the adapter is attached.
|
|
|
18 |
*
|
|
|
19 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
20 |
* @version $Id: TControlAdapter.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
21 |
* @package System.Web.UI
|
|
|
22 |
* @since 3.0
|
|
|
23 |
*/
|
|
|
24 |
class TControlAdapter extends TApplicationComponent
|
|
|
25 |
{
|
|
|
26 |
/**
|
|
|
27 |
* @var TControl the control to which the adapter is attached
|
|
|
28 |
*/
|
|
|
29 |
private $_control;
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* Constructor.
|
|
|
33 |
* @param TControl the control to which the adapter is attached
|
|
|
34 |
*/
|
|
|
35 |
public function __construct($control)
|
|
|
36 |
{
|
|
|
37 |
$this->_control=$control;
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* @return TControl the control to which this adapter is attached
|
|
|
42 |
*/
|
|
|
43 |
public function getControl()
|
|
|
44 |
{
|
|
|
45 |
return $this->_control;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* @return TPage the page that contains the attached control
|
|
|
50 |
*/
|
|
|
51 |
public function getPage()
|
|
|
52 |
{
|
|
|
53 |
return $this->_control?$this->_control->getPage():null;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* Creates child controls for the attached control.
|
|
|
58 |
* Default implementation calls the attached control's corresponding method.
|
|
|
59 |
*/
|
|
|
60 |
public function createChildControls()
|
|
|
61 |
{
|
|
|
62 |
$this->_control->createChildControls();
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Loads additional persistent control state.
|
|
|
67 |
* Default implementation calls the attached control's corresponding method.
|
|
|
68 |
*/
|
|
|
69 |
public function loadState()
|
|
|
70 |
{
|
|
|
71 |
$this->_control->loadState();
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
* Saves additional persistent control state.
|
|
|
76 |
* Default implementation calls the attached control's corresponding method.
|
|
|
77 |
*/
|
|
|
78 |
public function saveState()
|
|
|
79 |
{
|
|
|
80 |
$this->_control->saveState();
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
/**
|
|
|
84 |
* This method is invoked when the control enters 'OnInit' stage.
|
|
|
85 |
* Default implementation calls the attached control's corresponding method.
|
|
|
86 |
* @param TEventParameter event parameter to be passed to the event handlers
|
|
|
87 |
*/
|
|
|
88 |
public function onInit($param)
|
|
|
89 |
{
|
|
|
90 |
$this->_control->onInit($param);
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
* This method is invoked when the control enters 'OnLoad' stage.
|
|
|
95 |
* Default implementation calls the attached control's corresponding method.
|
|
|
96 |
* @param TEventParameter event parameter to be passed to the event handlers
|
|
|
97 |
*/
|
|
|
98 |
public function onLoad($param)
|
|
|
99 |
{
|
|
|
100 |
$this->_control->onLoad($param);
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
/**
|
|
|
104 |
* This method is invoked when the control enters 'OnPreRender' stage.
|
|
|
105 |
* Default implementation calls the attached control's corresponding method.
|
|
|
106 |
* @param TEventParameter event parameter to be passed to the event handlers
|
|
|
107 |
*/
|
|
|
108 |
public function onPreRender($param)
|
|
|
109 |
{
|
|
|
110 |
$this->_control->onPreRender($param);
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
/**
|
|
|
114 |
* This method is invoked when the control enters 'OnUnload' stage.
|
|
|
115 |
* Default implementation calls the attached control's corresponding method.
|
|
|
116 |
* @param TEventParameter event parameter to be passed to the event handlers
|
|
|
117 |
*/
|
|
|
118 |
public function onUnload($param)
|
|
|
119 |
{
|
|
|
120 |
$this->_control->onUnload($param);
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
/**
|
|
|
124 |
* This method is invoked when the control renders itself.
|
|
|
125 |
* Default implementation calls the attached control's corresponding method.
|
|
|
126 |
* @param THtmlWriter writer for the rendering purpose
|
|
|
127 |
*/
|
|
|
128 |
public function render($writer)
|
|
|
129 |
{
|
|
|
130 |
$this->_control->render($writer);
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
/**
|
|
|
134 |
* Renders the control's children.
|
|
|
135 |
* Default implementation calls the attached control's corresponding method.
|
|
|
136 |
* @param THtmlWriter writer for the rendering purpose
|
|
|
137 |
*/
|
|
|
138 |
public function renderChildren($writer)
|
|
|
139 |
{
|
|
|
140 |
$this->_control->renderChildren($writer);
|
|
|
141 |
}
|
|
|
142 |
}
|
|
|
143 |
|