From ee25e9fc2a4cc702f1ac9af5645134eaa893cf4c Mon Sep 17 00:00:00 2001 From: Jens Klaer Date: Wed, 20 May 2015 15:41:19 +0200 Subject: viewstate tracking with custom pagestate tracker class - made tracker class customizable through setter, leaving old TCallbackPageStateTracker as default - changed visibility for the tracked control in TCallbackPageStateTracker to protected so deriving tracker classes can access it --- .../Web/UI/ActiveControls/TActiveControlAdapter.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php index bf1bc9f5..a74babf7 100644 --- a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php +++ b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php @@ -45,6 +45,10 @@ class TActiveControlAdapter extends TControlAdapter * @var TCallbackPageStateTracker view state tracker. */ private $_stateTracker; + /** + * @var string view state tracker class. + */ + private $_stateTrackerClass='TCallbackPageStateTracker'; /** * Constructor. @@ -140,7 +144,8 @@ class TActiveControlAdapter extends TControlAdapter { if($this->getIsTrackingPageState()) { - $this->_stateTracker = new TCallbackPageStateTracker($this->getControl()); + $stateTrackerClass = $this->_stateTrackerClass; + $this->_stateTracker = new $stateTrackerClass($this->getControl()); $this->_stateTracker->trackChanges(); } parent::onLoad($param); @@ -167,6 +172,14 @@ class TActiveControlAdapter extends TControlAdapter { return $this->_stateTracker; } + + /** + * @param string state tracker class. + */ + public function setStateTracker($value) + { + $this->_stateTrackerClass = TPropertyValue::ensureString($value); + } } /** @@ -191,7 +204,7 @@ class TCallbackPageStateTracker /** * @var TControl the control tracked */ - private $_control; + protected $_control; /** * @var object null object. */ -- cgit v1.2.3