summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TActiveLabel.php
diff options
context:
space:
mode:
authorwei <>2006-05-05 00:45:35 +0000
committerwei <>2006-05-05 00:45:35 +0000
commitf21d3433721308f5d0693f44bbfed56f7b2ecc2d (patch)
tree96f10eb302f0a156ebc237d9ab0949986c4f469e /framework/Web/UI/ActiveControls/TActiveLabel.php
parent42df6f47862c2f1495ded49f758dbc46f9d9e930 (diff)
Adding TActiveLabel
Diffstat (limited to 'framework/Web/UI/ActiveControls/TActiveLabel.php')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLabel.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveLabel.php b/framework/Web/UI/ActiveControls/TActiveLabel.php
new file mode 100644
index 00000000..d71d8b7a
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TActiveLabel.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * TActiveLabel 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
+ */
+
+/**
+ * TActiveLabel class
+ *
+ * The active control counterpart of TLabel component. During a callback
+ * request, setting {@link setText Text} property will also set the text of the
+ * label on the client upon callback completion. Similarly, setting {@link
+ * setForControl ForControl} will set the client-side for attribute on the
+ * label.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.ActiveControls
+ * @since 3.0
+ */
+class TActiveLabel extends TLabel
+{
+ /**
+ * Creates a new callback control, sets the adapter to
+ * TActiveControlAdapter. If you override this class, be sure to set the
+ * adapter appropriately by, for example, call this constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setAdapter(new TActiveControlAdapter($this));
+ }
+
+ /**
+ * On callback response, the inner HTMl of the label is updated.
+ * @param string the text value of the label
+ */
+ public function setText($value)
+ {
+ parent::setText($value);
+ if($this->getPage()->getAllowCallbackUpdate())
+ {
+ $this->getPage()->getCallbackClient()->update($this, $value);
+ }
+ }
+
+ /**
+ * Sets the ID of the control that the label is associated with.
+ * The control must be locatable via {@link TControl::findControl} using the ID.
+ * On callback response, the For attribute of the label is updated.
+ * @param string the associated control ID
+ */
+ public function setForControl($value)
+ {
+ parent::setForControl($value);
+ if($this->getPage()->getAllowCallbackUpdate())
+ {
+ $id=$this->findControl($value)->getClientID();
+ $this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id);
+ }
+ }
+}
+
+?>