diff options
author | javalizard <> | 2010-04-18 01:36:04 +0000 |
---|---|---|
committer | javalizard <> | 2010-04-18 01:36:04 +0000 |
commit | a77f444bbc8059c0bededc47a50f8fd9c05a1549 (patch) | |
tree | 5ce41a7988c75fdaedf7da97ef20945d0ea86785 /framework/Web | |
parent | 98c48b76b2fdf4b99c9fad1631e52d027b965be4 (diff) |
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
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/UI/TControl.php | 73 |
1 files changed, 64 insertions, 9 deletions
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 <qiang.xue@gmail.com>
* @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();
}
/**
@@ -237,6 +242,21 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable }
/**
+ * @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
*/
public function getNamingContainer()
@@ -297,6 +317,32 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable }
/**
+ * 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
* contains this control.
@@ -445,6 +491,13 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable }
/**
+ * @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);
}
/**
|