aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authormichaelvogt <michael@vaadin.com>2013-03-20 18:09:49 +0200
committerVaadin Code Review <review@vaadin.com>2013-03-28 16:03:45 +0000
commit833b117b967e3466b37bf95d3f801e927e0e5c45 (patch)
tree3b2451cd1d56533823641340fba863b9080e648e /server
parenta92166902c73a5b0e1e8e30e4876bc553f8779ab (diff)
downloadvaadin-framework-833b117b967e3466b37bf95d3f801e927e0e5c45.tar.gz
vaadin-framework-833b117b967e3466b37bf95d3f801e927e0e5c45.zip
WAI-ARIA button (#11380)
Accessibility functions for Button Change-Id: I12ddfd8232d4d35135add1cb4406bfdc20b758f2
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/Button.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java
index fcfc55aadc..1bcf802f12 100644
--- a/server/src/com/vaadin/ui/Button.java
+++ b/server/src/com/vaadin/ui/Button.java
@@ -32,6 +32,7 @@ import com.vaadin.event.ShortcutAction;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.event.ShortcutAction.ModifierKey;
import com.vaadin.event.ShortcutListener;
+import com.vaadin.server.Resource;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.button.ButtonServerRpc;
import com.vaadin.shared.ui.button.ButtonState;
@@ -581,6 +582,35 @@ public class Button extends AbstractComponent implements
}
/**
+ * Sets the component's icon and alt text.
+ *
+ * An alt text is shown when an image could not be loaded, and read by
+ * assisitve devices.
+ *
+ * @param icon
+ * the icon to be shown with the component's caption.
+ * @param iconAltText
+ * String to use as alt text
+ */
+ public void setIcon(Resource icon, String iconAltText) {
+ super.setIcon(icon);
+ getState().iconAltText = iconAltText == null ? "" : iconAltText;
+ }
+
+ /**
+ * Returns the icon's alt text.
+ *
+ * @return String with the alt text
+ */
+ public String getIconAlternateText() {
+ return getState().iconAltText;
+ }
+
+ public void setIconAlternateText(String iconAltText) {
+ getState().iconAltText = iconAltText;
+ }
+
+ /**
* Set whether the caption text is rendered as HTML or not. You might need
* to retheme button to allow higher content than the original text style.
*