From 16a21c1b65deebae478ef7b8dbea8db689f456c1 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 16 Dec 2005 15:26:52 +0000 Subject: Split dataBind() into dataBindProperties() and dataBindChildren(). --- framework/Web/UI/TControl.php | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index e84f2f5b..5c3eecc6 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -727,22 +727,35 @@ class TControl extends TComponent } /** - * Performs the databinding for this component. - * Databinding a property includes evaluating the binded expression - * and setting the property with the evaluation result. + * Performs the databinding for this control. * @param boolean whether to raise DataBinding event. - * @throws TInvalidOperationException if some bounded property is invalid - * @throws TExpressionInvalidException if some bounded expression is invalid */ public function dataBind($raiseDataBindingEvent=true) + { + $this->dataBindProperties($raiseDataBindingEvent); + if($raiseDataBindingEvent) + $this->onDataBinding(null); + $this->dataBindChildren($raiseDataBindingEvent); + } + + /** + * Databinding properties of the control. + */ + protected function dataBindProperties() { if(isset($this->_rf[self::RF_DATA_BINDINGS])) { foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression) $this->setSubProperty($property,$this->evaluateExpression($expression)); - if($raiseDataBindingEvent) - $this->onDataBinding(null); } + } + + /** + * Databinding child controls. + * @param boolean whether to raise DataBinding event. + */ + protected function dataBindChildren($raiseDataBindingEvent) + { if(isset($this->_rf[self::RF_CONTROLS])) { foreach($this->_rf[self::RF_CONTROLS] as $control) -- cgit v1.2.3