From 4d70cc125dcd915cdbc8c4f13964d27ebec96eca Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 5 May 2006 08:20:50 +0000 Subject: Update funky active control example. (see tests/FunctionalTests/features/ --- framework/Web/UI/ActiveControls/TActiveLabel.php | 28 ++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'framework/Web/UI/ActiveControls/TActiveLabel.php') diff --git a/framework/Web/UI/ActiveControls/TActiveLabel.php b/framework/Web/UI/ActiveControls/TActiveLabel.php index 3216be43..7e5a8084 100644 --- a/framework/Web/UI/ActiveControls/TActiveLabel.php +++ b/framework/Web/UI/ActiveControls/TActiveLabel.php @@ -36,6 +36,30 @@ class TActiveLabel extends TLabel parent::__construct(); $this->setAdapter(new TActiveControlAdapter($this)); } + + /** + * @param boolean true to allow fine grain callback updates. + */ + public function setAllowCallbackUpdate($value) + { + $this->setViewState('CallbackUpdate', TPropertyValue::ensureBoolean($value), true); + } + + /** + * @return true to allow fine grain callback updates. + */ + public function getAllowCallbackUpdate() + { + return $this->getViewState('CallbackUpdate', true); + } + + /** + * @return true if can update changes on the client-side during callback. + */ + protected function canUpdateClientSide() + { + return $this->getIsInitialized() && $this->getAllowCallbackUpdate(); + } /** * On callback response, the inner HTMl of the label is updated. @@ -44,7 +68,7 @@ class TActiveLabel extends TLabel public function setText($value) { parent::setText($value); - if($this->getIsInitialized()) + if($this->canUpdateClientSide()) { $this->getPage()->getCallbackClient()->update($this, $value); } @@ -59,7 +83,7 @@ class TActiveLabel extends TLabel public function setForControl($value) { parent::setForControl($value); - if($this->getIsInitialized()) + if($this->canUpdateClientSide()) { $id=$this->findControl($value)->getClientID(); $this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id); -- cgit v1.2.3