From d653bda6c6217f160a4de77e3f2f0ee62096be67 Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 15 Feb 2006 05:30:58 +0000 Subject: Added TControlAdapter and TWebControlAdapter and their support in TControl and TWebControl. --- framework/Web/UI/WebControls/TWebControl.php | 3 +- .../Web/UI/WebControls/TWebControlAdapter.php | 72 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 framework/Web/UI/WebControls/TWebControlAdapter.php (limited to 'framework/Web/UI/WebControls') diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php index 18571d73..f302932d 100644 --- a/framework/Web/UI/WebControls/TWebControl.php +++ b/framework/Web/UI/WebControls/TWebControl.php @@ -11,9 +11,10 @@ */ /** - * Includes TStyle definition + * Includes TStyle and TWebAdapter definition */ Prado::using('System.Web.UI.WebControls.TStyle'); +Prado::using('System.Web.UI.WebControls.TWebAdapter'); /** * TWebControl class diff --git a/framework/Web/UI/WebControls/TWebControlAdapter.php b/framework/Web/UI/WebControls/TWebControlAdapter.php new file mode 100644 index 00000000..23205bba --- /dev/null +++ b/framework/Web/UI/WebControls/TWebControlAdapter.php @@ -0,0 +1,72 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + */ + +/** + * TWebControlAdapter class + * + * TWebControlAdapter is the base class for adapters that customize + * rendering for the Web control to which the adapter is attached. + * It may be used to modify the default markup or behavior for specific + * browsers. + * + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + * @since 3.0 + */ +class TWebControlAdapter extends TControlAdapter +{ + /** + * Renders the control to which the adapter is attached. + * It calls {@link renderBeginTag}, {@link renderContents} and + * {@link renderEndTag} in order. + * @param THtmlWriter writer for the rendering purpose + */ + public function render($writer) + { + $this->renderBeginTag($writer); + $this->renderContents($writer); + $this->renderEndTag($writer); + } + + /** + * Renders the openning tag for the attached control. + * Default implementation calls the attached control's corresponding method. + * @param THtmlWriter writer for the rendering purpose + */ + public function renderBeginTag($writer) + { + $this->getControl()->renderBeginTag($writer); + } + + /** + * Renders the body contents within the attached control tag. + * Default implementation calls the attached control's corresponding method. + * @param THtmlWriter writer for the rendering purpose + */ + public function renderContents($writer) + { + $this->getControl()->renderContents($writer); + } + + /** + * Renders the closing tag for the attached control. + * Default implementation calls the attached control's corresponding method. + * @param THtmlWriter writer for the rendering purpose + */ + public function renderEndTag($writer) + { + $this->getControl()->renderEndTag($writer); + } +} + +?> \ No newline at end of file -- cgit v1.2.3