summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TListItem.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-02-25 17:01:17 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-02-25 17:01:17 +0100
commit562e322fe595b4d3307ff28a96c8c5fbcc284010 (patch)
tree4b16f146c8ee931dc084758798cfdb32f64b914b /framework/Web/UI/WebControls/TListItem.php
parent294682fb45014ba04ce1b193af712208b15a6151 (diff)
Applied some misc optimizations to class serialization
Avoid saving in the page state the values of class variables if they’re still the default. Reduces page state size, based on the work initiated in 8dc9d4f7d49bcbeaf4998baf74a4f4459967c1f0
Diffstat (limited to 'framework/Web/UI/WebControls/TListItem.php')
-rw-r--r--framework/Web/UI/WebControls/TListItem.php29
1 files changed, 25 insertions, 4 deletions
diff --git a/framework/Web/UI/WebControls/TListItem.php b/framework/Web/UI/WebControls/TListItem.php
index aec006db..5a9122d6 100644
--- a/framework/Web/UI/WebControls/TListItem.php
+++ b/framework/Web/UI/WebControls/TListItem.php
@@ -32,19 +32,19 @@ class TListItem extends TComponent
/**
* @var string text of the item
*/
- private $_text;
+ private $_text='';
/**
* @var string value of the item
*/
- private $_value;
+ private $_value='';
/**
* @var boolean whether the item is enabled
*/
- private $_enabled;
+ private $_enabled=true;
/**
* @var boolean whether the item is selected
*/
- private $_selected;
+ private $_selected=false;
/**
* Constructor.
@@ -62,6 +62,27 @@ class TListItem extends TComponent
}
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_attributes===null)
+ $exprops[] = "\0TListItem\0_attributes";
+ if($this->_text==='')
+ $exprops[] = "\0TListItem\0_text";
+ if($this->_value==='')
+ $exprops[] = "\0TListItem\0_value";
+ if ($this->_enabled===true)
+ $exprops[] = "\0TListItem\0_enabled";
+ if ($this->_selected===false)
+ $exprops[] = "\0TListItem\0_selected";
+ }
+
+ /**
* @return boolean whether the item is enabled
*/
public function getEnabled()