summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/TControl.php73
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 &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 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);
}
/**