summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TStyle.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/TStyle.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/TStyle.php')
-rw-r--r--framework/Web/UI/WebControls/TStyle.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index eb47f2f7..552a3786 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -47,6 +47,27 @@ class TStyle extends TComponent
private $_displayStyle='Fixed';
/**
+ * 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->_fields===array())
+ $exprops[] = "\0TStyle\0_fields";
+ if($this->_font===null)
+ $exprops[] = "\0TStyle\0_font";
+ if($this->_class===null)
+ $exprops[] = "\0TStyle\0_class";
+ if ($this->_customStyle===null)
+ $exprops[] = "\0TStyle\0_customStyle";
+ if ($this->_displayStyle==='Fixed')
+ $exprops[] = "\0TStyle\0_displayStyle";
+ }
+
+ /**
* Constructor.
* @param TStyle style to copy from
*/
@@ -463,6 +484,29 @@ class TTableStyle extends TStyle
private $_borderCollapse=null;
/**
+ * 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->_backImageUrl===null)
+ $exprops[] = "\0TTableStyle\0_backImageUrl";
+ if ($this->_horizontalAlign===null)
+ $exprops[] = "\0TTableStyle\0_horizontalAlign";
+ if ($this->_cellPadding===null)
+ $exprops[] = "\0TTableStyle\0_cellPadding";
+ if ($this->_cellSpacing===null)
+ $exprops[] = "\0TTableStyle\0_cellSpacing";
+ if ($this->_gridLines===null)
+ $exprops[] = "\0TTableStyle\0_gridLines";
+ if ($this->_borderCollapse===null)
+ $exprops[] = "\0TTableStyle\0_borderCollapse";
+ }
+
+ /**
* Sets the style attributes to default values.
* This method overrides the parent implementation by
* resetting additional TTableStyle specific attributes.
@@ -691,6 +735,23 @@ class TTableItemStyle extends TStyle
private $_wrap=null;
/**
+ * 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->_horizontalAlign===null)
+ $exprops[] = "\0TTableItemStyle\0_horizontalAlign";
+ if ($this->_verticalAlign===null)
+ $exprops[] = "\0TTableItemStyle\0_verticalAlign";
+ if ($this->_wrap===null)
+ $exprops[] = "\0TTableItemStyle\0_wrap";
+ }
+
+ /**
* Sets the style attributes to default values.
* This method overrides the parent implementation by
* resetting additional TTableItemStyle specific attributes.