Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * TActiveRadioButtonList class file.
4
 *
5
 * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2008 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: TActiveRadioButtonList.php 2573 2008-11-25 12:21:59Z carlgmathisen $
10
 * @package System.Web.UI.ActiveControls
11
 */
12
 
13
/**
14
 * Load active control adapter and active radio button.
15
 */
16
Prado::using('System.Web.UI.ActiveControls.TActiveListControlAdapter');
17
Prado::using('System.Web.UI.ActiveControls.TActiveRadioButton');
18
 
19
/**
20
 * TActiveRadioButtonList class.
21
 *
22
 * The active control counter part to radio button list control.
23
 * The {@link setAutoPostBack AutoPostBack} property is set to true by default.
24
 * Thus, when a radio button is clicked a {@link onCallback OnCallback} event is
25
 * raised after {@link OnSelectedIndexChanged} event.
26
 *
27
 * With {@link TBaseActiveControl::setEnableUpdate() ActiveControl.EnabledUpdate}
28
 * set to true (default is true), changes to the selection will be updated
29
 * on the client side.
30
 *
31
 * List items can not be changed dynamically during a callback request.
32
 *
33
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
34
 * @version $Id: TActiveRadioButtonList.php 2573 2008-11-25 12:21:59Z carlgmathisen $
35
 * @package System.Web.UI.ActiveControls
36
 * @since 3.1
37
 */
38
class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl, ICallbackEventHandler
39
{
40
	/**
41
	 * Creates a new callback control, sets the adapter to
42
	 * TActiveListControlAdapter. If you override this class, be sure to set the
43
	 * adapter appropriately by, for example, by calling this constructor.
44
	 */
45
	public function __construct()
46
	{
47
		$this->setAdapter(new TActiveListControlAdapter($this));
48
		$this->setAutoPostBack(true);
49
		parent::__construct();
50
	}
51
 
52
	/**
53
	 * @return TBaseActiveCallbackControl standard callback control options.
54
	 */
55
	public function getActiveControl()
56
	{
57
		return $this->getAdapter()->getBaseActiveControl();
58
	}
59
 
60
	/**
61
	 * @return TCallbackClientSide client side request options.
62
	 */
63
	public function getClientSide()
64
	{
65
		return $this->getAdapter()->getBaseActiveControl()->getClientSide();
66
	}
67
 
68
	/**
69
	 * Override parent implementation, no javascript is rendered here instead
70
	 * the javascript required for active control is registered in {@link addAttributesToRender}.
71
	 */
72
	protected function renderClientControlScript($writer)
73
	{
74
	}
75
 
76
	/**
77
	 * Creates a control used for repetition (used as a template).
78
	 * @return TControl the control to be repeated
79
	 */
80
	protected function createRepeatedControl()
81
	{
82
		$control = new TActiveRadioButton;
83
		$control->getAdapter()->setBaseActiveControl($this->getActiveControl());
84
		return $control;
85
	}
86
 
87
	/**
88
	 * Raises the callback event. This method is required by {@link
89
	 * ICallbackEventHandler} interface.
90
	 * This method is mainly used by framework and control developers.
91
	 * @param TCallbackEventParameter the event parameter
92
	 */
93
 	public function raiseCallbackEvent($param)
94
	{
95
		$this->onCallback($param);
96
	}
97
 
98
	/**
99
	 * This method is invoked when a callback is requested. The method raises
100
	 * 'OnCallback' event to fire up the event handlers. If you override this
101
	 * method, be sure to call the parent implementation so that the event
102
	 * handler can be invoked.
103
	 * @param TCallbackEventParameter event parameter to be passed to the event handlers
104
	 */
105
	public function onCallback($param)
106
	{
107
		$this->raiseEvent('OnCallback', $this, $param);
108
	}
109
}
110
 
111
?>