From a6be5564823be40670e0cad8dc758557dbd37549 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 24 Jun 2006 05:46:22 +0000 Subject: Update active controls. --- .../Web/UI/ActiveControls/TActiveHyperLink.php | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 framework/Web/UI/ActiveControls/TActiveHyperLink.php (limited to 'framework/Web/UI/ActiveControls/TActiveHyperLink.php') diff --git a/framework/Web/UI/ActiveControls/TActiveHyperLink.php b/framework/Web/UI/ActiveControls/TActiveHyperLink.php new file mode 100644 index 00000000..ac99089d --- /dev/null +++ b/framework/Web/UI/ActiveControls/TActiveHyperLink.php @@ -0,0 +1,99 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ : $ + * @package System.Web.UI.ActiveControls + */ + +/** + * TActiveHyperLink class. + * + * The active control counterpart of THyperLink component. When + * {@link TBaseActiveControl::setEnableUpdate ActiveControl.EnableUpdate} + * property is true the during a callback request, setting {@link setText Text} + * property will also set the text of the label on the client upon callback + * completion. Similarly, for other properties such as {@link setImageUrl ImageUrl}, + * {@link setNavigateUrl NavigateUrl} and {@link setTarget Target}. + * + * @author Wei Zhuo + * @version : $ Mon Jun 26 00:08:24 EST 2006 $ + * @package System.Web.UI.ActiveControls + * @since 3.0 + */ +class TActiveHyperLink extends THyperLink implements IActiveControl +{ + /** + * 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, by calling this constructor. + */ + public function __construct() + { + parent::__construct(); + $this->setAdapter(new TActiveControlAdapter($this)); + } + + /** + * @return TBaseActiveControl basic active control options. + */ + public function getActiveControl() + { + return $this->getAdapter()->getBaseActiveControl(); + } + + /** + * 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->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getCallbackClient()->update($this, $value); + } + + /** + * Sets the location of image file of the THyperLink. + * @param string the image file location + */ + public function setImageUrl($value) + { + parent::setImageUrl($value); + if($this->getActiveControl()->canUpdateClientSide() && $value !== '') + { + $textWriter = new TTextWriter(); + $renderer = new THtmlWriter($textWriter); + $this->createImage($value)->renderControl($renderer); + $this->getPage()->getCallbackClient()->update($this, $textWriter->flush()); + } + } + + /** + * Sets the URL to link to when the THyperLink component is clicked. + * @param string the URL + */ + public function setNavigateUrl($value) + { + parent::setNavigateUrl($value); + if($this->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getCallbackClient()->setAttribute($this, 'href', $value); + } + + /** + * Sets the target window or frame to display the Web page content linked to when the THyperLink component is clicked. + * @param string the target window, valid values include '_blank', '_parent', '_self', '_top' and empty string. + */ + public function setTarget($value) + { + parent::setTarget($value); + if($this->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getCallbackClient()->setAttribute($this, 'target', $value); + } +} + +?> \ No newline at end of file -- cgit v1.2.3