summaryrefslogtreecommitdiffstats
path: root/client/src/com
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2012-12-07 15:16:55 +0200
committerAnna Koskinen <anna@vaadin.com>2012-12-07 15:16:55 +0200
commit5003b33b3f237fc16a3ed221056defc6bf966cf0 (patch)
tree28bb30c4198dea6197c60e49500655109f99eea9 /client/src/com
parent50665cb1d34c84bc478cd5306f6c6151fe4d0bc3 (diff)
downloadvaadin-framework-5003b33b3f237fc16a3ed221056defc6bf966cf0.tar.gz
vaadin-framework-5003b33b3f237fc16a3ed221056defc6bf966cf0.zip
Default id should get overridden only if id has been specifically set
(#10179). Change-Id: I102ca64648a88e70e88d9c546e8ea49de47451fb
Diffstat (limited to 'client/src/com')
-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