summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-08-08 11:05:38 +0300
committerJohn Ahlroos <john@vaadin.com>2013-08-08 13:17:30 +0300
commit5fb05e84c80931fcaa9929ad556a20f5316e06a8 (patch)
treebd4d977bd653a16b0dd38bc9d09d8e38d2cd9c4f /client
parent11f8811eb0f7a306c403d36ab45f5d8658d7a164 (diff)
downloadvaadin-framework-5fb05e84c80931fcaa9929ad556a20f5316e06a8.tar.gz
vaadin-framework-5fb05e84c80931fcaa9929ad556a20f5316e06a8.zip
Fixes Button icon alt text not being updated #12333
Change-Id: I23a26fbc5281e76792e257321d96f3d30a8bc2b2
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/Icon.java11
-rw-r--r--client/src/com/vaadin/client/ui/button/ButtonConnector.java13
2 files changed, 19 insertions, 5 deletions
diff --git a/client/src/com/vaadin/client/ui/Icon.java b/client/src/com/vaadin/client/ui/Icon.java
index 5ba3cc6eeb..9d5829c079 100644
--- a/client/src/com/vaadin/client/ui/Icon.java
+++ b/client/src/com/vaadin/client/ui/Icon.java
@@ -53,4 +53,15 @@ public class Icon extends UIObject {
}
}
+ /**
+ * Sets the alternate text for the icon.
+ *
+ * @param alternateText
+ * with the alternate text.
+ */
+ public void setAlternateText(String alternateText) {
+ getElement().setAttribute("alt",
+ alternateText == null ? "" : alternateText);
+ }
+
}
diff --git a/client/src/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/com/vaadin/client/ui/button/ButtonConnector.java
index fff983c168..a6630f28b9 100644
--- a/client/src/com/vaadin/client/ui/button/ButtonConnector.java
+++ b/client/src/com/vaadin/client/ui/button/ButtonConnector.java
@@ -24,7 +24,6 @@ import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
import com.vaadin.client.EventHelper;
import com.vaadin.client.MouseEventDetailsBuilder;
import com.vaadin.client.communication.StateChangeEvent;
@@ -84,13 +83,12 @@ public class ButtonConnector extends AbstractComponentConnector implements
if (getIcon() != null) {
if (getWidget().icon == null) {
getWidget().icon = new Icon(getConnection());
- Element iconElement = getWidget().icon.getElement();
- iconElement.setAttribute("alt", getState().iconAltText);
-
- getWidget().wrapper.insertBefore(iconElement,
+ getWidget().wrapper.insertBefore(
+ getWidget().icon.getElement(),
getWidget().captionElement);
}
getWidget().icon.setUri(getIcon());
+ getWidget().icon.setAlternateText(getState().iconAltText);
} else {
if (getWidget().icon != null) {
getWidget().wrapper.removeChild(getWidget().icon
@@ -120,6 +118,11 @@ public class ButtonConnector extends AbstractComponentConnector implements
}
}
+ if (getWidget().icon != null
+ && stateChangeEvent.hasPropertyChanged("iconAltText")) {
+ getWidget().icon.setAlternateText(getState().iconAltText);
+ }
+
getWidget().clickShortcut = getState().clickShortcutKeyCode;
}