summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-12-07 13:32:16 +0000
committerVaadin Code Review <review@vaadin.com>2012-12-07 13:32:16 +0000
commit83b5695f5585f6a1aa305df40ae0c9739ac02d8b (patch)
treea930f71d6cd19aa81139ca8f1ea7e1b2b086e496 /client
parenta5e946aa3a714688f1cde1de8d1cf392aa36ba5c (diff)
parent5003b33b3f237fc16a3ed221056defc6bf966cf0 (diff)
downloadvaadin-framework-83b5695f5585f6a1aa305df40ae0c9739ac02d8b.tar.gz
vaadin-framework-83b5695f5585f6a1aa305df40ae0c9739ac02d8b.zip
Merge "Default id should get overridden only if id has been specifically set (#10179)."
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index 16b5adef81..d11be76a80 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -17,6 +17,7 @@ package com.vaadin.client.ui;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Focusable;
@@ -53,6 +54,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
private String lastKnownWidth = "";
private String lastKnownHeight = "";
+ private boolean initialStateEvent = true;
+
/**
* The style names from getState().getStyles() which are currently applied
* to the widget.
@@ -123,11 +126,13 @@ public abstract class AbstractComponentConnector extends AbstractConnector
public void onStateChanged(StateChangeEvent stateChangeEvent) {
ConnectorMap paintableMap = ConnectorMap.get(getConnection());
- if (getState().id != null) {
- getWidget().getElement().setId(getState().id);
- } else {
- getWidget().getElement().removeAttribute("id");
-
+ Set<String> changedProperties = stateChangeEvent.getChangedProperties();
+ if (changedProperties.contains("id")) {
+ if (getState().id != null) {
+ getWidget().getElement().setId(getState().id);
+ } else if (!initialStateEvent) {
+ getWidget().getElement().removeAttribute("id");
+ }
}
/*
@@ -164,6 +169,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
*/
updateComponentSize();
+
+ initialStateEvent = false;
}
@Override