aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-02-20 16:49:43 +0200
committerLeif Åstrand <leif@vaadin.com>2013-02-20 16:50:42 +0200
commit253686349291d7d808bc9c47bc7dbd604ddc4ff1 (patch)
tree15842b734a6ff1d9502b9dbfcfaa18aa2397366f /client/src
parent092edcce873b5c88790025c95777909c2445b076 (diff)
downloadvaadin-framework-253686349291d7d808bc9c47bc7dbd604ddc4ff1.tar.gz
vaadin-framework-253686349291d7d808bc9c47bc7dbd604ddc4ff1.zip
Only update caption for specific state changes (#11092)
Change-Id: I31dc599f6ce19a0de07a4323b3146c48db0b9d4b
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java6
-rw-r--r--client/src/com/vaadin/client/VCaption.java24
2 files changed, 28 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 8ecc90bdd5..8f71d15c63 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -1574,8 +1574,10 @@ public class ApplicationConnection {
// Find components with potentially changed caption state
for (StateChangeEvent event : pendingStateChangeEvents) {
- ServerConnector connector = event.getConnector();
- needsCaptionUpdate.add(connector);
+ if (VCaption.mightChange(event)) {
+ ServerConnector connector = event.getConnector();
+ needsCaptionUpdate.add(connector.getConnectorId());
+ }
}
// Update captions for all suitable candidates
diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java
index efa9be1850..47287636c4 100644
--- a/client/src/com/vaadin/client/VCaption.java
+++ b/client/src/com/vaadin/client/VCaption.java
@@ -20,6 +20,7 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.Icon;
import com.vaadin.shared.AbstractComponentState;
@@ -408,6 +409,29 @@ public class VCaption extends HTML {
}
/**
+ * Checks whether anything in a given state change might cause the caption
+ * to change.
+ *
+ * @param event
+ * the state change event to check
+ * @return <code>true</code> if the caption might have changed; otherwise
+ * <code>false</code>
+ */
+ public static boolean mightChange(StateChangeEvent event) {
+ if (event.hasPropertyChanged("caption")) {
+ return true;
+ }
+ if (event.hasPropertyChanged("resources")) {
+ return true;
+ }
+ if (event.hasPropertyChanged("errorMessage")) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* Returns Paintable for which this Caption belongs to.
*
* @return owner Widget