From a77f444bbc8059c0bededc47a50f8fd9c05a1549 Mon Sep 17 00:00:00 2001 From: javalizard <> Date: Sun, 18 Apr 2010 01:36:04 +0000 Subject: TComponent- adds a blank __construct function to unify the constructor call path for all objects. TApplication- Adds final attribute to the parameters in the config so folder config.xml cannot override if set to true. Adds a mergeParameter function to unify parameter setting. Fixed a bug where loadParametersPhp wasn't getting the properties correctly. TControl- calls the parent::__construct, Adds render blocking. (the PRADO class using this will be added in a week or two) TParameterModule- Adds final attribute to the parameter option so folder configs cannot override if set to true. Uses the application mergeParameter function. Adds final to the php parameter loader --- framework/Web/UI/TControl.php | 73 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 9 deletions(-) (limited to 'framework/Web/UI/TControl.php') diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 1c03a04d..79a691ec 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2010 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI @@ -172,12 +172,17 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable * @var array a collection of rare control data */ private $_rf=array(); + /** + * @var number this is how many times the control was told not to render + */ + private $_renderblockcount=0; /** * Constructor. */ public function __construct() { + parent::__construct(); } /** @@ -236,6 +241,21 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable return $this->_parent; } + /** + * @return TControl the parent of this control of type + */ + public function getParentOfType($type,$strict=false) + { + $control = $this->Parent; + do { + if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type)))) + return $control; + $control = $control->Parent; + } while($control); + + return null; + } + /** * @return TControl the naming container of this control */ @@ -296,6 +316,32 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable return $this->_tplControl; } + /** + * This adds a block to the rendering of the control + */ + public function addRenderBlock() + { + ++$this->_renderblockcount; + } + + /** + * @return boolean true if the rendering is currently blocked + */ + public function getIsRenderBlocked() + { + return $this->_renderblockcount > 0; + } + + /** + * removes a block. This also has an interesting effect of forcing the render if called in the reverse + * of the typical order. eg. removeRenderBlock(); ...... addRenderBlock(); + */ + public function removeRenderBlock() + { + --$this->_renderblockcount; + } + + /** * @return TTemplateControl the control whose template is loaded from * some external storage, such as file, db, and whose template ultimately @@ -444,6 +490,13 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable $this->_rf[self::RF_SKIN_ID]=$value; } + /** + * @return boolean whether the skin has been applied or is past the phase of skin application + */ + public function getIsSkinApplied() { + return ($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage>self::CS_CHILD_INITIALIZED; + } + /** * @return boolean whether theming is enabled for this control. * The theming is enabled if the control and all its parents have it enabled. @@ -1564,6 +1617,8 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable { if($this->getHasControls()) { + if($this->IsRenderBlocked) return; + foreach($this->_rf[self::RF_CONTROLS] as $control) { if(is_string($control)) @@ -1997,14 +2052,14 @@ interface IValidatable * @return mixed the value of the property to be validated. */ public function getValidationPropertyValue(); - /** - * @return boolean wether this control's validators validated successfully (must default to true) - */ - public function getIsValid(); - /** - * @return boolean wether this control's validators validated successfully - */ - public function setIsValid($value); + /** + * @return boolean wether this control's validators validated successfully (must default to true) + */ + public function getIsValid(); + /** + * @return boolean wether this control's validators validated successfully + */ + public function setIsValid($value); } /** -- cgit v1.2.3