summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2007-02-09 22:48:31 +0000
committerxue <>2007-02-09 22:48:31 +0000
commitf4c525abc3d4d3f3eecf1019770936e4ca39fd62 (patch)
tree90c069221720555e5cb39d0db544b9366e81caad /framework
parent97606c15be1435c8b910a43812834330032acc75 (diff)
added two item renderer demos.
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/WebControls/THyperLink.php36
1 files changed, 32 insertions, 4 deletions
diff --git a/framework/Web/UI/WebControls/THyperLink.php b/framework/Web/UI/WebControls/THyperLink.php
index af28acef..13a9ab41 100644
--- a/framework/Web/UI/WebControls/THyperLink.php
+++ b/framework/Web/UI/WebControls/THyperLink.php
@@ -27,7 +27,7 @@
* @package System.Web.UI.WebControls
* @since 3.0
*/
-class THyperLink extends TWebControl
+class THyperLink extends TWebControl implements IDataRenderer
{
/**
* @return string tag name of the hyperlink
@@ -63,16 +63,18 @@ class THyperLink extends TWebControl
{
if(($text=$this->getText())!=='')
$writer->write(THttpUtility::htmlEncode($text));
- else
+ else if($this->getHasControls())
parent::renderContents($writer);
+ else
+ $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl()));
}
else
{
$this->createImage($imageUrl)->renderControl($writer);
}
}
-
- /**
+
+ /**
* Gets the TImage for rendering the ImageUrl property. This is not for
* creating dynamic images.
* @param string image url.
@@ -141,6 +143,32 @@ class THyperLink extends TWebControl
}
/**
+ * Returns the URL to link to when the THyperLink component is clicked.
+ * This method is required by {@link IDataRenderer}.
+ * It is the same as {@link getNavigateUrl()}.
+ * @return string the URL to link to when the THyperLink component is clicked
+ * @see getNavigateUrl
+ * @since 3.1.0
+ */
+ public function getData()
+ {
+ return $this->getNavigateUrl();
+ }
+
+ /**
+ * Sets the URL to link to when the THyperLink component is clicked.
+ * This method is required by {@link IDataRenderer}.
+ * It is the same as {@link setNavigateUrl()}.
+ * @param string the URL to link to when the THyperLink component is clicked
+ * @see setNavigateUrl
+ * @since 3.1.0
+ */
+ public function setData($value)
+ {
+ $this->setNavigateUrl($value);
+ }
+
+ /**
* @return string the target window or frame to display the Web page content linked to when the THyperLink component is clicked.
*/
public function getTarget()