From 81d3bc50d96a11bd411f8f0fa5831a85228ffe4e Mon Sep 17 00:00:00 2001
From: xue <>
Date: Thu, 2 Feb 2006 23:53:32 +0000
Subject: Modified onSaveState to saveState, and onLoadState to loadState.
---
demos/quickstart/protected/pages/Controls/DataGrid1.page | 2 +-
.../pages/Controls/Samples/TDataGrid/Sample1.page | 3 ++-
framework/Web/UI/TControl.php | 14 +++++---------
framework/Web/UI/TPage.php | 10 ++++------
framework/Web/UI/WebControls/TDataGrid.php | 8 ++++----
framework/Web/UI/WebControls/TDataList.php | 8 ++++----
framework/Web/UI/WebControls/TListControl.php | 8 ++++----
framework/Web/UI/WebControls/TRepeater.php | 8 ++++----
8 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/demos/quickstart/protected/pages/Controls/DataGrid1.page b/demos/quickstart/protected/pages/Controls/DataGrid1.page
index 63d55f8c..27e5a777 100644
--- a/demos/quickstart/protected/pages/Controls/DataGrid1.page
+++ b/demos/quickstart/protected/pages/Controls/DataGrid1.page
@@ -92,7 +92,7 @@ To manually specify columns, set AutoGenerateColumns to false, and spec
</com:TDataGrid>
-Note, if AutoGenerateColumns is true and there are manually specified columns, the automatically generated columns will be displayed first. Also note, the datagrid's Columns property only contains manually specified columns.
+Note, if AutoGenerateColumns is true and there are manually specified columns, the automatically generated columns will be appended to the manually specified columns. Also note, the datagrid's Columns property only contains manually specified columns.
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.page
index 05ba4630..5b5f0a1c 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.page
@@ -1,10 +1,11 @@
TDataGrid Sample 1
-Automatically Generated Columns
+Using Automatically Generated Columns
raiseEvent('OnSaveState',$this,$param);
}
/**
* This method is invoked right after the control has loaded its state.
* You can override this method to initialize data from the control state.
* Parent implementation must be invoked.
- * @param TEventParameter
*/
- public function onLoadState($param)
+ public function loadState()
{
- $this->raiseEvent('OnLoadState',$this,$param);
}
/**
@@ -1334,10 +1330,10 @@ class TControl extends TComponent
if(!empty($state))
$this->_rf[self::RF_CHILD_STATE]=&$state;
$this->_stage=self::CS_STATE_LOADED;
- $this->onLoadState(null);
}
- else // no state to load and thus no need onLoadState()
+ else
$this->_stage=self::CS_STATE_LOADED;
+ $this->loadState();
}
/**
@@ -1347,7 +1343,7 @@ class TControl extends TComponent
*/
final protected function &saveStateRecursive($needViewState=true)
{
- $this->onSaveState(null);
+ $this->saveState();
$needViewState=($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE));
$state=array();
if($this->getHasControls())
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 5f583f0b..11f89ab5 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -525,11 +525,10 @@ class TPage extends TTemplateControl
* This method is invoked when control state is to be saved.
* You can override this method to do last step state saving.
* Parent implementation must be invoked.
- * @param TEventParameter event parameter
*/
- public function onSaveState($param)
+ public function saveState()
{
- parent::onSaveState($param);
+ parent::saveState();
$this->setViewState('ControlsRequiringPostBack',$this->_controlsRegisteredForPostData,array());
}
@@ -537,12 +536,11 @@ class TPage extends TTemplateControl
* This method is invoked right after the control has loaded its state.
* You can override this method to initialize data from the control state.
* Parent implementation must be invoked.
- * @param TEventParameter
*/
- public function onLoadState($param)
+ public function loadState()
{
+ parent::loadState();
$this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack',array());
- parent::onLoadState($param);
}
/**
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index 8b159905..2636bd05 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -718,10 +718,10 @@ class TDataGrid extends TBaseDataList
/**
* Saves item count in viewstate.
* This method is invoked right before control state is to be saved.
- * @param mixed event parameter
*/
- public function onSaveState($param)
+ public function saveState()
{
+ parent::saveState();
if($this->_items)
$this->setViewState('ItemCount',$this->_items->getCount(),0);
else
@@ -740,10 +740,10 @@ class TDataGrid extends TBaseDataList
/**
* Loads item count information from viewstate.
* This method is invoked right after control state is loaded.
- * @param mixed event parameter
*/
- public function onLoadState($param)
+ public function loadState()
{
+ parent::loadState();
if(!$this->getIsDataBound())
{
$state=$this->getViewState('ColumnState',array());
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index f5292220..d04acdaf 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -1018,10 +1018,10 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
/**
* Saves item count in viewstate.
* This method is invoked right before control state is to be saved.
- * @param mixed event parameter
*/
- public function onSaveState($param)
+ public function saveState()
{
+ parent::saveState();
if($this->_items)
$this->setViewState('ItemCount',$this->_items->getCount(),0);
else
@@ -1031,10 +1031,10 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
/**
* Loads item count information from viewstate.
* This method is invoked right after control state is loaded.
- * @param mixed event parameter
*/
- public function onLoadState($param)
+ public function loadState()
{
+ parent::loadState();
if(!$this->getIsDataBound())
$this->restoreItemsFromViewState();
$this->clearViewState('ItemCount');
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php
index 2b40bfa8..169cc72c 100644
--- a/framework/Web/UI/WebControls/TListControl.php
+++ b/framework/Web/UI/WebControls/TListControl.php
@@ -177,10 +177,10 @@ abstract class TListControl extends TDataBoundControl
/**
* Saves items into viewstate.
* This method is invoked right before control state is to be saved.
- * @param mixed event parameter
*/
- public function onSaveState($param)
+ public function saveState()
{
+ parent::saveState();
if($this->_items)
$this->setViewState('Items',$this->_items->saveState(),null);
else
@@ -190,10 +190,10 @@ abstract class TListControl extends TDataBoundControl
/**
* Loads items from viewstate.
* This method is invoked right after control state is loaded.
- * @param mixed event parameter
*/
- public function onLoadState($param)
+ public function loadState()
{
+ parent::loadState();
$this->_loadedFromState=true;
if(!$this->getIsDataBound())
{
diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php
index 43b70d2d..fc997323 100644
--- a/framework/Web/UI/WebControls/TRepeater.php
+++ b/framework/Web/UI/WebControls/TRepeater.php
@@ -305,10 +305,10 @@ class TRepeater extends TDataBoundControl implements INamingContainer
/**
* Saves item count in viewstate.
* This method is invoked right before control state is to be saved.
- * @param mixed event parameter
*/
- public function onSaveState($param)
+ public function saveState()
{
+ parent::saveState();
if($this->_items)
$this->setViewState('ItemCount',$this->_items->getCount(),0);
else
@@ -318,10 +318,10 @@ class TRepeater extends TDataBoundControl implements INamingContainer
/**
* Loads item count information from viewstate.
* This method is invoked right after control state is loaded.
- * @param mixed event parameter
*/
- public function onLoadState($param)
+ public function loadState()
{
+ parent::loadState();
if(!$this->getIsDataBound())
$this->restoreItemsFromViewState();
$this->clearViewState('ItemCount');
--
cgit v1.2.3