summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TActiveButton.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/ActiveControls/TActiveButton.php')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveButton.php61
1 files changed, 51 insertions, 10 deletions
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 @@
<?php
-/*
- * Created on 5/05/2006
+/**
+ * TActiveButton class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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 <weizhuo[at]gamil[dot]com>
+ * @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';
}
/**