Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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