// 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
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;
return false;
}
+ /**
+ * 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.
*