diff options
author | Fabian Lange <lange.fabian@gmail.com> | 2014-06-20 10:49:50 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-06-23 06:51:47 +0000 |
commit | 0c229ae91460fedaeb557bdc5a646433658b0dfb (patch) | |
tree | 4959adbc8ab29cc67515e44e2fc792d39ffba310 /server/src/com/vaadin/ui/Label.java | |
parent | 6e109e4d73b7e3c09da3000a813904b52ea89991 (diff) | |
download | vaadin-framework-0c229ae91460fedaeb557bdc5a646433658b0dfb.tar.gz vaadin-framework-0c229ae91460fedaeb557bdc5a646433658b0dfb.zip |
Reading properties of components should not set state to dirty (#14060).
Many core vaadin components did incorrectly mark the state as dirty when
reading from them. This patch fixes the problem, which should reduce the
amount of server->client state updates significantly.
Change-Id: I342d74129e2985a7f407e9b53a802dc0146d9992
Diffstat (limited to 'server/src/com/vaadin/ui/Label.java')
-rw-r--r-- | server/src/com/vaadin/ui/Label.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index b4685adcea..c73840e6e9 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -155,6 +155,11 @@ public class Label extends AbstractComponent implements Property<String>, return (LabelState) super.getState(); } + @Override + protected LabelState getState(boolean markAsDirty) { + return (LabelState) super.getState(markAsDirty); + } + /** * Gets the value of the label. * <p> @@ -168,7 +173,7 @@ public class Label extends AbstractComponent implements Property<String>, public String getValue() { if (getPropertyDataSource() == null) { // Use internal value if we are running without a data source - return getState().text; + return getState(false).text; } return getDataSourceValue(); } @@ -196,7 +201,7 @@ public class Label extends AbstractComponent implements Property<String>, public void setValue(String newStringValue) { if (getPropertyDataSource() == null) { - LabelState state = (LabelState) getState(false); + LabelState state = getState(false); String oldTextValue = state.text; if (!SharedUtil.equals(oldTextValue, newStringValue)) { getState().text = newStringValue; @@ -281,7 +286,7 @@ public class Label extends AbstractComponent implements Property<String>, * @see ContentMode */ public ContentMode getContentMode() { - return getState().contentMode; + return getState(false).contentMode; } /** @@ -412,8 +417,7 @@ public class Label extends AbstractComponent implements Property<String>, private void updateValueFromDataSource() { // Update the internal value from the data source String newConvertedValue = getDataSourceValue(); - if (!SharedUtil.equals(newConvertedValue, - ((LabelState) getState(false)).text)) { + if (!SharedUtil.equals(newConvertedValue, getState(false).text)) { getState().text = newConvertedValue; fireValueChange(); } |