From 67e09d150afe55d7a956beb299dc0534f7da68eb Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 15 Jun 2006 00:56:57 +0000 Subject: Update active controls. Add comments. Add THttpResponseAdapter --- framework/Web/UI/ActiveControls/TActiveButton.php | 61 +++++++++++++++++++---- 1 file changed, 51 insertions(+), 10 deletions(-) (limited to 'framework/Web/UI/ActiveControls/TActiveButton.php') diff --git a/framework/Web/UI/ActiveControls/TActiveButton.php b/framework/Web/UI/ActiveControls/TActiveButton.php index 84db60fc..f4bfc678 100644 --- a/framework/Web/UI/ActiveControls/TActiveButton.php +++ b/framework/Web/UI/ActiveControls/TActiveButton.php @@ -1,8 +1,33 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls */ +/** + * TActiveButton is the active control counter part to TButton. + * + * When a TActiveButton is clicked, rather than a normal post back request a + * callback request is initiated. + * + * The {@link onCallback OnCallback} event is raised during a callback request + * and it is raise before the {@link onClick OnClick} event. + * + * When the {@link TBaseActiveCallbackControl::setEnableUpdate ActiveControl.EnableUpdate} + * property is true, changing the {@link setText Text} property during callback request + * will update the button's caption upon callback response completion. + * + * @author Wei Zhuo + * @version $Revision: $ $Date: $ + * @package System.Web.UI.ActiveControls + * @since 3.0 + */ class TActiveButton extends TButton implements ICallbackEventHandler { /** @@ -17,11 +42,11 @@ class TActiveButton extends TButton implements ICallbackEventHandler } /** - * @return TBaseActiveCallbackControl base callback options. + * @return TBaseActiveCallbackControl standard callback control options. */ public function getActiveControl() { - return $this->getAdapter()->getActiveControl(); + return $this->getAdapter()->getBaseActiveControl(); } /** @@ -29,14 +54,14 @@ class TActiveButton extends TButton implements ICallbackEventHandler * ICallbackEventHandler} interface. If {@link getCausesValidation * CausesValidation} is true, it will invoke the page's {@link TPage:: * validate validate} method first. It will raise {@link onCallback - * OnCallback} event and then the {@link onClick OnClick} event. This method - * is mainly used by framework and control developers. + * OnCallback} event first and then the {@link onClick OnClick} event. + * This method is mainly used by framework and control developers. * @param TCallbackEventParameter the event parameter */ public function raiseCallbackEvent($param) { - $this->raisePostBackEvent($param); $this->onCallback($param); + $this->raisePostBackEvent($param); } /** @@ -51,7 +76,9 @@ class TActiveButton extends TButton implements ICallbackEventHandler $this->raiseEvent('OnCallback', $this, $param); } - /** + /** + * Updates the button text on the client-side if the + * {@link setEnableUpdate EnableUpdate} property is set to true. * @param string caption of the button */ public function setText($value) @@ -62,17 +89,31 @@ class TActiveButton extends TButton implements ICallbackEventHandler } /** - * Renders the callback control javascript statement. + * Override parent implementation, no javascript is rendered here instead + * the javascript required for active control is registered in {@link addAttributesToRender}. */ protected function renderClientControlScript($writer) { } + /** + * Ensure that the ID attribute is rendered and registers the javascript code + * for initializing the active control. + */ protected function addAttributesToRender($writer) { parent::addAttributesToRender($writer); $writer->addAttribute('id',$this->getClientID()); - $this->getActiveControl()->registerCallbackClientScript($this->getPostBackOptions()); + $this->getActiveControl()->registerCallbackClientScript( + $this->getClientClassName(), $this->getPostBackOptions()); + } + + /** + * @return string corresponding javascript class name for this TActiveButton. + */ + protected function getClientClassName() + { + return 'Prado.WebUI.TActiveButton'; } /** -- cgit v1.2.3