diff options
author | michaelvogt <michael@vaadin.com> | 2013-03-20 18:09:49 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-03-28 16:03:45 +0000 |
commit | 833b117b967e3466b37bf95d3f801e927e0e5c45 (patch) | |
tree | 3b2451cd1d56533823641340fba863b9080e648e /server/src/com/vaadin/ui/Button.java | |
parent | a92166902c73a5b0e1e8e30e4876bc553f8779ab (diff) | |
download | vaadin-framework-833b117b967e3466b37bf95d3f801e927e0e5c45.tar.gz vaadin-framework-833b117b967e3466b37bf95d3f801e927e0e5c45.zip |
WAI-ARIA button (#11380)
Accessibility functions for Button
Change-Id: I12ddfd8232d4d35135add1cb4406bfdc20b758f2
Diffstat (limited to 'server/src/com/vaadin/ui/Button.java')
-rw-r--r-- | server/src/com/vaadin/ui/Button.java | 30 |
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. * |