summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-03-06 19:39:56 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-03-06 19:39:56 +0100
commitcc53959ac5ba3e786f3d6ad3403919b82c52fa42 (patch)
tree77e0b29f387cde1b380813f93a73a2c4aa16390e /framework
parentc7ab73d6448aad8aa630878fc83298b762505194 (diff)
Activecontrols: avoid updating client side if the value didn't change
Fix #399
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveButton.php3
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBox.php6
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCustomValidator.php9
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveDatePicker.php3
-rw-r--r--framework/Web/UI/ActiveControls/TActiveHiddenField.php3
-rw-r--r--framework/Web/UI/ActiveControls/TActiveHyperLink.php12
-rw-r--r--framework/Web/UI/ActiveControls/TActiveImage.php12
-rw-r--r--framework/Web/UI/ActiveControls/TActiveImageButton.php12
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLabel.php6
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLinkButton.php6
-rw-r--r--framework/Web/UI/ActiveControls/TActiveListBox.php3
-rw-r--r--framework/Web/UI/ActiveControls/TActiveListControlAdapter.php12
-rw-r--r--framework/Web/UI/ActiveControls/TActiveMultiView.php12
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButton.php6
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRatingList.php9
-rw-r--r--framework/Web/UI/ActiveControls/TActiveTextBox.php3
-rw-r--r--framework/Web/UI/ActiveControls/TInPlaceTextBox.php8
-rw-r--r--framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php4
18 files changed, 123 insertions, 6 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveButton.php b/framework/Web/UI/ActiveControls/TActiveButton.php
index ae5b7f08..edab97c5 100644
--- a/framework/Web/UI/ActiveControls/TActiveButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveButton.php
@@ -94,6 +94,9 @@ class TActiveButton extends TButton implements ICallbackEventHandler, IActiveCon
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'value', $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBox.php b/framework/Web/UI/ActiveControls/TActiveCheckBox.php
index 034666f8..2be6d8fd 100644
--- a/framework/Web/UI/ActiveControls/TActiveCheckBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveCheckBox.php
@@ -88,6 +88,9 @@ class TActiveCheckBox extends TCheckBox implements ICallbackEventHandler, IActiv
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->update(
@@ -103,6 +106,9 @@ class TActiveCheckBox extends TCheckBox implements ICallbackEventHandler, IActiv
public function setChecked($value)
{
$value = TPropertyValue::ensureBoolean($value);
+ if(parent::getChecked() === $value)
+ return;
+
parent::setChecked($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->check($this, $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
index 18f9f5f3..fa7f8085 100644
--- a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
+++ b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
@@ -104,6 +104,9 @@ class TActiveCustomValidator extends TCustomValidator
*/
public function setIsValid($value)
{
+ // Always update the clientside, since the clientside's value for IsValid
+ // it could have been changed by the clientside validation.
+
parent::setIsValid($value);
if($this->getActiveControl()->canUpdateClientSide())
{
@@ -137,11 +140,15 @@ class TActiveCustomValidator extends TCustomValidator
}
/**
- * Sets the text for the error message. Updates client-side erorr message.
+ * Sets the text for the error message. Updates client-side error message.
* @param string the error message
*/
public function setErrorMessage($value)
{
+ if(parent::getErrorMessage() === $value)
+ return;
+
+
parent::setErrorMessage($value);
if($this->getActiveControl()->canUpdateClientSide())
{
diff --git a/framework/Web/UI/ActiveControls/TActiveDatePicker.php b/framework/Web/UI/ActiveControls/TActiveDatePicker.php
index 6328bac7..66fa8a8c 100755
--- a/framework/Web/UI/ActiveControls/TActiveDatePicker.php
+++ b/framework/Web/UI/ActiveControls/TActiveDatePicker.php
@@ -89,6 +89,9 @@ class TActiveDatePicker extends TDatePicker implements ICallbackEventHandler, I
* @param string text content for the textbox
*/
public function setText($value){
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){
$cb=$this->getPage()->getCallbackClient();
diff --git a/framework/Web/UI/ActiveControls/TActiveHiddenField.php b/framework/Web/UI/ActiveControls/TActiveHiddenField.php
index f87ff078..e0393370 100644
--- a/framework/Web/UI/ActiveControls/TActiveHiddenField.php
+++ b/framework/Web/UI/ActiveControls/TActiveHiddenField.php
@@ -55,6 +55,9 @@ class TActiveHiddenField extends THiddenField implements ICallbackEventHandler,
*/
public function setValue($value)
{
+ if(parent::getValue() === $value)
+ return;
+
parent::setValue($value);
if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData())
$this->getPage()->getCallbackClient()->setValue($this, $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveHyperLink.php b/framework/Web/UI/ActiveControls/TActiveHyperLink.php
index 2ffee7e8..728a280f 100644
--- a/framework/Web/UI/ActiveControls/TActiveHyperLink.php
+++ b/framework/Web/UI/ActiveControls/TActiveHyperLink.php
@@ -50,6 +50,9 @@ class TActiveHyperLink extends THyperLink implements IActiveControl
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->update($this, $value);
@@ -61,6 +64,9 @@ class TActiveHyperLink extends THyperLink implements IActiveControl
*/
public function setImageUrl($value)
{
+ if(parent::getImageUrl() === $value)
+ return;
+
parent::setImageUrl($value);
if($this->getActiveControl()->canUpdateClientSide() && $value !== '')
{
@@ -77,6 +83,9 @@ class TActiveHyperLink extends THyperLink implements IActiveControl
*/
public function setNavigateUrl($value)
{
+ if(parent::getNavigateUrl() === $value)
+ return;
+
parent::setNavigateUrl($value);
if($this->getActiveControl()->canUpdateClientSide())
{
@@ -92,6 +101,9 @@ class TActiveHyperLink extends THyperLink implements IActiveControl
*/
public function setTarget($value)
{
+ if(parent::getTarget() === $value)
+ return;
+
parent::setTarget($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'target', $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveImage.php b/framework/Web/UI/ActiveControls/TActiveImage.php
index 13d53147..e488a2a8 100644
--- a/framework/Web/UI/ActiveControls/TActiveImage.php
+++ b/framework/Web/UI/ActiveControls/TActiveImage.php
@@ -48,6 +48,9 @@ class TActiveImage extends TImage implements IActiveControl
*/
public function setAlternateText($value)
{
+ if(parent::getAlternateText() === $value)
+ return;
+
parent::setAlternateText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'alt', $value);
@@ -62,6 +65,9 @@ class TActiveImage extends TImage implements IActiveControl
*/
public function setImageAlign($value)
{
+ if(parent::getImageAlign() === $value)
+ return;
+
parent::setImageAlign($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'align', $value);
@@ -72,6 +78,9 @@ class TActiveImage extends TImage implements IActiveControl
*/
public function setImageUrl($value)
{
+ if(parent::getImageUrl() === $value)
+ return;
+
parent::setImageUrl($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'src', $value);
@@ -82,6 +91,9 @@ class TActiveImage extends TImage implements IActiveControl
*/
public function setDescriptionUrl($value)
{
+ if(parent::getDescriptionUrl() === $value)
+ return;
+
parent::setDescriptionUrl($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'longdesc', $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveImageButton.php b/framework/Web/UI/ActiveControls/TActiveImageButton.php
index 351a9965..5b64e3f7 100644
--- a/framework/Web/UI/ActiveControls/TActiveImageButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveImageButton.php
@@ -58,6 +58,9 @@ class TActiveImageButton extends TImageButton implements IActiveControl, ICallba
*/
public function setAlternateText($value)
{
+ if(parent::getAlternateText() === $value)
+ return;
+
parent::setAlternateText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'alt', $value);
@@ -72,6 +75,9 @@ class TActiveImageButton extends TImageButton implements IActiveControl, ICallba
*/
public function setImageAlign($value)
{
+ if(parent::getImageAlign() === $value)
+ return;
+
parent::setImageAlign($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'align', $value);
@@ -82,6 +88,9 @@ class TActiveImageButton extends TImageButton implements IActiveControl, ICallba
*/
public function setImageUrl($value)
{
+ if(parent::getImageUrl() === $value)
+ return;
+
parent::setImageUrl($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'src', $value);
@@ -92,6 +101,9 @@ class TActiveImageButton extends TImageButton implements IActiveControl, ICallba
*/
public function setDescriptionUrl($value)
{
+ if(parent::getDescriptionUrl() === $value)
+ return;
+
parent::setDescriptionUrl($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->setAttribute($this, 'longdesc', $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveLabel.php b/framework/Web/UI/ActiveControls/TActiveLabel.php
index 70ff20ed..4859e504 100644
--- a/framework/Web/UI/ActiveControls/TActiveLabel.php
+++ b/framework/Web/UI/ActiveControls/TActiveLabel.php
@@ -55,6 +55,9 @@ class TActiveLabel extends TLabel implements IActiveControl
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->update($this, $value);
@@ -68,6 +71,9 @@ class TActiveLabel extends TLabel implements IActiveControl
*/
public function setForControl($value)
{
+ if(parent::getForControl() === $value)
+ return;
+
parent::setForControl($value);
if($this->getActiveControl()->canUpdateClientSide())
{
diff --git a/framework/Web/UI/ActiveControls/TActiveLinkButton.php b/framework/Web/UI/ActiveControls/TActiveLinkButton.php
index aaf2d35d..e3b7b76f 100644
--- a/framework/Web/UI/ActiveControls/TActiveLinkButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveLinkButton.php
@@ -95,6 +95,9 @@ class TActiveLinkButton extends TLinkButton implements IActiveControl, ICallback
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->update($this, $value);
@@ -131,6 +134,9 @@ class TActiveLinkButton extends TLinkButton implements IActiveControl, ICallback
*/
public function setEnabled($value)
{
+ if(parent::getEnabled() === $value)
+ return;
+
parent::setEnabled($value);
if($this->getActiveControl()->canUpdateClientSide())
{
diff --git a/framework/Web/UI/ActiveControls/TActiveListBox.php b/framework/Web/UI/ActiveControls/TActiveListBox.php
index e32a8eba..35a173e2 100644
--- a/framework/Web/UI/ActiveControls/TActiveListBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveListBox.php
@@ -85,6 +85,9 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH
*/
public function setSelectionMode($value)
{
+ if(parent::getSelectionMode() === $value)
+ return;
+
parent::setSelectionMode($value);
$multiple = $this->getIsMultiSelect();
$id = $this->getUniqueID(); $multi_id = $id.'[]';
diff --git a/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
index 927912b0..679a7f94 100644
--- a/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActiveListControlAdapter.php
@@ -41,6 +41,9 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
*/
public function setSelectedIndex($index)
{
+ if($this->getControl()->getSelectedIndex() === $index)
+ return;
+
if($this->canUpdateClientSide())
{
$this->updateListItems();
@@ -64,6 +67,9 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
*/
public function setSelectedIndices($indices)
{
+ if($this->getControl()->getSelectedIndices() === $indices)
+ return;
+
if($this->canUpdateClientSide())
{
$this->updateListItems();
@@ -94,6 +100,9 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
*/
public function setSelectedValue($value)
{
+ if($this->getControl()->getSelectedValue() === $value)
+ return;
+
if($this->canUpdateClientSide())
{
$this->updateListItems();
@@ -108,6 +117,9 @@ class TActiveListControlAdapter extends TActiveControlAdapter implements IListCo
*/
public function setSelectedValues($values)
{
+ if($this->getControl()->getSelectedValues() === $values)
+ return;
+
if($this->canUpdateClientSide())
{
$this->updateListItems();
diff --git a/framework/Web/UI/ActiveControls/TActiveMultiView.php b/framework/Web/UI/ActiveControls/TActiveMultiView.php
index 215706ec..45c137de 100644
--- a/framework/Web/UI/ActiveControls/TActiveMultiView.php
+++ b/framework/Web/UI/ActiveControls/TActiveMultiView.php
@@ -92,9 +92,11 @@ class TActiveMultiView extends TMultiView implements IActiveControl
*/
public function setActiveViewIndex($value)
{
- $old=parent::getActiveViewIndex();
+ if(parent::getActiveViewIndex() === $value)
+ return;
+
parent::setActiveViewIndex($value);
- if($this->getActiveControl()->canUpdateClientSide() && $old!=$value)
+ if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter());
}
@@ -104,9 +106,11 @@ class TActiveMultiView extends TMultiView implements IActiveControl
*/
public function setActiveView($value)
{
- $old=parent::getActiveView();
+ if(parent::getActiveView() === $value)
+ return;
+
parent::setActiveView($value);
- if($this->getActiveControl()->canUpdateClientSide() && $old!=$value)
+ if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter());
}
}
diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButton.php b/framework/Web/UI/ActiveControls/TActiveRadioButton.php
index 90190a12..4e5280c7 100644
--- a/framework/Web/UI/ActiveControls/TActiveRadioButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveRadioButton.php
@@ -87,6 +87,9 @@ class TActiveRadioButton extends TRadioButton implements IActiveControl, ICallba
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->update(
@@ -102,6 +105,9 @@ class TActiveRadioButton extends TRadioButton implements IActiveControl, ICallba
public function setChecked($value)
{
$value = TPropertyValue::ensureBoolean($value);
+ if(parent::getChecked() === $value)
+ return;
+
parent::setChecked($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getCallbackClient()->check($this, $value);
diff --git a/framework/Web/UI/ActiveControls/TActiveRatingList.php b/framework/Web/UI/ActiveControls/TActiveRatingList.php
index a154eb69..ce0e86b6 100644
--- a/framework/Web/UI/ActiveControls/TActiveRatingList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRatingList.php
@@ -80,6 +80,9 @@ class TActiveRatingList extends TRatingList implements IActiveControl, ICallback
*/
public function setReadOnly($value)
{
+ if(parent::getReadOnly() === $value)
+ return;
+
parent::setReadOnly($value);
$value = $this->getReadOnly();
$this->callClientFunction('setReadOnly',$value);
@@ -90,6 +93,9 @@ class TActiveRatingList extends TRatingList implements IActiveControl, ICallback
*/
public function setRating($value)
{
+ if(parent::getRating() === $value)
+ return;
+
parent::setRating($value);
$value = $this->getRating();
$this->callClientFunction('setRating',$value);
@@ -115,6 +121,9 @@ class TActiveRatingList extends TRatingList implements IActiveControl, ICallback
*/
public function setCaption($value)
{
+ if(parent::getCaption() === $value)
+ return;
+
parent::setCaption($value);
// if it's an active control, this should not be needed.
$this->callClientFunction('setCaption',$value);
diff --git a/framework/Web/UI/ActiveControls/TActiveTextBox.php b/framework/Web/UI/ActiveControls/TActiveTextBox.php
index f80b4986..d3250c8f 100644
--- a/framework/Web/UI/ActiveControls/TActiveTextBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveTextBox.php
@@ -62,6 +62,9 @@ class TActiveTextBox extends TTextBox implements ICallbackEventHandler, IActiveC
*/
public function setText($value)
{
+ if(parent::getText() === $value)
+ return;
+
parent::setText($value);
if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData())
$this->getPage()->getCallbackClient()->setValue($this, $value);
diff --git a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
index d267729d..7c4bbd9b 100644
--- a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
+++ b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
@@ -13,7 +13,7 @@ Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
/**
* TInPlaceTextBox Class
- * *
+ *
* TInPlaceTextBox is a component rendered as a label and allows its
* contents to be edited by changing the label to a textbox when
* the label is clicked or when another control or html element with
@@ -135,6 +135,9 @@ class TInPlaceTextBox extends TActiveTextBox
*/
public function setText($value)
{
+ if(TTextBox::getText() === $value)
+ return;
+
TTextBox::setText($value);
if($this->getActiveControl()->canUpdateClientSide())
{
@@ -152,6 +155,9 @@ class TInPlaceTextBox extends TActiveTextBox
public function setReadOnly ($value)
{
$value=TPropertyValue::ensureBoolean($value);
+ if(TTextBox::getReadOnly() === $value)
+ return;
+
TTextBox::setReadOnly($value);
if ($this->getActiveControl()->canUpdateClientSide())
{
diff --git a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
index b643de46..79e411b7 100644
--- a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
+++ b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
@@ -46,6 +46,10 @@ class TTimeTriggeredCallback extends TCallback
$interval = TPropertyValue::ensureFloat($value);
if($interval <= 0)
throw new TConfigurationException('callback_interval_be_positive', $this->getID());
+
+ if($this->getInterval() === $value)
+ return;
+
$this->setViewState('Interval', $interval, 1);
if ($this->getActiveControl()->canUpdateClientSide()){
$client = $this->getPage()->getCallbackClient();