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