summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveControlAdapter.php2
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLabel.php28
-rw-r--r--framework/Web/UI/ActiveControls/TCallback.php32
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php17
4 files changed, 71 insertions, 8 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
index 77973b2c..6b410edd 100644
--- a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
@@ -20,6 +20,8 @@ class TActiveControlAdapter extends TControlAdapter
self::$_renderedPosts = true;
}
parent::render($writer);
+ if($this->getPage()->getIsCallback())
+ $this->getPage()->getCallbackClient()->replace($this->getControl(), $writer);
}
}
?> \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TActiveLabel.php b/framework/Web/UI/ActiveControls/TActiveLabel.php
index 3216be43..7e5a8084 100644
--- a/framework/Web/UI/ActiveControls/TActiveLabel.php
+++ b/framework/Web/UI/ActiveControls/TActiveLabel.php
@@ -36,6 +36,30 @@ class TActiveLabel extends TLabel
parent::__construct();
$this->setAdapter(new TActiveControlAdapter($this));
}
+
+ /**
+ * @param boolean true to allow fine grain callback updates.
+ */
+ public function setAllowCallbackUpdate($value)
+ {
+ $this->setViewState('CallbackUpdate', TPropertyValue::ensureBoolean($value), true);
+ }
+
+ /**
+ * @return true to allow fine grain callback updates.
+ */
+ public function getAllowCallbackUpdate()
+ {
+ return $this->getViewState('CallbackUpdate', true);
+ }
+
+ /**
+ * @return true if can update changes on the client-side during callback.
+ */
+ protected function canUpdateClientSide()
+ {
+ return $this->getIsInitialized() && $this->getAllowCallbackUpdate();
+ }
/**
* On callback response, the inner HTMl of the label is updated.
@@ -44,7 +68,7 @@ class TActiveLabel extends TLabel
public function setText($value)
{
parent::setText($value);
- if($this->getIsInitialized())
+ if($this->canUpdateClientSide())
{
$this->getPage()->getCallbackClient()->update($this, $value);
}
@@ -59,7 +83,7 @@ class TActiveLabel extends TLabel
public function setForControl($value)
{
parent::setForControl($value);
- if($this->getIsInitialized())
+ if($this->canUpdateClientSide())
{
$id=$this->findControl($value)->getClientID();
$this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id);
diff --git a/framework/Web/UI/ActiveControls/TCallback.php b/framework/Web/UI/ActiveControls/TCallback.php
index 9d2301d8..f42b3143 100644
--- a/framework/Web/UI/ActiveControls/TCallback.php
+++ b/framework/Web/UI/ActiveControls/TCallback.php
@@ -1,9 +1,29 @@
<?php
-
-/*
- * Created on 25/04/2006
+/**
+ * TCallback class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
*/
+/**
+ * TCallback component class.
+ *
+ * The TCallback provides a basic callback handler that can be invoke from the
+ * client side by running the javascript code obtained from the
+ * {@link getCallbackReference CallbackReference} property. The event {@link
+ * onCallback OnCallback} is raise when a callback is requested by the TCallback
+ * component.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
+ * @since 3.0
+ */
class TCallback extends TControl implements ICallbackEventHandler
{
/**
@@ -138,12 +158,14 @@ class TCallback extends TControl implements ICallbackEventHandler
* Returns the javascript statement to invoke a callback request for this
* control. Additional options for callback can be set via subproperties of
* {@link getClientSide ClientSide} property. E.g. ClientSide.OnSuccess="..."
+ * @param TControl callback handler control, use current object if null.
* @return string javascript statement to invoke a callback.
*/
- public function getCallbackReference()
+ public function getCallbackReference($control=null)
{
$client = $this->getPage()->getClientScript();
- return $client->getCallbackReference($this, $this->getCallbackOptions());
+ $object = is_null($control) ? $this : $control;
+ return $client->getCallbackReference($object, $this->getCallbackOptions());
}
}
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php b/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php
index c0a817f0..8c6732e3 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientSideOptions.php
@@ -1,5 +1,15 @@
<?php
-
+/**
+ * TCallbackClientSideOptions class file
+ *
+ * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
+ */
+
/**
* TCallbackClientSideOptions class.
*
@@ -30,6 +40,11 @@
* - <b>EnablePageStateUpdate</b> enable the callback response to enable the
* viewstate update. This will automatically set HasPrority to true when
* enabled.
+ *
+ * @author Wei Zhuo <weizhuo[at]gamil[dot]com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
+ * @since 3.0
*/
class TCallbackClientSideOptions extends TClientSideOptions
{